Skip to content

fix(codex): pass instructions and input through unchanged - #157

Merged
rexdotsh merged 1 commit into
mainfrom
fix/codex-instructions-passthrough
Oct 22, 2026
Merged

rexdotsh merged 1 commit into
mainfrom
fix/codex-instructions-passthrough

Conversation

@rexdotsh

@rexdotsh rexdotsh commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Kleis trimmed instructions, moved a leading system/developer message into instructions, or injected the bundled codex-default-instructions.txt. This PR passes instructions and input through untouched: no trimming and no promotion.

For compatibility, the bundled default instructions are still injected, but only when a request has no instruction context at all: no non-empty top-level instructions and no system/developer message anywhere in input. A client sending {model, input:[{role:"user",content:"hi"}]} still gets the defaults.

The backend accepts requests without top-level instructions. Two official clients send them that way:

  • Codex: ResponsesApiRequest (codex-api/src/common.rs#L279-L304) has no instructions field, and no other part of that file has one either. Base instructions go into input as a developer message (client.rs#L1031-L1041). Codex sends this to the same chatgpt.com/backend-api/codex/responses backend when signed in with ChatGPT.
  • OpenCode: sends instructions only when there is a system prompt (open-responses.ts#L762-L771).

Rebased onto main (564fc73): now one commit. Since system/developer messages stay in input, the prompt-cache conversation key (#164) now also includes those items, so sibling agents with different developer instructions stay separate.

@rexdotsh
rexdotsh added this pull request to stack #161 October 21, 2026 14:43
@rexdotsh
rexdotsh force-pushed the fix/codex-instructions-passthrough branch from 94b47b3 to 2354c4d Compare October 21, 2026 15:02
@rexdotsh
rexdotsh removed this pull request from stack #161 October 21, 2026 18:57
@rexdotsh
rexdotsh changed the base branch from fix/codex-zstd-bodies to main October 21, 2026 18:57
@rexdotsh
rexdotsh force-pushed the fix/codex-instructions-passthrough branch from 2354c4d to ce8e18f Compare October 22, 2026 07:33
Defaults are injected only when a request has no instructions and no
system/developer input. Prompt-cache keys include system/developer input
items now that they stay in input.
@rexdotsh
rexdotsh force-pushed the fix/codex-instructions-passthrough branch from ce8e18f to ee61bde Compare October 22, 2026 11:34
@rexdotsh
rexdotsh merged commit 601577e into main Oct 22, 2026
5 checks passed
@rexdotsh
rexdotsh deleted the fix/codex-instructions-passthrough branch October 22, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant