Files
magpie/docs
yetone bf4d55acdd gateway: a Codex task sealed by a custom Responses provider still goes back to it after magpie forgets who answered the lead — a day later, after a restart, or after the lead's reply broke off — and the refusal says how to go on (#1367)
Autsunset (#1367): Codex with the lead and its subagents all on
xxxx/gpt-6-astra, a relay of ChatGPT Pro behind new-api. After quota
and overload errors, continuing the task was refused before xxxx was
asked: "This subagent's task was sealed by the ChatGPT backend that
answered its lead ... xxxx/gpt-6-astra is neither."

The cause: who sealed a task (#1109, #1237) was read only from the
affinity stick of the lead's conversation, and that record is lost in
three ways: it is kept 24 hours; a restart reads back only the latest
512 conversations from affinity.json; and a reply that breaks off after
its 200 (response.failed server_is_overloaded) deletes it (unanswered,
#733). Once lost, every later turn carrying a sealed message was
refused before anyone was asked, so nothing could answer the lead
again to remember it: the task stayed stuck.

When the sticks don't make the asked provider a reader, the usage log's
answers to the lead's thread and the request's own conversation in the
last 30 days now count too (loggedAnswers). A refused or failed call,
a title and Codex's own sign-in (Provider "openai" on /backend-api/codex,
still told of as the ChatGPT backend) count for nothing. The sibling
leadFirst, which puts the lead's ChatGPT account first in a group, reads
the lead's key or account from the log the same way. The refusal names
who answered the lead when the log knows, and both messages now say how
to go on: use the lead's model, or have the lead spawn the subagent again.

Verified:
- TestSealedTaskStillGoesToTheLeadsProviderAfterItsReplyBrokeOff and
  TestSealedTaskStillGoesToTheLeadsProviderADayLater (fake Responses
  relay over httptest, Fernet-shaped gAAAAAB... payloads, lead and worker
  on xxxx/gpt-6-astra) fail on origin/main with the reporter's exact
  400 and pass with the change; the sealed payload reaches xxxx as it
  came.
- TestSealedTaskLogDoesNotOpenItToAnotherProvider: a lead answered by
  another provider names it; a lead never answered (refused twice) and
  an answer older than 30 days stay refused. With the 30-day bound
  removed it fails.
- TestSealedTaskGoesToTheLeadsLoggedAccountFirst: with the leadFirst
  fallback removed the group's other account (acct-1) is tried first.
- TestSealedTaskFromChatGPTLeadStillRefused fails if Codex's own
  sign-in is not left out of the log's answerers.
- TestSealedReplyRefusedWhereTheLeadWasNotAnswered now expects the lead
  moved to another provider to be named "(third)".
- go test -tags nogui ./internal/gateway passes (sandbox HOME, pinned
  caches); sealed tests pass under -race -count=5; gofmt -l clean;
  go vet -tags nogui ./internal/gateway for darwin, linux and windows.

Not verified: real Codex with a real CPA/new-api relay of ChatGPT Pro.
If such a relay sends the subagent's request to another ChatGPT account
than the one that sealed the task, that account can't open it either;
magpie can't see or fix that.
2026-10-09 10:34:03 +08:00
..