Files
magpie/internal
yetone 593ea437d8 gateway: a Codex conversation's prefix is sent the same on every request
@m0eaki on X: LobeHub's Codex 0.169 on magpie, the prompt cache holding
only through the base instructions, the skills_instructions message
differing from turn to turn. Codex 0.169 puts its skills, permissions,
deferred tools and <model_catalog> in one developer message, and magpie
writes that message again when it widens the catalog with the models a
subagent may be put on (spawnAgentModels), so it is the one place magpie
could change it.

TestCodexPrefixSameOnEveryRequest posts Codex 0.169.0's request with
LobeHub's app-server headers through the whole handler: a turn's request
twice, the next turn, after a restart and 20 times over on fresh servers,
with two providers and a routing group in the catalog, and checks every
input item up to the new ones is the same bytes upstream. It passes:
magpie's widening is already stable, and magpie never writes or reorders
<skills_instructions> itself. Nothing in magpie is changed.

What does vary is Codex's own: run in a sandbox CODEX_HOME
(workspace-write), Codex 0.169.0 writes the working folder into the same
message's writable roots, so a host that starts turns in different
folders changes it. Codex's skills block itself was the same bytes across
fresh processes (0.165.0, 0.169.0).

Broken by hand: shuffling spawnChoices' list turns the test red at "the
same request again: input[1] differs".

Run (mica, mica-run):
- go test -count=1 -timeout 45m ./... at 3869aee3b with this commit: 99
  packages ok, 5 red, none in code this commit touches:
  - internal/agent TestWSLAgentFolderIsALink (#7150)
  - internal/dirent watch tests, five of them (#7031)
  - internal/gateway TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes
    (#7117, red on origin/main)
  - internal/gui TestGatewayModeListsNoOwnSessions (#7064)
  - internal/sessions timed out at 45m (2700.7s), and again run alone
    (2701.5s, TestStatsMidnight at the deadline); noted on #5451
- rebased on origin/main ef997d186: go vet
  ./internal/gateway ok; go test -count=1 -timeout 45m ./internal/gateway
  (1172s): only #7117 red, TestCodexPrefixSameOnEveryRequest and the
  TestSpawnAgent* tests pass.
- rebased again on origin/main ddc78405c (this push's parent, two
  gateway commits on): TestCodexPrefixSameOnEveryRequest and
  TestSpawnAgent* ok.
- gofmt -l over every tracked .go file: clean.

Not tried: a real LobeHub conversation through magpie. The reporter's two
captured item-2 texts would show which line changes.
2026-11-19 14:21:43 +08:00
..
…
…
…
…
…
…
…
…