Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

Commits on main

feat(config): cache the active workspace and give it an opaque handle\n\n`active_workspace_dir` reads a marker file on every call. That is the\nright cost for a decision and the wrong one for a stream: the developer\nEvent Log stamps every domain event the process publishes, from a\n`tokio_stream` `filter_map` closure that is synchronous and could not\nawait a disk read even if the cost were acceptable.\n\nAdd a process-global slot holding the last workspace the loader\nresolved, readable synchronously and without I/O. It is written through\nfrom the two `ProcessEnv` entry points — `Config::load_or_init` and\n`active_workspace_dir` — and cleared by every write to a marker the\nresolver reads, so the disk stays the source of truth and the value can\nbe unknown but never stale. The env-injectable loader deliberately does\nnot publish: it takes an injected `EnvLookup` so tests can drive the\n`OPENHUMAN_WORKSPACE` branch against a fixture, and publishing from\nthere would make one test's temp directory the whole binary's idea of\nthe active workspace.\n\nWhat is announced is tracked separately from what is cached.\nInvalidation says the answer may have changed, not that it did — signing\nin as the already-active user rewrites `active_user.toml` with the same\nid — so without that split the re-resolve would announce a switch that\nnever happened.\n\nAdd `workspace_handle`: a short digest that answers the only question a\nconsumer asks ("same workspace or not?") without putting an absolute\npath under the user's home directory on a shared, exportable surface.\nNormalised lexically rather than canonicalised, because the primary\ncaller is synchronous and because a stale-workspace event is precisely\nthe case where the directory may already be gone.\n\nAdd `DomainEvent::workspace_dir`, the single answer to which workspace\nan event belongs to, covering the channel, artifact and MCP-supervisor\nfamilies. `desktop::notifications` had its own private list naming only\nthe MCP arms, so the two families carrying the same field were silently\nungated.\n\nAdd `DomainEvent::ActiveWorkspaceChanged` so a long-lived consumer\nlearns about a switch without polling, and bump `EVENTS_VERSION` to\n1.2.0 per the catalog's own rule.\n\nRefs #5966\n
Shanu committed 3 months ago
abd7be1
fix(app_state): an empty backend answer is not a refresh\n\nCodeRabbit review on #5950.\n\n`note_current_user_success` ran whenever `auth_get_me` returned without an\nerror, including the case where the backend answers 200 carrying no user at\nall. The snapshot caller falls back to `stored_user` on that path\n(`Ok(Ok(None))`), so the stamp claimed a ~0s age for data that was never\nreplaced — the staleness signal wrong in the one direction that defeats it,\nsince the field exists to warn that data is out of date.\n\nGated on `fetched.is_some()`. Two notes:\n\n- `clear_current_user_failure` still runs unconditionally. An empty answer is\n the backend being healthy but unhelpful, not an availability failure, and\n holding the backoff window open on it would be wrong for its own reasons.\n Only the freshness claim was unearned.\n\n- Gated before taking the cache lock rather than inside the `Some(user)` arm,\n so this never nests `LAST_CURRENT_USER_SUCCESS` inside `CURRENT_USER_CACHE`.\n No path takes those two in the opposite order today, so it would not\n deadlock, but the ordering hazard buys nothing.\n\nThe doc comment is corrected too, since it is what let this through: it said\n"when the backend last answered `auth_get_me` successfully", which made\nstamping an empty 200 look right. It now describes when the displayed data was\nlast replaced, and `note_current_user_success` states the caller's obligation.\n\nCovered by `an_empty_user_response_is_not_counted_as_a_refresh` against a new\n`auth_me_empty_user_server`: the stored user survives and\n`current_user_stale_seconds` is `None` rather than `0`.\n
Shanu committed 3 months ago
e83c293
fix(app_state): scope staleness to the identity and skip rejected sessions\n\nReview findings on #5950.\n\n- The stale flag was keyed on `(api_base, token)` but the age was read from\n a bare global, so identity A succeeding and identity B then failing\n reported A's freshness against B's outage. The ordinary\n `credentials::clear_session` logout also never ran\n `clear_current_user_success` — only the deferred-rejection path did — so\n the leak survived a logout and re-login in one process. The stamp now\n carries the identity it belongs to and is matched on read, which makes it\n self-correcting the way the failure record already was instead of relying\n on every future sign-out path remembering to clear it.\n\n- `DeferredSessionRejected` clears `auth`, `session_token` and\n `current_user`, but the staleness fields were read before that arm ran, so\n a signed-out snapshot could still go out describing a user it no longer\n reports. Excluded at the read.\n\n- A suppressed replay can be wrapping a `TransientResponse` — the backend\n answering badly rather than being unreachable — so the log says\n "unavailable or unhealthy".\n\n- `OPENHUMAN_AUTH_FETCH_TIMEOUT_SECS` is documented in `.env.example` with\n its default and its 2..=12 range, next to the other operator timeouts.\n\n`scripts/ci/check-openhuman-rust-layout.mjs` caps files at 750 lines, so the\ngrowth split out two cohesive units — `ops_auth_timeout.rs` (the fetch\ntimeout and the backoff step derived from it, kept adjacent because that\nderivation is the whole guard against re-opening #5624) and\n`ops_staleness.rs` — plus `ops_current_user_backoff_tests.rs` for the\nfailure/replay/staleness tests. `include!`d files cannot carry `//!` inner\ndocs, so those headers are `//`.\n
Shanu committed 3 months ago
a83e69e
fix(app_state): distinguish replayed backoff from live refresh failure (#5930)\n\n`current user refresh failed ... request timed out after 5s` warnings in\n~30 seconds. Those four made no network requests. `request timed out\nafter 5s` is the string `note_current_user_timeout` records, and\n`suppressed_current_user_failure` replays it verbatim while the backoff\nwindow added in #5624 is still open — each replay costs microseconds.\n\nThe suppression path returned the recorded error unchanged, so the\nsnapshot caller could not tell a replay from a live failure and logged\nboth at WARN with the same wording. A healthy backoff that reads in the\nlogs like a hammering loop is the defect here, and it is why the issue\nwas filed.\n\n- `CurrentUserFetchError::Suppressed` wraps the replayed error with the\n run length and the remaining window. Suppression is gated on\n `allow_cache` (= `!pending_backend_validation`), so the new variant\n can only reach the catch-all arm; the pending-validation arms are\n untouched. `message()` delegates to the inner error;\n `is_availability_failure()` is false, so a replay can never widen the\n window on evidence the backend never supplied.\n\n- The `auth_get_me` timeout is configurable via\n `OPENHUMAN_AUTH_FETCH_TIMEOUT_SECS`, clamped to 2..=12s. The ceiling\n keeps it plus `RUNTIME_SNAPSHOT_TIMEOUT` under the frontend's 30s RPC\n budget. Critically, the backoff base is now derived —\n `max(10s, timeout * 2)` — because #5624's invariant is relational: a\n fixed 10s first step plus an operator-widened 20s timeout would make\n every poll re-pay the full timeout, re-opening #5624 through the knob\n added to close #5930. The invariant is asserted as a property over the\n whole permitted range instead of against one constant.\n\n- `LAST_CURRENT_USER_SUCCESS` stamps each successful answer and is\n cleared on sign-out, so the snapshot can report `currentUserStale` and\n `currentUserStaleSeconds`. Neither existing cache could answer this:\n the failure record only knows failures, and `CURRENT_USER_CACHE` is\n reset to `None` whenever the backend returns an empty user, which is\n not an outage. The age is an `Option` — absent means the backend has\n not answered this process, so the stored snapshot came off disk and\n its real age is unknowable, which is not the same as zero.\n\nStaleness is keyed on `(api_base, token)` like both caches, so switching\nenvironment or account does not inherit the previous identity's outage.\nThe core ships the contract, not a threshold — what counts as\n"significantly out of date" belongs to the surface presenting it.\n\nAC4 ("investigate server-side latency") is api.tinyhumans.ai\ninfrastructure, not this repo; see #5604 for the same host on staging.\n
Shanu committed 3 months ago
a44f429
5be7765
414a11a
fix(claude-code): stop handing the CLI's own tool calls to the harness\n\nA native `tool_use` block from the Claude Code CLI is the CLI's OWN call — a\nbuiltin (Bash / Read / Write / Edit …) or a server from the `--mcp-config` we\nhand it — and the CLI executes it inside its own agentic loop. The matching\n`tool_result` blocks were already dropped for exactly that reason.\n\nThe call half was surfaced anyway, as `ProviderDelta::ToolCallStart` +\n`ToolCallArgsDelta` and in the aggregated `ChatResponse.tool_calls`. That hands\nOpenHuman's harness a tool it does not own and cannot run, and it never sees a\nresult for it. With the full-access toggle on (no `--disallowedTools`, so the\nCLI keeps Bash and friends) a turn that reached for `Bash` produced:\n\n [tinyagents::mw] no-progress nudge … tool=Bash step=4\n [tinyagents::mw] repeated tool failure — halting run … tool=Write step=6\n run halted by circuit breaker; surfacing as breaker_halt\n\n…and the turn then burned its 900s wall-clock backstop. Neither half is\nsurfaced now, so this provider behaves as what it is: a chat model whose tool\nuse is internal. OpenHuman's own tools reach it through the prompt catalogue,\nnot through native tool calls.\n\nSecond fix in the same failure: the driver's per-turn timeout was 300s, which is\nshorter than a turn the CLI is expected to take once full access lets it work.\nThe child was killed mid-turn and it surfaced as a provider timeout rather than\na slow answer. The default is now 900s — matching the harness's own backstop —\nand is overridable with `OPENHUMAN_CLAUDE_CODE_TURN_TIMEOUT_SECS`.\n\nVerified end to end against the live CLI: "create a file … then read it back"\nreturns `File written, read back: TOOLS_WORK`, the file exists on disk, and the\nrun logs zero `repeated tool failure` / `breaker_halt` lines. Before the change\nthe same class of turn halted at step 6.\n
Guy Kaganovsky committed 3 months ago
06a7842