fleet-skip-ha-ingress-scan
No handoff yet. An agent working here writes one with amadan branch handoff, so that whoever picks the branch up next — a person, or another agent on another machine — can start without reading the whole history.
Recently
<task-notification> <task-id>b4tuor2zg</task-id> <tool-use-id>toolu_01PEhTNxUyeKSj3SZDVxDMyD</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/77ff03ea-6aeb-44b5-b747-4a18807e01b7/tasks/b4tuor2zg.output</output-file> <status>completed</status> <summary>Background command "until s=$(amadan ci status carlos/platform -branch fleet-skip-ha-ingress-scan -json 2>/dev/null | python3 -c 'import json,sys;d=json.load(sys.stdin);print(d["short"],d["state"])'); [ -n "$s" ] && ! echo "$s" | grep -q 'running\|pending\|queued'; do sleep 30; done; echo "$s"" completed (exit code 0)</summary> </task-notification>
<task-notification> <task-id>ab8721d31b7d9d135</task-id> <tool-use-id>toolu_01XUEcMUiEMYVpXamhgv1Q9h</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/77ff03ea-6aeb-44b5-b747-4a18807e01b7/tasks/ab8721d31b7d9d135.output</output-file> <status>completed</status> <summary>Agent "Scope moved-record 404 fix" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Make the change on the box side. A request that reached the box over the hub's tunnel already carries a mark nobody outside can set, so the box can tell it apart from a stranger's request without trusting any header. It's the same rule the stale-hop 503 already follows. I only read the code; nothing was built or run. ## 1. Hub-side forward path - **Choosing the proxy:** at `internal/edge/edge.go:1141-1149`, `case ArmForward` calls `fleetBoxOf(t)` (`edge.go:4389`). That returns `FleetLabel` (authoritative, no fallback to another box) or else `FleetBox` (other boxes allowed). It then builds `fleetProxy(served.Fleet, box, authoritative, e.tunnels)` and already sets `p.ModifyResponse = classifyMoveStreams(e.responseModifier(t))`. Replica rows use the same proxy at `edge.go:1230`. Whether a row is eligible is decided in `internal/edge/fleetforward.go` (`FleetServeEligible`:65, `DispatchArm`:217, `HubArmed`:17). - **Sending:** `fleetProxy` is at `edge.go:4406-4467`. `fleetChannelFor` (`edge.go:4364`) picks the channel on every request, and `hub.replicaRoundTrip` sends it. `tunnelRewrite` (`edge.go:5497`) keeps the Host and removes the tunnel and purge headers (`scrubTunnelMarkers`:4328). - **No header names the target:** the hub adds no header naming the target box or record. - **`markedRequest` is unrelated:** it is the `carlos_hold=1` held-stream mark (`edge.go:3224`, set at 2295), not a forwarding mark. The 404 branch at `edge.go:2747-2756` only runs for door callers (`isDoor && !doorOwnsRoute`), so tunnelled requests never reach it. - **How the box recognises a hub request:** `tunnelclient.Mark` (`internal/tunnelclient/tunnelclient.go:362`) puts a key in the request context, and `FromTunnel` (:350) reads it. The edge uses it as `fromTunnel` (`internal/edge/geoipheaders.go:25`). `Loop` applies the mark to every request it serves over the channel, and nothing a client sends can set it. The same `tunnelclient.Loop` also runs for link channels (`internal/host/link_client.go:302`). `linkedRequest(ctx)` (`edge.go:2077`) tells those apart. ## 2. Mapping the 404 on the hub - **The hub does see the response:** the Transport returns `resp`, and `ModifyResponse` is already wired (`edge.go:1144`). - **But it can't safely tell which 404 it is.** The box's `unknownHost` (`edge.go:3769`) writes a plain `http.Error(..., 404)` with no `X-Carlos-Answer` header. That looks exactly like the app's own 404. Depending on the box's settings, `unknownHost` may also answer with the 302 fallback redirect or the pending 503. Matching on the body text "unknown host" would be fragile. - **Existing 503 helper:** `Unavailable(w, site, body, retryAfter)` in `internal/edge/unavailable.go:52`. `TestEvery503GoesThroughUnavailable` (`unavailable_guard_test.go:387`) requires every 503 to go through it, with a site name unique to each call site. Retry-After values in use: - **2 s:** dark fleet, `Unavailable(w, "fleet-unreachable", ..., 2)` at `edge.go:4457`. Stale hop, `Unavailable(w, "stale-hop", "not served here", 2)` at `homemap.go:1621`. `errNoLiveUpstream` is also 2 (`edge.go:4037`). - **5 s:** pending page (`pendingRetryAfter = 5`, `pending.go:61`) and tunnel busy. - **10 s:** HA forward (`forwardha.go`). ## 3. Box side knowing the request came from the hub Yes: `fromTunnel(r.Context())`. The hub only sends a request down a fleet tunnel after its own lookup matched a row for that host (forward, fleet or replica). So every tunnelled request names a host the hub has a row for. A stranger can't get the mark and still gets the unchanged `unknownHost` answer, so nothing new is revealed. There is an exact precedent. `staleHopRefusal` (`homemap.go:1585-1621`) answers a verified hop for a host this box doesn't serve with 503 + Retry-After: 2. A stranger asking for the same host gets the normal `unknownHost` answer. Its doc comment states the "can't tell hosts apart" reasoning. The 404 the witness saw almost certainly comes from `edge.go:2568`, the `!ok` branch after `serveAssetFar`/`backhaul` miss. The `hopped` precedent is at 2532-2541. The other `unknownHost` calls (2314, 2510, 2552, 2755, 3856) are for door callers or the port-80 handler and don't apply. ## 4. Recommendation **Box side, about 6-10 lines plus a comment, in `edge.go`'s `!ok` branch just before line 2568:** ```go if fromTunnel(r.Context()) && !linkedRequest(r.Context()) { // the hub forwarded it, so it holds a row naming this box: not minted yet Unavailable(w, "fleet-unrouted", "not served here yet", 2) return } ``` - Retry-After 2 matches `fleet-unreachable` and `stale-hop`. Use 5 if you'd rather match the pending page. - Placed after `serveAssetFar`/`backhaul`, today's behaviour is otherwise unchanged. - Adding `Cache-Control: no-store` would be reasonable. - Add an `e.logThrottled("fleet-unrouted "+host, ...)` line, the way `staleHopRefusal` logs, so a lasting mismatch shows up in this box's journal. - Dropping the `!linkedRequest` check is also harmless: a 503 reveals less than a 404. **Tests to extend:** - `internal/edge/homemap_test.go:647` (`TestUnknownHostWithNoHomeIsStillThe404`) or `pending_test.go:88` (`TestUnknownHostOutsidePlatformDomainsIsUnchanged`): add a twin that wraps the edge in `tunnelclient.Mark(e)`, as `guard_test.go:277` does. Assert 503, `Retry-After: 2`, `X-Carlos-Answer: fleet-unrouted`, and that the same request without the mark still gets 404 with no Retry-After. - `TestEvery503GoesThroughUnavailable` passes automatically as long as the site name is new. - `forwardha_test.go:1037` shows how to stub the `fromTunnel` variable instead. **Risks:** - **A stale hub row gives a permanent 503 instead of a 404.** This already happens today for a labelled forward row whose box is dark (`errFleetDark`, also a permanent 503 until the console relabels, `edge.go:4360-4362`). The extra exposure is limited to hosts the hub actually routes, and the throttled log makes it visible to an operator. I think that's acceptable. - **Requests for rows with no `FleetLabel` can land on any connected box of the fleet** (`fleetChannelFor` rule 2). A box without the route now answers 503 there instead of 404. That's the better answer in that case too. - **Changing the hub side instead** would need the box to label its 404 anyway, so it would be a larger change across both sides.</result> <usage><subagent_tokens>62055</subagent_tokens><tool_uses>14</tool_uses><duration_ms>121314</duration_ms></usage> </task-notification>
<paseo-system version="1" kind="agent-message" source-agent-id="8a3d302a-eac7-407c-b61c-f5ccc66b5544" message-id="a872e8f8-ab97-4635-82ed-d7c4b786b11c"> Agent manager 8a3d302: thanks, solid work. Yes to the DBForward listener diagnostic (test-only, about 40 lines) after #964 (a); merge on green, then park DBForward until the next failure. </paseo-system>
<task-notification> <task-id>bcq0vzl25</task-id> <tool-use-id>toolu_01NJt2Tm9m9g1ztkQFw85ekk</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/827c02f3-27d0-4c98-a90c-8a82a4cf9e05/tasks/bcq0vzl25.output</output-file> <status>completed</status> <summary>Background command "Run Astra review of #964 (a)" completed (exit code 0)</summary> </task-notification>