You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Self-hosted relay answers 503 to an unauthenticated directory read after a chat is released #2532
On dev@b5b7dead1, the self-hosted relay (codeaf relay) answers 503 to an unauthenticated directory read that arrives right after a chat is released on quit. The read should be refused as unauthenticated, or not sent at all. Three of three quits on the default road showed it; zero of five with --no-host did. Nothing visible goes wrong: the quit is normal and the other computer continues the chat seconds later.
id_f0d15439 POST /v1/dir/cells/{id}/release 204 in=11 out=0
id_f0d15439 GET /v1/dir/watch 101 in=0 out=0
- GET /v1/dir/cells/{id} 503 in=0 out=22
The caller is - (no identity resolved), and 22 bytes is {"err":"unreachable"} plus a newline. The hosted relay answers the same read with 200.
Replication
Deterministic (no model).
make build
go build -o /tmp/o/modelstub ./test/remote/stub && /tmp/o/modelstub -addr 127.0.0.1:8804 &
bin/codeaf relay --listen 127.0.0.1:8805 --store /tmp/o/store &
With HOME, CODEAF_HOME and CODEAF_SYNC_URL=http://127.0.0.1:8805 for each of two homes, pair them.
With one home (OPENROUTER_API_KEY=stub CODEAF_BASE_URL=http://127.0.0.1:8804/api/v1), run bin/codeaf chat --model stub/scripted --one-model (no --no-host) in an empty folder.
Send PROBE-ECHO one, then /quit.
The relay log shows the three lines above.
Where
The Go relay's directory handlers: internal/relayserve/native.go (the activate/authority error wrapping that becomes wireauth.ErrUnavailable) and internal/directory/wire.go (where that becomes 503). The caller is something on the engine road that reads the chat after release while shutting down; search the drive close and the directory feed follower in internal/syncsetup.
The fix
The relay: answers a request it cannot authenticate with an authentication refusal, never with unreachable, which tells clients to retry.
The client: sends no unauthenticated read after release, or sends it with its credentials before it lets go.
Acceptance
e2e: the replication above logs no 503 at quit.
Unit: the Go relay's directory read without a valid identity answers 401, not 503, and a real outage still answers 503.
Activity
Prove a closing chat ignores real directory news
Follow-ups to hosted storage opt-in: tools stop when a chat moves, cl…