Skip to content

Self-hosted relay answers 503 to an unauthenticated directory read after a chat is released #2532

Closed

Description

@AbirAbbas

What happened

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 &
  1. With HOME, CODEAF_HOME and CODEAF_SYNC_URL=http://127.0.0.1:8805 for each of two homes, pair them.
  2. 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.
  3. Send PROBE-ECHO one, then /quit.
  4. 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

  1. added a commit that references this issue on Nov 9, 2026
    35d38c5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions