Skip to content

[PR] fix: teach direct ACP calls for Codex exec namespaces - #6461

Closed
xiaozhu1337 wants to merge 2 commits into
ranxianglei:masterfrom
xiaozhu1337:2026-11-12_codex-exec-direct-call-hints
Closed

xiaozhu1337 wants to merge 2 commits into
ranxianglei:masterfrom
xiaozhu1337:2026-11-12_codex-exec-direct-call-hints

Conversation

@xiaozhu1337

@xiaozhu1337 xiaozhu1337 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex requests declaring functions.exec received no direct-call guidance for proxy-owned ACP tools, so the model could try a nonexistent tools.* SDK binding. Responses injection now recognizes the qualified custom/function name and the functions namespace form, including additional_tools wrappers within the supplied tools array, and tells the model to call the injected ACP tool directly.

Addresses the proxy prompt gap in #5592. Detection is separate from the omnibus reachability gate: bare exec, functions, and unrelated namespaces do not enable compression. Native MCP declarations, plugin manifest binding instructions, client tool objects, and pack-owned descriptions are preserved. This does not repair Codex's missing ready MCP client or establish the cause of the separate quiet-status observation, so it deliberately does not close the whole issue.

Validation on rebased head (base 259cd876):

  • 130 targeted tests pass: ptc-runcode-tools and lane-decisions-matrix, with both storage/environment preloads.
  • Regression coverage uses synthetic Responses schemas, not a captured production replay; covers positive shapes, negative namespace matches, byte stability, repeat injection, native MCP/pack preservation, and reachability negatives across all four wires.
  • TypeScript check, tsup build, dist import/external checks, architecture-docs guard, and git diff --check pass.

Draft because the required real Codex four-phase E2E has not run: the configured default upstream at 127.0.0.1:8199 is unavailable locally, and the PR's real-Codex workflow skipped the E2E job. The PR build-artifact check passed; main CI is still pending. Remote CI on the pushed commit remains the full-regression verdict; local targeted tests are not a substitute for either gate. This change only examines the existing injection wrapper's tools argument: declarations present only in input[].additional_tools are not newly inspected, and an unqualified exec alone intentionally does not trigger the hint.

@ranxianglei ranxianglei changed the title fix: teach direct ACP calls for Codex exec namespaces [PR] fix: teach direct ACP calls for Codex exec namespaces Nov 12, 2026
…egression tests

Review fix (small, non-semantic): the new ranxianglei#5592 tests re-declared a
substring of the note locally instead of importing the constant, unlike
the file's existing PTC-note pattern. Export CODEX_EXEC_EXEMPT_NOTE and
assert the full note — strictly stronger, no behavior change.
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

查重: 不重复 — no other open PR targets the #5592 prompt-gap facet (checked the open [PR] list; this PR is the only one).

Review verdict: code quality PASSES — mergeable once the ci:full e2e lanes go green and the PR is undrafted.

