Repository navigation
Description
What happened
On dev@b5b7dead1, a codeaf window that is already open while pairing happens in another terminal shows no sync storage off line on its first /status, for an account whose storage is off on a relay at a non-hosted address. The second /status, or any /status about a minute later, does show it.
No saved storage answer exists yet: /status answers at once from the last reading and only then asks the relay. The window's own once-a-minute check of the setup writes the answer within a minute. The three hosted addresses are not affected, because they read as off until the relay answers.
Replication
Deterministic (no model).
Setup used by the replications below (no provider key, no real home):
make build # bin/codeaf
go build -o /tmp/o/modelstub ./test/remote/stub
/tmp/o/modelstub -addr 127.0.0.1:8804 & # keyless scripted model; `PROBE-ECHO <text>` gets a reply
(cd relay/hosted && npm ci && npx wrangler dev --local --ip 127.0.0.1 --port 8803 --persist-to /tmp/o/relay-state) &
# every codeaf command below runs with:
export HOME=/tmp/o/a CODEAF_HOME=/tmp/o/a # or /tmp/o/b for the second computer
export CODEAF_SYNC_URL=http://127.0.0.1:8803 CODEAF_TELEMETRY=off DO_NOT_TRACK=1 CODEAF_NO_UPDATE_CHECK=1
export OPENROUTER_API_KEY=stub CODEAF_BASE_URL=http://127.0.0.1:8804/api/v1Pair the two homes: codeaf pair with home b, then codeaf pair approve <token> with home a. Storage is off for the new account by default.
- With home a, open
codeaf chat --model stub/scriptedbefore pairing. - In another terminal, pair a and b.
- Within a few seconds, type
/statusin a's window. There is nosync storageline. Press it again, andsync storage offappears.
Where
runStatusCommand and refreshSyncSpace in internal/tui3/syncspace.go; the storage answer kept beside sync-url (internal/syncsetup/storage.go); the pairing commands in cmd/codeaf (search pair approve).
The fix
A successful pairing, in any process, asks the relay once for this account's storage state and saves the answer where every window reads it. An already-open window's next /status shows the line straight away. A relay that reports no storage state saves nothing, and a failed ask changes nothing.
Acceptance
- e2e: pair through the real pairing code against a localhost relay that reports storage; a window that was already open shows
sync storage offon its first/status. - e2e: control: a relay that reports no storage state (the self-hosted
codeaf relay) saves nothing and shows no line.
Activity
Run pairing's storage ask under guard
Follow-ups to hosted storage opt-in: tools stop when a chat moves, cl…