Add experimental turn additional context#24154
Open
pakrym-oai wants to merge 18 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5bc43bd551
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…text # Conflicts: # codex-rs/core/src/tasks/mod.rs
This was referenced May 23, 2026
dylan-hurd-oai
approved these changes
May 24, 2026
This was referenced May 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds experimental
additionalContextsupport toturn/startandturn/steerso clients can provide ephemeral external context, such as browser or automation state, without turning that plumbing into a visible user prompt or triggering user-prompt lifecycle behavior.API Shape
The shape for the parameter is:
Example:
{ "additionalContext": { "browser_info": { "value": "Active tab is CI failures.", "isUntrusted": true }, "automation_info": { "value": "CI rerun is in progress." } } }The keys are opaque and caller-defined.
isUntrusteddefaults tofalse.Context Injection
When the parameter is provided, each accepted entry is inserted into model context as a hidden contextual message item, not as a visible thread user-message item.
Untrusted entries are inserted with role
user:Trusted entries are inserted with role
developer:Values are not escaped. Each value is truncated to 1k approximate tokens before wrapping.
For
turn/start, accepted additional context is inserted before the normal user input. Forturn/steer, additional context is merged only when the steer includes non-empty user input; context-only steers still reject as empty input.Dedupe Strategy
AdditionalContextStorelives on session state and stores the latest complete additional-context map.Each
turn/startor non-emptyturn/steertreats itsadditionalContextas the current complete set of values. Entries are injected only when the key is new or the exact entry for that key changed, includingvalueorisUntrusted. After merging, the store is replaced with the provided map, so omitted keys are removed from the retained set and can be injected again later if reintroduced.Omitting
additionalContext, passingnull, or passing an empty object resets the store to empty and injects nothing.What Changed
additionalContextthrough app-server into core turn start and steer handling.TurnInputdirectly so additional context can be combined with normal user input without treating it as prompt text.