Skip to content

fix(openai): preserve VS Code IDE context in HTTP Responses - #8929

Merged
Wei-Shaw merged 1 commit into
Wei-Shaw:mainfrom
superman2003:fix/codex-standalone-context-names
Nov 20, 2026
Merged

Wei-Shaw merged 1 commit into
Wei-Shaw:mainfrom
superman2003:fix/codex-standalone-context-names

Conversation

@superman2003

@superman2003 superman2003 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #8857. Follow-up to #8769 and the maintainer’s review of #8680.

VS Code sends the active file, selection and open tabs as an untrusted ide_context entry. Codex serializes it as agent.ide_context, a standalone function_call_output without a call_id. On main, the HTTP Responses handler rejected that input with 400 before selecting an upstream. The shape was verified against the published OpenAI extension, version 26.51111.21308 and the Codex context producer.

This extends the existing user-message normalization to ide_context, the untrusted_content fallback and approved-plan chunks. Text and item order are preserved, including whitespace-only plan fragments. All three require a matching namespace, name and JSON string output. Ordinary tool results continue through call-ID validation.

Verification

  • Paired handler replay with a capturing mock upstream: the same VS Code request returned HTTP 400 on main with zero upstream calls, then HTTP 200 on this branch with one upstream call. The forwarded item was a user message containing the exact IDE text, followed by the original user prompt.
  • Reproduced the rejection with the VS Code active-file and selection format. The new regression cases also failed on the old normalizer for untrusted_content and proposed_plan.
  • go test -tags=unit ./internal/handler -count=1 -timeout=300s
  • go test -tags=unit ./internal/service -run '^TestValidateFunctionCallOutput' -count=1 -timeout=180s
  • gofmt -l and git diff --check are clean.

riofutab added a commit to riofutab/sub2api that referenced this pull request Nov 20, 2026
- 带入上游 11-17 至 11-18 已合的 PR,同步基准更新为 2af3f1e:GPT-6.2 Sol/Astra(Wei-Shaw#8906)、Ultra Fast 分组强制与渠道倍率(Wei-Shaw#8812 Wei-Shaw#8914)、首字前空闲换号受预算约束(Wei-Shaw#8920)、缓存创建 TTL 明细(Wei-Shaw#8174)及两项性能优化;Wei-Shaw#8577 与 Wei-Shaw#8598 fork 已有等价实现。
- 缓存创建 TTL 改用上游 Wei-Shaw#8174,撤回 fork 先前带入的 Wei-Shaw#8237;冲突处保留 fork 的 advisor 用量解析。
- 合入 19 个开放 PR:VS Code IDE 上下文(Wei-Shaw#8929)、Claude Code CCH 签名恢复(Wei-Shaw#8889,默认关闭)、等响应头时发 ping(Wei-Shaw#8964)、408 换号、账号恢复调度与批量编辑等修复,以及 Antigravity 假 429、裸 429 冷却范围、容量 503 换号、空流不冷却(Wei-Shaw#8975 含 Wei-Shaw#8627 新版)。
- compat 空流与 MALFORMED_FUNCTION_CALL 保留 fork 带的 Wei-Shaw#7899 行为,相关上游测试按 fork 行为调整;GPT-6.2 模型名后缀的推理档位补上校验。
- 后端全量 unit、golangci-lint、前端 lint/typecheck/vitest 与 CI 集成测试通过。
@Wei-Shaw
Wei-Shaw merged commit a641897 into Wei-Shaw:main Nov 20, 2026
9 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 20, 2026
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.

[Bug] VSCode Codex 插件开启 ide_context 后返回 HTTP 400:function_call_output 缺少 call_id

2 participants