e4e9eb0928becfa4e48484dde85ef5032671d582
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3dbbb173ed |
gateway: spawn_agent names every model for a Codex an app-server host runs under its own name
@m0eaki on X (magpie 0.1.4159, Codex 0.169.0 through LobeHub's
app-server, /v1/responses): the lead saw only Codex's first five of a
local catalog of 13. `codex app-server` makes the host's
clientInfo.name its originator and the head of its User-Agent (codex-rs
initialize_processor.rs, set_default_originator), so LobeHub's turns say
"lobehub-desktop/0.169.0 (…) (lobehub-desktop; …)", and the gate before
spawnAgentModels took only Codex's own names (fromCodex) or the codex
token.
The class: any host may name Codex's turns after itself (Zed, LobeHub,
other IDEs). Every Responses turn Codex sends, to any provider, carries
x-codex-window-id (and x-codex-turn-metadata): core/src/
responses_metadata.rs compatibility_headers. codexRuns takes those as
Codex's too, beside fromCodex and the codex token, for spawnAgentModels
alone. spawnAgentModels still widens only a body with Codex's own
spawn_agent signature or <model_catalog>, and its added text is the
same neutral line (nothing naming magpie or Codex). spawnChoices at /v1
reads the codex catalog and the key's list, not agentOf, so a host's
lead gets the catalog magpie wrote for Codex. codexForClaudeCode reads
the same headers through codexTurnHeaders now.
codexTiered stays on the old gate (split out of the same if).
Gates that send a request upstream as Codex's own, to a relay that
checks it (codexAsSent, codexNamed's header forwarding, keepTurnAsks),
stay on Codex's own names. The other gates on fromCodex (subagent pick,
resume and follow, hookKind, codexOwnOffMagpie, codexTiered, the events
only Codex reads) are left as they are, filed as #6653.
Test: TestSpawnAgentNamesEveryModelForAnAppServerHost posts at
/v1/responses with the headers Codex 0.169.0 sends under LobeHub
(User-Agent lobehub-desktop/0.169.0 (Mac OS 26.5.0; arm64) unknown
(lobehub-desktop; 2.1.40), originator lobehub-desktop, x-codex-window-id),
a lead on magpie's model, in four shapes (tools, V2 additional_tools,
model_catalog_in_context, tool search; the real 0.162.0 and 0.169.0
fixtures), and checks that the same app name without Codex's turn
headers is left as sent.
Run (on mica, mote's load was 100):
- Broken by hand: the old gate back in place, the four LobeHub
subtests go red, the four without-headers ones pass. Restored, green.
- gofmt -l clean; go vet ./internal/gateway, GOOS=windows and GOOS=linux
go vet ./internal/gateway: clean.
- go test ./internal/gateway -run SpawnAgent -count=1: ok.
- go test ./... -count=1 -timeout 45m at base
|
||
|
|
683265e867 |
gateway: spawn_agent names every model in Codex 0.169's Lite and catalog requests
@m0eaki on X (Codex 0.169): spawn_agent listed only Codex's first five models, though a remote magpie's model could be spawned by its full slug. In Codex 0.169 a lead on one of OpenAI's own models (the Codex App's default) sends Lite requests (use_responses_lite), with no top-level tools: in multi-agent V2 spawn_agent sits in an additional_tools input item, and with features.model_catalog_in_context the models are in a <model_catalog> developer message, spawn_agent pointing there. magpie widened only tools and tool_search_output, so neither was reached. spawnAgentModels now widens additional_tools like a tool_search_output, and adds the rest of the catalog to a <model_catalog> listing ahead of its closing tag, under the same neutral spawnMore line (no magpie, Codex or count named). The listing is found escaped too (<model_catalog>): on CodexPath a followed or moved subagent's body goes through withModel, whose encoder escapes angle brackets, before spawnAgentModels sees it. Fixtures are real Codex 0.169.0 captures (second request of a turn, sandbox CODEX_HOME, gpt-5.6-luna): V2 Lite, model_catalog_in_context, Lite with a tool search, and a plain tool search. TestSpawnAgentNamesEveryModelInCodex0169 posts each at CodexPath with a lead on OpenAI's model, and calls spawnAgentModels with a lead on magpie's at CodexPath and /v1, the body as Codex wrote it and as withModel writes it again. Sibling left alone, filed: #6639 (a Lite request reshaped for a provider that takes neither Lite's items nor a tool search drops the tools its lead searched for). Run: - Old codex_spawn_models.go: V2 and model_catalog red on all 5 routes each (10 subtests); the two tool-search shapes passed before too. - Broken by hand: hasSpawnCatalog matching only the raw form: the three escaped-body model_catalog subtests go red. Restored, green. - gofmt -l clean. go vet ./internal/gateway and GOOS=windows go vet ./internal/gateway (./... needs Wails' cgo, which the VM lacks), and go test ./internal/gateway -count=1 -timeout 45m: vet clean, gateway ok (861s), at base |