echo_ts (Discord) switched a Codex conversation from Muse Spark (OpenCode)
to gpt-6.1 on GitHub Copilot and every turn failed:
Copilot: Invalid 'input[1].id': 'rs_6aca2fc7533c979d5f0e4f7a:rs_01a125caa544754e9a3c70080100b009'.
Expected an ID that contains letters, numbers, underscores, or dashes,
but this value contained additional characters.
Cause: magpie does not build that id. Muse's upstream hands Codex reasoning
items whose id is two ids joined with a colon; Codex sends every earlier
item back on each turn, and magpie relayed them to the new upstream as they
were. OpenAI checks every input item id against [A-Za-z0-9_-], and Copilot
(and the ChatGPT backend, Azure, relays in front of OpenAI) pass that 400 on.
The existing foreign-seal retry did not fire, because the refusal is about
the id, not the encrypted_content.
Fix (plainItemIDs, codex_backend.go):
- reasoning whose id has another character is dropped: an upstream that
checks ids never minted it, so its encrypted_content is another vendor's,
which it couldn't read either;
- any other item (message, function_call, custom/tool_search call) keeps
its content, its id with each other character as "_"; call_id is not
touched, so outputs stay paired.
Applied up front to OpenAI's API, Azure, the ChatGPT backend (Codex
sign-in path and Codex's own models' passthrough) and Copilot; any other
Responses upstream that refuses with OpenAI's id message is asked once more
with plain ids and remembered (itemIDsRefused, per model). OpenCode itself
still gets Muse's items byte for byte, so Muse can read its own reasoning.
Siblings checked: translated Chat and Messages upstreams never get item ids
(probe: only call_id goes, as tool_call_id / tool_use id), so they are not
affected by this; tool_use ids on Messages are a separate commit.
Tests (internal/gateway/item_ids_test.go), fixtures built from echo_ts's
literal id and error text:
- TestCopilotTakesAnotherVendorsItemIDs (copilot/gpt-6.1 via /responses)
- TestRelayRefusingItemIDsAskedAgain (unknown relay: 2 asks, then 1)
- TestMuseKeepsItsOwnItemIDs (OpenCode gets them as sent)
- TestCodexOwnModelTakesAnotherVendorsItemIDs (ChatGPT backend passthrough)
Broken by hand: old code -> Copilot/relay/native red with the reporter's
400; no up-front pass -> "asked Copilot 2 times"; no retry -> relay red;
no native pass -> native red; reasoning kept with a rewritten id -> all
three red ("Muse's reasoning sent").
Run: go test -tags nogui ./... (sandbox HOME, pinned caches), gofmt -l,
go vet + GOOS=linux / GOOS=windows go vet -tags nogui ./internal/gateway/.
Not run: a real Muse Spark reply (OpenCode Go refuses this account: the
model trains on request data and the workspace hasn't allowed it), nor a
real Copilot request.