hanekoo's Codex Desktop lead on gpt-6.1-sol (Codex's own ChatGPT sign-in)
spawned a subagent on antigravity/gemini-3.8-flash with fork_turns="none"
and got the sealed-task refusal, which read as if the lead's turns were
the problem and fork_turns="none" should have avoided it.
What Codex rust-v0.162.0-alpha.17.2 sends (read from its source, not the
reporter's bytes, which aren't available): spawn.rs's fork_mode is None
for "none", so no turn of the lead's is copied in. The subagent's task is
spawn_agent's `message` argument; the ChatGPT backend returns it sealed
(the function call's encrypted_function_args), router.rs's direct_source
makes it ToolCallSource::Direct, agent_message_from_tool makes it
AgentMessage::Encrypted, and to_model_input_item writes it as the
agent_message's encrypted_content under the NEW_TASK header. So the one
sealed thing in the subagent's first request is the task itself: there is
nothing magpie can leave out and still give the subagent work, and no
request flag in Codex asks the backend for plaintext arguments. The
refusal stays; it now says why.
- codex_backend.go: sealedTaskItself, added to all three sealedTaskError
variants (lead unknown / Codex's own sign-in, a relay that sealed it,
plugins#70's earlier chat provider): what is sealed is the task the
spawning agent wrote in spawn_agent, and fork_turns="none" keeps only
the lead's turns out, not the seal. The existing advice (the lead's
model for the subagent, or a lead not on the ChatGPT backend) stays.
- docs/subsystems/gateway-routing.md: the same, under sealed tasks.
- sealed_fork_none_test.go: the fork_turns="none" first request rebuilt
from Codex's source (developer + environment_context + the sealed
NEW_TASK with Task name/Sender lines), a lead first on Codex's own
sign-in, the subagent on a chat provider. It is refused before the
provider is asked, with no ciphertext in the reply, and says the task
itself is sealed whatever fork_turns says.
Run: with the old codex_backend.go put back,
TestSealedTaskWithForkTurnsNoneSaysTheTaskItselfIsSealed fails ("the
refusal doesn't say the task itself is sealed whatever fork_turns
says"); with the change it passes. gofmt -l (empty), go vet / GOOS=linux
-tags nogui / GOOS=windows go vet ./internal/gateway, go build, GOOS=linux
-tags nogui and GOOS=windows go build ./..., go test -tags nogui
./internal/gateway (ok, 353s) under a sandbox HOME with a private GOCACHE.
Not run: the whole `go test ./...` (only the gateway package changed);
no real Codex Desktop or ChatGPT account was used, so the reporter's
bytes are not reproduced; the GUI's sealedKept text is unchanged. The
502 "context canceled" on gpt-6.1-sol in the report is Codex's own
sign-in request most likely cancelled by Codex itself (the client went away), a separate
request, and wasn't chased.
72 lines
3.9 KiB
Go
72 lines
3.9 KiB
Go
package gateway
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// forkNoneTask is the first request Codex 0.162 (rust-v0.162.0-alpha.17.2)
|
|
// sends for a subagent its lead spawned with fork_turns="none", rebuilt
|
|
// from Codex's source, not the reporter's bytes (#1855 has none):
|
|
// spawn.rs's fork_mode is None for "none", so no turn of the lead's is
|
|
// copied in, and the input is the subagent's own context and its task.
|
|
// The task is spawn_agent's message, which the ChatGPT backend returned
|
|
// sealed (encrypted_function_args), so agent_message_from_tool makes it
|
|
// AgentMessage::Encrypted and to_model_input_item writes it under the
|
|
// NEW_TASK header as encrypted_content.
|
|
const forkNoneTask = `{"model":"ag/gemini-3.8-flash","stream":true,"store":false,"instructions":"You are Codex.","tools":[],"tool_choice":"auto","parallel_tool_calls":true,"include":["reasoning.encrypted_content"],"input":[` +
|
|
`{"type":"message","role":"developer","content":[{"type":"input_text","text":"<permissions instructions>Filesystem sandboxing: workspace-write.</permissions instructions>"}]},` +
|
|
`{"type":"message","role":"user","content":[{"type":"input_text","text":"<environment_context>\n <cwd>/Users/u/proj</cwd>\n <shell>zsh</shell>\n</environment_context>"}]},` +
|
|
`{"type":"agent_message","author":"/root","recipient":"/root/gemini_worker","content":[{"type":"input_text","text":"Message Type: NEW_TASK\nTask name: /root/gemini_worker\nSender: /root\nPayload:\n"},{"type":"encrypted_content","encrypted_content":"gAAAAABo_sealedTaskFromTheLead-Q3x9_aZ=="}]}]}`
|
|
|
|
// #1855 (hanekoo): Codex Desktop's lead on gpt-6.1-sol, Codex's own
|
|
// ChatGPT sign-in, spawns a subagent on ag/gemini-3.8-flash with
|
|
// fork_turns="none". The task is still sealed, since it is the task
|
|
// itself that is, so the subagent is turned away before ag is asked, and
|
|
// told so: fork_turns="none" isn't left looking like it should have helped.
|
|
func TestSealedTaskWithForkTurnsNoneSaysTheTaskItselfIsSealed(t *testing.T) {
|
|
fresh(t)
|
|
chatgpt(t, func(w http.ResponseWriter, r *http.Request) {
|
|
io.ReadAll(r.Body)
|
|
w.Header().Set("Content-Type", "text/event-stream")
|
|
io.WriteString(w, sse(`data: {"type":"response.completed","response":{"id":"r1","status":"completed","output":[]}}`))
|
|
})
|
|
asked := chatOnlyOn(t, "ag")
|
|
s := New()
|
|
if rec := codexSubTurn(s, "gpt-6.1-sol", "lead-1855", "", leadAsk); rec.Code != 200 {
|
|
t.Fatalf("lead on Codex's own sign-in: %d %s", rec.Code, rec.Body.String())
|
|
}
|
|
// chatOnlyOn serves "dfmodel"; the subagent asks for the reporter's model
|
|
body := strings.ReplaceAll(forkNoneTask, "ag/gemini-3.8-flash", "ag/dfmodel")
|
|
req := httptest.NewRequest("POST", CodexPath+"/responses", strings.NewReader(body))
|
|
req.Header.Set("Authorization", "Bearer chatgpt-token")
|
|
req.Header.Set("chatgpt-account-id", "acct-1")
|
|
req.Header.Set("User-Agent", "Codex Desktop/0.162.0-alpha.17.2 (Mac OS 15.7.3; arm64) unknown (Codex Desktop; 26.1007.30912)")
|
|
req.Header.Set("session_id", "worker-1855")
|
|
req.Header.Set("x-codex-parent-thread-id", "lead-1855")
|
|
req.Header.Set("x-openai-subagent", "collab_spawn")
|
|
rec := httptest.NewRecorder()
|
|
s.Handler().ServeHTTP(rec, req)
|
|
var got struct {
|
|
Error struct {
|
|
Message string `json:"message"`
|
|
} `json:"error"`
|
|
}
|
|
json.Unmarshal(rec.Body.Bytes(), &got)
|
|
msg := got.Error.Message
|
|
if rec.Code != 400 || *asked != 0 || strings.Contains(rec.Body.String(), "gAAAAA") {
|
|
t.Fatalf("subagent: %d %s (ag asked %d times)", rec.Code, rec.Body.String(), *asked)
|
|
}
|
|
if !strings.Contains(msg, "sealed by the ChatGPT backend that answered its lead") ||
|
|
!strings.Contains(msg, "What is sealed is the task itself") ||
|
|
!strings.Contains(msg, "spawn_agent") ||
|
|
!strings.Contains(msg, `fork_turns="none" keeps the lead's earlier turns out of the subagent, but not the seal on its task`) ||
|
|
!strings.Contains(msg, "Give the subagent the lead's model") {
|
|
t.Fatalf("the refusal doesn't say the task itself is sealed whatever fork_turns says: %s", msg)
|
|
}
|
|
}
|