feat(push): remoteSecretsHome pins the remote secrets to the consumer state root on every transport - #5
Conversation
… state root on every transport agents-cli runs its local standalone under SECRETS_HOME=~/.agents and reads pushed bundles from that root on the receiving box, but every remote invocation of pushBundleToHost (import, read-back verify, literal restoration) ran with no env prologue, so the remote defaulted to ~/.secrets: the import reported success and the consumer daemon never saw the bundle. Observed 2026-09-07: zion logged 'pushed __cursor__ (1 key(s)) to yosemite-m0' while the worker kept answering 'no readable durable key on this box yet'. The file store is keyed per root, so the two roots cannot even share ciphertext. PushBundleOptions.remoteSecretsHome names the root; remoteStateRootEnv turns a leading ~/ into $HOME/ (POSIX) or $env:USERPROFILE\ (PowerShell) in the expanding quote form (SECRETS_HOME joins PATH as an expanding env key), and the env rides buildRemoteFileImportCommand, buildWindowsStdinImportCommand, remoteSecretsRaw[Async] and verifyRemoteKeychainPush[Async]. Unset keeps today's behaviour. Version 0.1.2. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014qq5fiWVRBmBV9f5KR58dY
…_HOME is emitted in the expanding form Review finding on #5: any other value ($(...), a backtick, quotes) would run on the remote as a side effect of setting the env. The gate is the charset — ~/<path>, /<path> or C:/<path> of [A-Za-z0-9._-/] — refused before the value reaches either shell; the stale 'trusted-static' EXPAND_KEYS comment is gone and the metacharacter cases are pinned in tests. 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, two passes). Pass 1 requested changes: Pass 2 verified 6dc76ff: Checks: transport files 118/118, full suite 1015 passed, tsc clean, CI green. |
Problem
agents-cli runs its local standalone under
SECRETS_HOME=~/.agents(MIG-1) and its daemon reads pushed bundles from that root on the receiving box. Every remote invocation ofpushBundleToHost(theimport, the read-back verify, literal restoration) ran with no env prologue, so the remotesecretsused its default root~/.secrets. The import reported success; the consumer never saw the bundle.Observed 2026-09-07 after #4 shipped in 0.1.1: zion logged
auth-sync: pushed __cursor__ (1 key(s)) to yosemite-m0, and on yosemite-m0:The file store is keyed per root (
<SECRETS_HOME>/.secrets-key/passphrase), so the two roots cannot share ciphertext either.Change
PushBundleOptions.remoteSecretsHome: the state root the remote runs under, remote-relative.remoteStateRootEnvmaps a leading~/to$HOME/(POSIX) or$env:USERPROFILE\\(PowerShell); absolute paths pass through; unset keeps today's behaviour.SECRETS_HOMEjoinsPATHas an expanding env key inposixEnvExportsandwindowsSecretsScript, so the remote shell resolves the home.buildRemoteFileImportCommand,buildWindowsStdinImportCommand(newenv),remoteSecretsRaw[Async](newenvoption),verifyRemoteKeychainPush[Async](newenv), and both push bodies use it for import, verify and literal steps.PushTransport'sremote-secretsvariant carriesenv.The companion agents-cli change passes
remoteSecretsHome: '~/.agents'from its one client wrapper.Verification
tsc --noEmitclean.scripts/test.shon ssh, push, push-async, remote: 117 passed (new:remoteStateRootEnvper shell, expanding export on POSIX, double-quoted env line in the PowerShell script and the stdin-import script,planPushTransportwith and without the option on file/keychain/Windows). Full suite result posted in a comment.Tracking: PHNX-3940.