Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gateway: the Codex app's page state is metadata, not the user's words (#3418)

ggbdpqa463b3ede234
diff --git a/internal/gateway/prompt.go b/internal/gateway/prompt.go
index 50854569c..3a2069fcd 100644
--- a/internal/gateway/prompt.go
+++ b/internal/gateway/prompt.go
@@ -725,6 +725,7 @@ var (
injected = []string{
"<system-reminder", "<environment_context>", "<user_instructions>", "<turn_aborted>",
"<user_shell_command>", "<subagent_notification>", "<in-app-browser-context",
+ "<external_codex_apps_open_page>",
"<task-notification>", "<subagent-notification>", "<plugin_reference>",
"Available agent types for the Agent tool:", "Available agent types and the tools they have access to:",
"New agent types are now available for the Agent tool:",
diff --git a/internal/gateway/user_said_test.go b/internal/gateway/user_said_test.go
index a676e4454..39c4e7ca6 100644
--- a/internal/gateway/user_said_test.go
+++ b/internal/gateway/user_said_test.go
@@ -30,6 +30,9 @@ const (
envContext = "<environment_context>\n <cwd>/Users/me/app</cwd>\n <shell>zsh</shell>\n <current_date>2026-10-12</current_date>\n</environment_context>"
codexAgents = "# AGENTS.md instructions for /Users/me/app\n\n<INSTRUCTIONS>\nRun the tests.\n</INSTRUCTIONS>"
inAppBrowser = "# Context from my IDE setup:\n\n# In app browser:\n<in-app-browser-context source=\"ambient-ui-state\">\nhttps://example.test/ — Example\n</in-app-browser-context>\n\n"
+ codexPage = `<external_codex_apps_open_page>{"page_id":null}</external_codex_apps_open_page>`
+ pastedRequest = "# Files pasted by the user:\n\n## \"Fix a race...\": /tmp/fixture/task.txt\n\n" +
+ "Pasted text contains the user's request.\n\n## My request:\n"
)
func userMsg(texts ...string) Message {
@@ -107,6 +110,9 @@ func TestUserTextSkipsWhatTheAgentPutIn(t *testing.T) {
{"a todo nudge after the turn", []Message{userMsg(q), saidAnswer, userMsg(zcodeTodo)}, q},
{"Codex", []Message{userMsg(codexAgents, envContext, "fix the bug")}, "fix the bug"},
{"the Codex app", []Message{userMsg(inAppBrowser + "## My request for Codex:\nwhat is this page?")}, "what is this page?"},
+ {"the Codex app's page state", []Message{userMsg(codexPage)}, ""},
+ {"page state, pasted files and an empty request", []Message{userMsg(codexPage), userMsg(pastedRequest)}, ""},
+ {"page state beside the request", []Message{userMsg(codexPage, pastedRequest+"fix the race")}, "fix the race"},
{"a reminder with a source", []Message{userMsg(goalContinuation + "\nship it")}, "ship it"},
} {
if got := userText(&Request{Messages: tc.ms}); got != tc.want {
@@ -176,9 +182,24 @@ func TestIntentHoldsPastWhatTheAgentPutIn(t *testing.T) {
}
}
+// The Codex app's page state is not words of the user's: alone, or beside
+// pasted files when "My request" is empty, it asks the classifier nothing
+// (#3418) — there is nothing of the user's to classify.
+func TestIntentSkipsWhatTheCodexAppPutIn(t *testing.T) {
+ s, _, _, c := intented(t, provider.Rule{Use: "b/big", Intent: "complex tasks"})
+ c.set("1", 0)
+ body := `{"model":"group/r","messages":[` +
+ `{"role":"user","content":` + quote(codexPage) + `},` +
+ `{"role":"user","content":` + quote(pastedRequest) + `}]}`
+ _, r := postOK(t, s, "s1", body)
+ if n := c.n(); n != 0 {
+ t.Fatalf("classifier asked %d time(s): %.120q (%+v)", n, c.last(), r.Rule.Classified)
+ }
+}
+
func TestUserSaysPastAReminderWithASource(t *testing.T) {
for _, s := range []string{goalContinuation, taskNotification, pluginRef, agentList, zcodeAgentList, zcodeTodo, envContext, codexAgents,
- "<turn_aborted>\nThe user interrupted.\n</turn_aborted>", inAppBrowser + "## My request:\n"} {
+ "<turn_aborted>\nThe user interrupted.\n</turn_aborted>", inAppBrowser + "## My request:\n", codexPage} {
if userSays(s) {
t.Errorf("said: %.40q", s)
}