Skip to content

fix(openai): normalize Codex Desktop page context before tool validation - #8622

Merged
Wei-Shaw merged 1 commit into
Wei-Shaw:mainfrom
Hato626:fix/codex-page-context
Nov 10, 2026
Merged

Wei-Shaw merged 1 commit into
Wei-Shaw:mainfrom
Hato626:fix/codex-page-context

Conversation

@Hato626

@Hato626 Hato626 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Codex Desktop can inject agent.codex_apps_open_page and agent.codex_apps_selected_page_part_N_of_M into the first HTTP Responses request as function_call_output items without call_id. These carry page context rather than the result of a model-issued tool call. The existing validator rejects the request with function_call_output requires call_id, even when the snapshot contains only a null page_id.

Normalize these recognized page-context items to user-role input_text before bootstrap normalization and HTTP tool validation. Preserve the original context, ordering, multipart fragments, history and numeric precision. Matching requires the expected namespace, name and snapshot shape; actual tool outputs and unrelated malformed items retain the existing validation behavior. Duplicate JSON keys and invalid payloads are left unchanged.

Regression tests cover the original 400 response, successful validation after normalization, idempotence, real tool history, mixed automation/delegation context, multipart snapshots and malformed inputs.

Validation:

  • go test -tags=unit ./internal/handler -count=1 -timeout=180s
  • golangci-lint run --timeout=10m ./... (v2.14.0)
  • Live replay with the same normalizer: HTTP 400 before the fix; HTTP 200 with a completed SSE response after it.

Refs #8609.

Copilot AI balanced review requested due to automatic review settings November 9, 2026 09:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@Hato626

Hato626 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants