nativeCompactionFor kept Codex's compaction_trigger whenever the
provider asked had native compaction on and could be asked it on
Responses. When the vendor's lists held the model to a key that speaks
no Responses there (a key set to Chat), compactionCarriers then cleared
every candidate and Codex got 400 carrierError, with no upstream asked:
the dead end #2725 reports. The trigger is now kept only when a key or
account the request would go over (the provider's and its fallbacks',
or a group's members', held and capped ones too, not one whose own
list lacks the model) carries it (plannedCarrier). Otherwise
codexCompact gives magpie's summary through the listed key, as with
native compaction off.
Patch by ggbdpq (#2725): route (a) and both tests are theirs. Changed
from it: their planCarries ran s.plan / s.planGroup, which weighs the
keys, and a provider routed in turn moves its turn along there
(routes.Rotate). nativeCompactionFor runs on every Codex turn (handle,
codexBackend), so each decision would have skipped a key. plannedCarrier
reads perKeyBarred without weighing. Doc sentence in
docs/subsystems/gateway-routing.md.
Run (worktree at e54a7d50b):
- TestNativeCompactionTriggerSummarisedWhenNoListedKeyCarriesIt: red
on the old native_compaction.go ("400, the relay asked 0 times ...
none of the keys or accounts that serve fake/m1 now can be asked it
on the Responses"), green now.
TestNativeCompactionTriggerThroughTheListedKeyThatCarriesIt green.
- TestNativeCompactionDecisionLeavesTheTurnsAlone (new, three keys,
Rotate): red with the patch's planCarries ("a turn began at k2, the
next at k1"), green with plannedCarrier.
- -race -count=3 on those three; NativeCompaction|Compact|Checkpoint|
CodexBackend ok; the whole internal/gateway package
(-tags nogui -count=1 -timeout 45m) ok in 609s.
- gofmt -l clean; go vet ./internal/gateway for darwin, GOOS=windows,
GOOS=linux -tags nogui clean.
Not tried: a real relay whose vendor lists a model to a Chat-only key.