fix(server): send Codex browser guidance as application context #12739
main fromrefs/pull/12739/head·opened View on GitHubWhat Changed#
Move the existing Codex browser guidance from collaboration-mode instructions into keyed application context. Keep the wording and preview-tool availability gate unchanged.
Why#
Codex can choose bundled Computer Use despite T3’s browser guidance. Presenting that guidance separately improved tool selection without appending it to each user message. This is a workaround, ideally Codex should not assume that no integrated browser is available when the bundled Computer Use plugin is inactive.
Refs #11579.
Validation#
30 fresh-session live-model trials, using five browser tasks, a mock T3 MCP endpoint, and bundled Computer Use:
- T3 tool selection, before → after: Default 0/5 → 5/5; Plan 5/5 → 5/5.
- Actual
preview_statusdispatch: 5/5. - Explicit Safari/Helium/Chrome requests respected: 3/3.
- Preview disabled: alternative browser selected 2/2.
These verify tool selection and dispatch, not rendering. A separate request-capture check found one browser-rule copy across four turns, including a mode change; restarting Codex adds another copy.
All 50 focused runtime tests, targeted lint/format checks, and server typecheck passed.
Checklist#
- Small, focused change
- Explained what changed and why
- No UI changes
Implemented with GPT-6 in Codex; live tests used gpt-6-astra (medium reasoning) through Codex app-server 0.155.1.
Summary by CodeRabbit#
- Improvements
- Browser and device tool guidance is now handled separately, providing more accurate instructions for each environment.
- Turn-start requests now include browser guidance only when browser tools are available.
- Browser tool access defaults to unavailable unless explicitly enabled, preventing unsupported browser actions.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
f032dff3-8e0c-4809-8900-18cb375fd92e📥 Commits
Reviewing files that changed from the base of the PR and between 7445aa733ada33e45289e5aa5055f79142556513 and d210509d029e53767f14239394e1aefaae2e6dfd.
📒 Files selected for processing (3)
apps/server/src/provider/CodexDeveloperInstructions.tsapps/server/src/provider/Layers/CodexSessionRuntime.test.tsapps/server/src/provider/Layers/CodexSessionRuntime.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
The change separates browser instructions from device instructions. Turn-start parameters now provide browser guidance through
additionalContext.t3_browserwhen browser tools are available. Tests cover availability, interaction modes, and instruction content.Changes#
Browser context delivery
Layer / File(s) Summary Separate browser and device instructions
apps/server/src/provider/CodexDeveloperInstructions.tsThe instruction helpers now generate browser and device guidance separately. Plan and Default modes append device instructions only. Attach browser guidance to turn-start context
apps/server/src/provider/Layers/CodexSessionRuntime.tsbuildTurnStartParamsadds browser instructions as an application entry underadditionalContext.t3_browserwhen browser tools are available. The default availability value is nowfalse.Validate browser context behavior
apps/server/src/provider/Layers/CodexSessionRuntime.test.tsTests cover browser context delivery, unavailable browser tools, interaction modes, image-only turns, and standalone browser instruction content. Priority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Sequence Diagram(s)#
sequenceDiagram participant Caller participant buildTurnStartParams participant buildCodexBrowserInstructions Caller->>buildTurnStartParams: provide browserToolsAvailable buildTurnStartParams->>buildCodexBrowserInstructions: generate browser instructions buildCodexBrowserInstructions-->>buildTurnStartParams: return instructions buildTurnStartParams-->>Caller: return additionalContext.t3_browserSuggested reviewers:
juliusmarminge,t3dotgg🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (4 passed)
Check name Status Explanation Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. Title check ✅ Passed The title clearly and concisely describes the main change: sending Codex browser guidance as application context. Description check ✅ Passed The description includes the required What Changed, Why, and Checklist sections. It also documents validation results and states that no UI changes were made. - Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
Comment `@coderabbitai help` to get the list of available commands.Superseded by merged #13547, which moves Codex browser/device tool guidance (along with runtime info and PR linking) out of collaboration-mode
developer_instructionsintoturn/start.additionalContextasapplicationentries — the same delivery path this PR targeted, plus compaction restore for newer model catalogs that override Default-mode text.Closing this PR as superseded. Please reopen if anything unique here is still needed beyond #13547.
juliusmarminge closed this
Sign in to join this conversation.
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This changes Codex’s automatic browser-tool guidance and default tool-selection behavior by moving existing instructions into application context and applying them on browser-enabled turns. The implementation is focused and tested, but the behavior change affects the default runtime path and warrants human review.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).