Live state (verified just now): PR open, draft, mergeable, no labels; base 259cd876 = current master tip; head 06b51024f0 (after the review-fix commit below). CI on the original head 28048cad: 52 check runs — 38 success, 14 skipped, 0 failed. The 14 skipped are all real-client/e2e lanes gated by the ci:full PR label (three-layer CI #3295) — the PR has no labels, so those lanes were skipped by design. CI on the new head is pending (test-only commit).

Local verification (on the PR head):

Review-fix commit pushed to the PR branch (06b51024f0, test-only, non-semantic): the new tests re-declared a substring of the note locally instead of importing the constant — unlike the file's existing PTC-note pattern. I exported CODEX_EXEC_EXEMPT_NOTE and the tests now assert the full note (strictly stronger). Re-verified 19/19 after the change.

What remains before merge (all outside the code):

  1. Add the ci:full label to the PR so the real-codex e2e lanes (ci-e2e.yml 4-phase + ci-e2e-fake.yml) run — I don't touch this PR's labels (they're owned by author/owner); please add it.
  2. Undraft.
  3. Owner merge.

Scope note: the PR deliberately does not close #5592 in full — the quiet-status observation and the host's missing ready MCP client are separate facets (the issue carries needs-decision). I agree with that scoping: this PR fixes exactly the proxy prompt gap, nothing more.

Code review highlights:

  • Hint detection is correctly separated from the omnibus reachability gate: hasCodexExec is hint-only; CODE_MODE_OMNIBUS_TOOL_NAMES (run_code/code_run) and ptcNoteMode are untouched, so nudge/standing prompts do not arm on any exec-shaped request. Three new negative matrix rows pin this.
  • Detection covers all four positive shapes (flat custom/function functions.exec, functions namespace nesting, additional_tools wrapper) and rejects bare exec, functions alone, unrelated namespaces, and functions.exec as a namespace name.
  • The note is appended only to proxy-owned tools (PROXY_TOOL_NAMES), skipping pack-owned descriptions (pck-verbatim) and non-string descriptions. Host tool entries keep object identity and byte-exactness; re-injection is idempotent (mergeOwnedTools drops owned names and rebuilds base fresh) — both test-pinned.
  • Only injectResponsesTool is touched; the anthropic/openai/google wires and the plugin lane are unchanged (plugin manifest pinned by existing + new tests).
  • Gate discipline (Test Blind Spot Retrospective: Reinforcing Negative Assertion Discipline, Tightening Fake Upstream Strictness, Thin Inst | 测试盲区复盘:补反向断言纪律、假上游严格化、薄安装冒烟、形态矩阵与生命周期覆盖 #3617): both directions asserted. Diff clean: 3 files, all on-topic, no whitespace churn.

结构化八问(供人工 reviewer):

  1. 是什么问题: Codex code-mode(Responses wire)请求声明 functions.exec 命名空间时,代理注入的 ACP 工具(compress/decompress/search_context/acp_status/acp_cache)没有调用约定提示,模型去试不存在的 tools.* SDK 绑定(tools.mcp__bili__compress is not a function、tools.compress is not a function),长会话里压缩停摆。
  2. 什么原因导致的: 提示检测(ptcNoteMode / CODE_MODE_OMNIBUS_TOOL_NAMES)只认 run_code/code_run omnibus 名;Codex 的 exec 形状(flat functions.exec、functions 命名空间、additional_tools 包装)全部返回 none,注入的工具描述因此没有追加 note。根因是提示检测的形状覆盖缺 Codex exec 形状,不是注入机制本身的缺陷。
  3. 影响范围与严重程度: Responses wire 上的 Codex code-mode 会话,且宿主声明了 functions.exec、原生 MCP 绑定未就绪(Codex exec/namespace ACP hints miss direct-call path when native MCP binding is not ready #5592 场景:Codex Desktop 0.166.0-alpha.5.1、bili 0.1.212)。该配置下模型完全调不到代理工具 → 压缩不可用;源 issue 已定 p2(能用但有明显问题,需绕行)。
  4. 怎么修复的: 在 Responses 注入路径加独立 hint-only 检测器 hasCodexExec——递归限定名匹配 functions.exec(覆盖 flat custom/function 条目、functions 命名空间嵌套、additional_tools 包装透传);命中则对 proxy 自有工具(PROXY_TOOL_NAMES,跳过 pack-owned 描述)追加静态 CODEX_EXEC_EXEMPT_NOTE。刻意不扩 CODE_MODE_OMNIBUS_TOOL_NAMES/omnibus 可达性门——扩了会让任何 exec 形状请求误开 nudge/standing prompt;3 条新负向矩阵行钉死门不扩。裸 exec/functions/无关命名空间不触发(负向测试)。
  5. 是否有回归问题: 已审既有行为——(a) 无 functions.exec 形状的请求:检测器为 false,输出字节不变(唯一 diff 是 const→let + 提升);(b) ptcNoteMode/omnibus 门未动,nudge/standing 行为不变;(c) 其余三条 wire(anthropic/openai/google)与插件车道未动(只碰 injectResponsesTool;manifest 由既有+新增测试钉住);(d) 宿主工具条目保持对象同一性与字节精确(测试钉住);(e) 重复注入幂等(测试钉住);(f) pack-owned 描述保持 verbatim(pck-verbatim,测试钉住)。未发现无意回归。
  6. 是否破坏缓存: note 是静态字符串,检测依赖每请求的 tools 数组——与既有 PTC模式下 模型直接调用了 compress工具, 没有走run_code, 这块能不能在 billion-context 的几个工具中明确一下PTC要走run_code调用? #3252 note 同模式。宿主工具表稳定(Codex 如此)时描述跨轮字节稳定 → 除升级时一次性失效外无缓存影响;重试/增量游标/去重键不受影响。
  7. 是否改了设计方向: 没有。hint 检测与可达性门的分离沿用既有 PTC模式下 模型直接调用了 compress工具, 没有走run_code, 这块能不能在 billion-context 的几个工具中明确一下PTC要走run_code调用? #3252/[BUG] 0.1.202 DSH 0.2.x code-mode channel: omnibus is actually named code_run, RUN_CODE_TOOL_NAME hardcoded to `run_ | [BUG] 0.1.202 DSH 0.2.x code-mode 通道:omnibus 实际名为 code_run,RUN_CODE_TOOL_NAME 硬编码 run_code ⇒ 压缩面永久压制(#3603 修复复发) #3884 架构(按请求 note 模式 + 静态 note),无架构转向。
  8. 是否引入了新的配置: 无。

判定: 代码质量通过(方向正确、无回归、测试有牙、diff 干净);合入前需 ci:full e2e 绿 + undraft + owner 合并。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

CI update (verified just now): the review-fix head 06b51024f0 is fully green — all 11 test shards (ubuntu/windows × node 22/24) + static-gates + mysql-contract + config-surface-guard succeeded, 0 failures; the 14 skipped lanes are the e2e/real-client lanes gated by the ci:full label (still needed before merge, per my review above). Nothing further outstanding on the code side.

@ranxianglei

Copy link
Copy Markdown
Owner

Landed via batch PR #6482 (merged) — closing as superseded.

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.

2 participants