Skip to content

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

Commits on main

fix(config): take the workspace and its revision from one snapshot\n\nSecond review pass on #5999 found that the revision fix had the same race\nit was meant to close, one level down: three sites resolved the workspace\nand read the revision as two separate operations, so a switch between\nthem paired workspace A with B's newer revision — and a client comparing\nrevisions would then rank the stale A above the B it should yield to.\n\n`active_workspace_snapshot()` now returns the pair from the same lock\nacquisition that committed the workspace, and `publish_active_workspace`\nreturns the revision of the workspace it resolved, whether or not that\nresolve was a transition. The three consumers take the pair from it:\n\n- the per-client connect seed in `core::socketio`;\n- the notification bridge, whose gate now returns an `Announce` verdict\n carrying the revision it actually compared against, so the stamp on\n the payload is that one and not a later read;\n- the bare `active_workspace_dir()`, now a wrapper that drops the\n revision.\n\nTwo more from the same pass:\n\n- The post-write cache invalidation sat *after* a fallible\n `sync_directory`, so a sync failure skipped it and a racing resolver\n could leave the previous workspace readable after a successful rename.\n It now runs before the sync at all three marker mutations.\n- Flow approval notifications bypass the bridge that stamps workspace\n identity, and the approval gate is process-wide — so the banner stayed\n actionable after a workspace switch and could approve another\n workspace's pending call. The park site now binds the notification to\n the workspace it parked in. It fails open (unbound) if the workspace\n cannot be resolved, because not publishing at all recreates the silent\n deadlock this bridge exists to fix.\n
Shanu committed 3 months ago
fda907a
fix(profiles): widen the derived id, and let the editor and ops reach it\n\nThree gaps in the first version, all verified before changing anything.\n\n1. A 4-byte digest is 32 bits, so the birthday bound is ~65k names and\n upsert replaces by id - a collision silently overwrites a profile.\n Reproduced exactly: '研究プロフィール110131' and '研究プロフィール211703'\n both hash to profile-b7c9ce69. Take 16 bytes; the resulting\n 40-character id stays under the 64-character cap in\n validate_profile_id.\n\n2. ops::upsert re-derives the persisted id with normalise_profile_id to\n find the profile it just saved, and skips materialize_home and\n sync_soul_md_on_upsert when the lookup misses. That helper only\n slugified the raw id, so for an empty id it returned "" while the\n store had written profile-<digest>: the save succeeded and the home,\n dedicated workspace and SOUL.md sync were silently skipped. Give the\n helper the whole rule - id, then name, then digest - and have\n normalise_profile do the same, so there is one definition instead of\n two that can drift.\n\n3. ProfileEditorPage disabled Create whenever the resolved id was empty,\n and its slugify is ASCII-only - so the desktop creation UI never\n reached this fallback at all. Allow submit when the name carries at\n least one letter or digit in any script and let the core derive the\n id. A punctuation-only name still has nothing to name a profile with\n and stays blocked, as its existing test asserts.\n
Nguyen Thanh Dat committed 3 months ago
7658d87
fix(profiles): let a profile named outside ASCII be saved
Nguyen Thanh Dat committed 3 months ago
b4c2da3
fix(config): order workspace transitions so a stale one cannot win\n\nReview of #5999 found four races around the transition itself. Three\nshare a root cause — nothing ordered the transitions — so they are fixed\ntogether with one monotonic revision rather than three separate patches.\n\n**A superseded announcement could win permanently.** The bus publish\nhappens outside the lock, since a subscriber may reach back into the\nconfig layer and holding the slot across it would deadlock. That leaves\na gap between committing the state and emitting: resolver A commits A,\nresolver B commits B and emits B, then A resumes and emits a stale A.\n`announced` already held B by then, so no later resolution of B would\ncorrect it and every client sat on the workspace the user had left. A\npublisher now captures the revision it created and emits only while it\nis still the newest.\n\n**The connect snapshot could land after a switch.** The seed task and\nthe switch bridge are independent, so a snapshot resolved before a\nswitch could be delivered after its broadcast and talk a client back to\nthe previous workspace. Both payloads carry the revision; the client\nkeeps the highest it has seen.\n\n**A valid notification could be dropped while the client caught up.**\n`workspace_changed` and `core_notification` are broadcast by separate\ntasks, so a notification for the workspace just switched *to* can arrive\nbefore the switch announcing it — and a strict handle check dropped an\nalert the core had already verified. The payload now carries the\nrevision the gate checked against, which separates "this receiver is\nbehind, catch up and accept" from the stale case the check exists for.\n\n**A resolver could refill the cache from the old marker.** Invalidating\nonly before a marker write leaves a window in which a racing resolver\nreads the pre-write marker and repopulates the cache with the workspace\nbeing switched away from. Every marker mutation now invalidates after a\nsuccessful write as well as before.\n\nTwo more from the same review:\n\n- Pending-session revalidation writes `active_user.toml` and reloads\n through `load_from_default_paths`, which bypasses the runtime resolver\n and so never republished — the switch went unannounced until an\n unrelated later config load. The call site now resolves once through\n the authoritative path. Publishing from `load_from_default_paths`\n itself would be wrong: it ignores `OPENHUMAN_WORKSPACE`, so under that\n override it does not know the runtime answer.\n- The notification service kept its handle across teardown. The core\n seeds a client when its *socket* connects, not when the service\n starts, so stop → switch → restart over one live socket resumed\n holding the pre-switch handle and dropped everything for the workspace\n the user was now in.\n
Shanu committed 3 months ago
9fdbf45
feat(observability): scope the Event Log and core notifications to a workspace\n\nOne process serves every workspace it has opened — `mcp::host`'s `HOSTS`\nis insert-only, so a switch leaves the previous one running and\nsupervised — but the `/events/domain` envelope carried no workspace at\nall. A row left over from a workspace the user had switched away from\nwas indistinguishable from one belonging to the workspace they were in,\nand the log said "MCP server parked" with no way to tell whose.\n\nEach row now carries the opaque handle of the workspace it belongs to\nplus the handle that was active when it was emitted, and the panel keeps\nthe newest of the latter as current. That is what makes a switch visible\non a connection that stays open: the next row after one says a different\nworkspace is current, and the previous workspace's rows leave the\ndefault view. The panel defaults to the active workspace and switches to\nall, and since the NDJSON download exports exactly the rendered rows, it\nis scoped by the same control. Handles throughout, never `workspace_dir`\n— the log renders in a settings panel and downloads to a file, and the\npath is under the user's home directory.\n\nCore notifications carry the handle too. The publish-time gate already\nrefuses to broadcast from a switched-away workspace, but it resolves the\nactive workspace and then sends: two steps, so a switch in between can\nstill let one through, and `core_notification` reaches every connected\nclient with no per-client routing behind it. Carrying the identity turns\na boolean taken at an instant into something the receiver re-checks\nwhenever it renders. The client learns which workspace is current from\n`workspace_changed`, emitted on every switch and to each client as it\nconnects, so a client that joins between switches is not left blind.\n\nClient-side routing fails open where the core's gate fails closed, and\ndeliberately: the core decides whether to send, this is a second check on\nsomething already sent past that gate. A payload with no handle is not\nworkspace-bound and applies wherever it lands, and an unknown active\nworkspace must not drop everything for the rest of the session.\n\n`workspace_of` now delegates to `DomainEvent::workspace_dir` rather than\nkeeping its own MCP-only list.\n\nCloses #5966\n
Shanu committed 3 months ago
161ef3c