Repository navigation
Closed
Labels
area:remote--host, relay, pairing, enginehost, attachments--host, relay, pairing, enginehost, attachmentsbugSomething the code does that it should notSomething the code does that it should notsev:seriousWrong or missing behaviour a person meets in ordinary useWrong or missing behaviour a person meets in ordinary use
Milestone
Description
What a person meets
Two computers are paired and chats sync between them. The person wants to reach one from the other without ssh, so on the first they run:
codeaf serve
It fails in one of two ways, and neither tells the person what to do:
- With no setting:
no sync address is set up on this machine, so there is nowhere to be reachable from. But sync on this same machine is working, through the hosted relay. - With
CODEAF_RELAY=https://codeaf.agentfield.ai/fabric(the hosted relay):Error: error code: 522, and serve exits.
codeaf chat --at <name> can't work either, because no machine can register.
The person expected that a paired machine running codeaf serve could be reached with codeaf chat --at, with nothing else to set up.
Cause: three gaps
- The relay client drops the relay address's path. In
internal/relay/client.go,upgradesends the request withURL{Path: path}, so the base path is lost. A relay athttps://codeaf.agentfield.ai/fabricis called athttps://codeaf.agentfield.ai/v1/engine, which has no route; Cloudflare answers 522. Store, directory, watch and pairing all build their addresses withwireauth.Endpoint, which keeps the base path, so they work and this doesn't. - The hosted relay has no engine routes.
/fabric/v1/engineand/fabric/v1/dial/<name>answer404 {"err":"not_found"}.relay/hosted/src/front.jsroutes store, dir, identity, link and pair. Only the self-hostedcodeaf relayserves/v1/engine. Fixing gap 1 alone turns the 522 into a 404. serveand sync find the relay in different ways. Sync usessyncsetup.Resolve(variable, saved pairing relay, hosted default).serveusespair.Relay()(CODEAF_RELAYorv3/remote/relay) and never falls back to the hosted default.syncsetup.Relaysays sync, pairing and the first-run line must not disagree about the relay. Here they do.
The raw error code: 522 is a fourth, smaller problem: a response body from an upstream proxy is printed as if it were codeaf's own sentence.
Acceptance (end to end, on the hosted relay, no settings changed)
- Serve works out of the box. On a machine whose chats already sync,
codeaf servewith no flags or variables registers through the same relay sync uses. It prints the machine's name and a pairing code, and keeps running. - Connecting with
--atworks. From a second paired computer,codeaf chat --at <name>opens a conversation that runs on the first machine. A message sent there gets a reply, and a tool call in it runs on the first machine. - A project path works.
codeaf chat --at <name>:path/to/projectworks in that folder on the first machine. - Serve survives a dropped connection. If the network drops while serve is running, it says "lost sync — trying again" and becomes reachable again once the network is back, without being restarted.
- The relay address's path is kept. A relay address with a path (
https://host/fabric) is called athttps://host/fabric/v1/engineand…/v1/dial/<name>, as every other client does. A test pins this for a base with a path and one without. - Sync and serve agree on the relay.
codeaf serve,codeaf pairand sync resolve the same address on the same machine. A test covers the variable, the saved pairing relay and the hosted default. - Failures are explained. When the relay is down or doesn't offer this, serve says so in one sentence that names the relay and what to try, never a bare upstream body like
error code: 522. - Self-hosted keeps working. A self-hosted
codeaf relaystill works end to end withserveand--at.
Metadata
Metadata
Assignees
Labels
area:remote--host, relay, pairing, enginehost, attachments--host, relay, pairing, enginehost, attachmentsbugSomething the code does that it should notSomething the code does that it should notsev:seriousWrong or missing behaviour a person meets in ordinary useWrong or missing behaviour a person meets in ordinary use
Activity
santoshkumarradha commentedon Oct 30, 2026
Fixed by #2073 and live on the hosted relay. Checked end to end on the hosted relay with no settings:
codeaf serveregisters and shows its name and code;codeaf chat --at <name>from a second computer pairs, answers, and runs its tool calls on the first machine;--at <name>:<path>works in that folder; after the serving process went silent for two minutes it registered again by itself and was reachable without a restart. A relay without machine doors or one that is down is now one sentence naming the relay, nevererror code: 522.