The Routing page's "Request and response" finds a request's call by its
route (RouteCall). Of codexUpstreamOn's three record exits only the
success one set Call.Route, so a turn whose API key OpenAI refused (401)
or that the backend failed with nothing said opened as "the request is
gone" though its call was one of the last 40. Both failure exits now
carry the route through routeOf, which is 0 for a compaction: both exits
are reached by /responses/compact too, where no route opens.
Reported with a patch by ggbdpq (gua2100 on Discord). The patch set
Route: tr.ID unguarded on the empty-failure exit; since the
outrageous_piglet change that exit also takes a compaction, where tr is
nil, so that line panics on a compaction failed with an empty body.
routeOf guards both exits. gui-shell.md says which Codex exits carry
the route.
Run (sandbox HOME, caches pinned):
- TestCodexKeyRefusedCarriesItsRoute, TestCodexEmptyFailureCarriesItsRoute
(ggbdpq's, the asserts moved into routeHasItsCall) and the new
TestCodexCompactEmptyFailureRecordsNoRoute: ok.
- Broken by hand: with both exits back to no Route, the first two fail
"route N: no call in the ring, so Request and response says the
request is gone"; with the patch's unguarded tr.ID on the empty exit,
the compaction test panics (nil pointer dereference). Restored: ok.
- go test -tags nogui -run 'TestCodex|TestRouting|TestArchive|TestRouteCall'
./internal/gateway: ok (31s).
- gofmt -l clean; go vet darwin, GOOS=windows, GOOS=linux -tags nogui on
./internal/gateway: clean.
Not tried: a real OpenAI 401 or a real empty ChatGPT backend failure
(fake upstreams); the GUI's routing-bodies test (the GUI is unchanged);
the full ./... suite (one suite per machine, others running).
Co-authored-by: ggbdpq <ggbdpq@gmail.com>