Codex's summary ask to a provider that isn't OpenAI's carries its
developer messages as system ones (forVendor, #2955). A plugin provider
fronting a ChatGPT account (magpie-sub2api -> sub2api -> Codex backend)
is such a provider, and the backend behind it takes developer alone:
every compaction came back "System messages are not allowed", the
sessions that got through fell to the conversation-as-text summary,
and the ones whose refusal came as an error event after a 200 skipped
every retry and were held after three (compactFails).
Now a summary refused "System messages are not allowed" (as passed
through, or as a current sub2api words it), or with a relay's bare
"Upstream request failed" (the reporter's sub2api), as a 4xx or as an
error event in the stream (roleRefused), is asked once more with the
roles as Codex sent them (askAsSent turns off the compaction marker,
whose only reader is forVendor's swap), then as text, then made by
magpie. A summary with no developer message to give back is not asked
the same twice. Every route a compaction reaches a Responses provider
by (CodexPath, Codex's own models through magpie's accounts, the mask
route, a CC Switch table) goes through codexCompact and serve's one
forVendor call, so all of them are covered. #2955's chat-only vendors
take system and are unchanged.
Ported from ggbdpq's patch (fix/5067-compaction-system-messages,
79ec15d26), which matched only the passed-through wording on a 400.
The review added the reporter's own "Upstream request failed", the
error-event shape, the developer gate, lazyre for the words, and the
subsystem page.
Run on mote at this change on 6a253f8af; rebased onto fbc1808f2 (then 15acba534, no gateway change) and the targeted
run repeated on Linux (wsl-run, mote refused ssh): ok.
- TestCodexCompactSystemRefusedAsksAgainDeveloper (5 wordings/shapes)
and TestCodexCompactSystemRefusedEverywhereNeverHolds: ok.
- Red on origin/main's product files: all 7 subtests fail (400 to Codex,
502 "so there is no summary", or the text downgrade).
- Red on ggbdpq's patch alone: older sub2api, both in-stream shapes and
the in-stream never-holds case fail.
- Broken by hand: the developer gate dropped -> the existing
TestCodexCompactUpstreamFailed400AsksAgainAsText goes red (3 asks).
- go test -tags nogui ./internal/gateway/: queued behind ~/suite.lock on mote at push time (other sessions' suites); the full suite runs after the tag
- gofmt -l clean; go vet darwin, linux -tags nogui, windows: clean.
Not tried: a real sub2api relay of a ChatGPT account; the fakes answer
sub2api's two wordings (writeOpenAIUpstreamClientError and the older
upstream_error) and the backend's {"detail":...}. After an in-stream
"Upstream request failed" serve itself asks the same account again
(15 asks in the fake), unchanged here. The reporter's other 400
(reasoning effort 'none' on gpt-6.1-sol) is a separate path, not
touched.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>