fix(auth-sync): push bundles into the worker's agents root, and let a Cursor slot launch find its binary and lease (PHNX-3940) - #3553
Conversation
… Cursor slot launch find its binary and lease (PHNX-3940) Two seams closed after 1.22.90 delivered the __cursor__ push: 1. The remote half of every bundle push ran the receiving `secrets` under its default ~/.secrets while the worker daemon reads ~/.agents (MIG-1 on both ends). zion logged "pushed __cursor__ (1 key(s)) to yosemite-m0"; the worker kept answering "no readable durable key on this box yet" — the bundle sat in ~/.secrets, keyed by a different machine-local passphrase. The one client wrapper every push uses now names the remote root (withRemoteStateRoot, REMOTE_USER_AGENTS_DIR = '~/.agents'); secrets-cli 0.1.2 applies it to the import, the read-back verify and literal restoration (remoteSecretsHome). 2. With the key in place, `agents run cursor#gmail` on the worker still failed: the slot launch hands the direct alias HOME=<slot dir> (real home in AGENTS_REAL_HOME) and the alias anchored its binary on $HOME, so cursor-agent@main said "cursor@main not installed"; under a plain HOME, cursor's own HOME swap ran before the launch lease, and `agents __launch-lease` (state root $HOME/.agents) failed with "No installation directory for cursor@main". The versioned alias (schema 20) now anchors every agents-owned path on AGENTS_REAL_HOME, takes the lease under the real home before any harness HOME swap, and cursor swaps HOME only when the spawner has not already chosen one. Test pin STANDALONE_SECRETS_VERSION -> 0.1.2. Docs + CHANGELOG. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014qq5fiWVRBmBV9f5KR58dY
…nd scope the bare dispatcher shim out explicitly Review notes on #3553: 'regenerated on next sync' was wrong — only the daemon self-heal tick (6 h) or agents doctor --fix / agents view rewrite an alias; and generateShimScript keeps the $HOME anchor, which is off the slot-launch path. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014qq5fiWVRBmBV9f5KR58dY
|
VERDICT: APPROVE Non-author review (code-reviewer subagent). Verified by execution and tracing, not just the diff: the generated alias bash under a non-slot env (lease under the real home, then the cursor HOME swap) and a slot env (lease under the real home, HOME stays the slot for exec, Two should-fix notes, addressed in e0cf53d: the CHANGELOG said the schema-20 alias regenerates 'on next sync' — it is the daemon self-heal tick (6 h) or Checks: |
…and schema 20 CI on #3553: src/lib/__tests__/shims.test.ts and tests/shims.test.ts still pinned the $HOME anchors and VERSIONED_ALIAS_SCHEMA_VERSION 19. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014qq5fiWVRBmBV9f5KR58dY
…nd scope the bare dispatcher shim out explicitly Review notes on #3553: 'regenerated on next sync' was wrong — only the daemon self-heal tick (6 h) or agents doctor --fix / agents view rewrite an alias; and generateShimScript keeps the $HOME anchor, which is off the slot-launch path. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014qq5fiWVRBmBV9f5KR58dY
Problem
Follow-up to #3551 (merged, released as 1.22.90). Two more seams stopped a worker from running
cursor#gmail, both found while proving that release end-to-end on yosemite-m0.1. The push lands in the wrong root on the worker. agents-cli runs its local
secretsunderSECRETS_HOME=~/.agents(MIG-1), and the worker daemon reads pushed bundles from that root. The remote half of every bundle push ran the receivingsecretswith no env prologue, so it used its own default~/.secrets:The file store is keyed per root (
<SECRETS_HOME>/.secrets-key/passphrase), so the two roots cannot share ciphertext either. Every push call site (auth-sync,accounts sync,fleet apply, mint) goes through the one client wrapper.2. A Cursor slot launch cannot find its binary or take its lease. The slot launch hands the direct alias
HOME=<slot dir>with the real home inAGENTS_REAL_HOME; the alias anchoredBINARYon$HOME:Under a plain HOME the alias still failed, because cursor's own HOME swap ran before the launch lease and
agents __launch-lease(state root$HOME/.agents) then answeredNo installation directory for cursor@main.Change
secrets-client.ts:withRemoteStateRootfillsremoteSecretsHome: '~/.agents'(REMOTE_USER_AGENTS_DIR) on everypushBundleToHost[Async]unless the caller named a root;PushBundleOptionsgains the field. secrets-cli 0.1.2 (feat(push): remoteSecretsHome pins the remote secrets to the consumer state root on every transport secrets-cli#5) applies it to the import, the read-back verify and literal restoration, with a strict path charset before the value reaches the remote shell.shims.tsdirect alias (schema 20, regenerated on next sync): every agents-owned path anchors onAGENTS_REAL_HOME; the launch lease runsHOME="$AGENTS_REAL_HOME"before any harness HOME swap; cursor swaps HOME only when$HOMEstill equals the real home (a spawner-chosen slot HOME is kept).STANDALONE_SECRETS_VERSION→ 0.1.2; doc and CHANGELOG updated.Verification
tsc --noEmitclean.secrets-client.test.ts(withRemoteStateRoot,buildServeEnv): pass.shims.test.ts: 36/36, including the new Cursor and Claude alias cases (real-home anchor, lease before swap, conditional swap) and the Grok fallback path moved to the real home.~/.agentsmade the daemon provision the slot (auth-sync: provisioned worker slot(s) for 3dbc408e…); the same was applied to the other eight online workers.testjob goes green once 0.1.2 propagates on npm (published, tag on origin).Tracking: PHNX-3940.