Skip to content

[PR] fix(plugin): accept longer tool call IDs - #7557

Open
werifu wants to merge 4 commits into
ranxianglei:masterfrom
werifu:local/fix-7380
Open

werifu wants to merge 4 commits into
ranxianglei:masterfrom
werifu:local/fix-7380

Conversation

@werifu

@werifu werifu commented Nov 22, 2026

Copy link
Copy Markdown

Fixes #7380.

Summary

Pi with GPT models provided by Copilot emits tool call IDs longer than 512 characters. The plugin tool endpoint rejects those IDs with HTTP 400, so compress and acp_status fail even after automatic compression triggers.

This PR replaces the fixed limit with plugin.maxToolCallIdLength (default: 4096). Accepted IDs are preserved in full, and routing is unchanged. Blank, non-string, and over-limit IDs are still rejected.

Tests

  • Regression tests verify that a 522-character ID creates a compression blockand still matches that same block on the next turn.
  • A real Pi/Copilot run with the fix triggered automatic T1 compression. compress succeeded with a 530-character ID, and acp_status confirmed the new block was active.

Default the plugin tool endpoint to a configurable 4096-character limit, preserving the full ID for carrier matching. Cover long Copilot IDs and validation boundaries.
@ranxianglei ranxianglei changed the title fix(plugin): accept longer tool call IDs [PR] fix(plugin): accept longer tool call IDs Nov 22, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

PR #7557 review: "fix(plugin): accept longer tool call IDs"

查重: 不重复 — no other open PR/issue targets the same toolCallId limit.

标签: bug · pi · scope/wiring · p2 (Pi+Copilot toolCallId 400 拒绝,特定客户端组合,压缩功能坏但代理仍可用)

Verdict: NOT ready to merge — 2 blocking issues, 1 noted inconsistency. CI red is flaky (not PR-specific).

What I verified:

  • Local: config-surface-guard PASS, 3 modified test files 40/40 pass, typecheck PASS.
  • CI (head ede700a): 3 failing shards (windows-22-4, ubuntu-22-2, ubuntu-24-2).
  • Master (9ad612e): 4 failing shards (windows-24-1, windows-22-1, ubuntu-24-1, ubuntu-22-1).
  • The PR's failing shards (2, 4) are DIFFERENT from master's failing shards (1) — so the PR's CI red is NOT inherited.
  • Root cause of PR's CI red: flaky test. The actual failure in ubuntu-22-shard-2 is tests/issue6069-epoch-pause-over-window.test.ts:231 ("e2e Context limit exceeded. | 上下文超了 #6069: history replaced under the same session id, then grown past the window: the turn is folded and forwarded", AssertionError "preflight summarized the new history", expected true / actual false). This test is about epoch-confirm + preflight folding — completely unrelated to the toolCallId validation the PR changes. It's in shard 2, which is NOT one of master's failing shards (shard 1). This is a flaky test, not a PR-specific failure.

Blocking issues:

  1. Default 4096 deviates from the issue's explicit "keep 512" request. Issue [Pi/Copilot] Auto-compression fails when toolCallId exceeds 512 characters #7380 explicitly requested: "Make the toolCallId length limit configurable. Keep 512 as the default and let users raise it." The PR uses 4096 as the default instead. This is a behavior change (512 → 4096) that needs owner sign-off. Per AGENTS.md, config surface changes are owner-gated.

  2. PR body MISSING required "config surface" section. Per AGENTS.md §Configuration Surface Discipline, any PR that adds a config field MUST report under a "config surface" heading: what is added, why the existing surface cannot express it, which existing mechanisms were considered, and the compat/migration story. The PR body has no such section — it's incomplete by definition.

Noted inconsistency (non-blocking):

  • The PR changes the endpoint validation (handlePluginTool) to use pluginMaxToolCallIdLength() (default 4096), but the tool-ring (recordToolUseId/lookupToolUseIdSession in src/tool-ring.ts) still has a hard 512 limit (not changed by the PR). Consequence: a >512-char toolCallId is accepted by the endpoint (no 400) but path1 routing (lookupToolUseIdSession) is skipped — it falls through to conversationId/witness/single-active arb. This is NOT a regression for Pi (Pi routes by conversationId, not toolCallId), but it creates a theoretical inconsistency for any host that routes by toolCallId with a >512-char id. The PR should either (a) also raise the tool-ring limit, or (b) document why the tool-ring stays at 512.

8问 (structured review):

  1. 是什么问题: Pi with Copilot/GPT models emits tool call IDs longer than 512 chars (37-char call_id + 484-char base64 item.id joined with | = 522 chars). The plugin tool endpoint rejects them with HTTP 400, so compress and acp_status fail even after automatic compression triggers.
  2. 什么原因导致的: The endpoint has a hard-coded 512-char limit on toolCallId (src/plugin.ts handlePluginTool), which is shorter than the IDs some hosts emit.
  3. 影响范围与严重程度: Pi + Copilot/GPT users — compress and acp_status fail with HTTP 400 when the host emits a >512-char toolCallId. Severity: specific condition (Pi + Copilot/GPT), not a general problem.
  4. 怎么修复的: Replace the fixed 512 limit with a configurable plugin.maxToolCallIdLength (default 4096). Accepted IDs are preserved in full; routing is unchanged.
  5. 是否有回归问题: No regression from the PR's own changes (local tests pass, typecheck passes). The CI red is a flaky test unrelated to the PR. The tool-ring 512 limit is NOT changed (noted as an inconsistency, not a regression).
  6. 是否破坏缓存: No.
  7. 是否改了设计方向: No architectural change. The fix is a targeted config knob.
  8. 是否引入了新的配置: Yes — plugin.maxToolCallIdLength (number, default 4096, file-only, no env var). This deviates from the issue's "keep 512" request and needs owner sign-off.

Recommendation:

  • The fix direction is correct and the code is clean.
  • Blocking: (1) Change the default from 4096 to 512 (per the issue's explicit request) OR get owner sign-off for 4096; (2) Add the required "config surface" section to the PR body.
  • Non-blocking: Document or fix the tool-ring 512 limit inconsistency.
  • The CI red is flaky — retrigger or wait for a green run.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

CI analysis complete — all 3 failing shards verified as the same flaky test.

All three failing shards (ubuntu-22-2, ubuntu-24-2, windows-22-4) fail on the same single test:

  • tests/issue6069-epoch-pause-over-window.test.ts:231 — "e2e Context limit exceeded. | 上下文超了 #6069: history replaced under the same session id, then grown past the window: the turn is folded and forwarded"
  • Error: AssertionError: preflight summarized the new history (expected true, actual false)
  • This test is about epoch-confirm + preflight folding — completely unrelated to the toolCallId validation the PR changes.

Labels applied: bug · p2 · pi · pr · scope/wiring

Verdict unchanged: NOT ready to merge. The 2 blocking issues remain:

  1. Default 4096 deviates from the issue's explicit "keep 512" request — needs owner sign-off.
  2. PR body missing the required "config surface" section.

The CI red is flaky (single unrelated test), not PR-specific. Retrigger or wait for a green run.

@ranxianglei ranxianglei added bug Something isn't working p2 pi scope/wiring labels Nov 22, 2026
…ght epoch-exception fix

The branch was cut from 9ad612e, before the ranxianglei#7558 fix (434bf68)
landed on master. The e2e in tests/issue6069-epoch-pause-over-window.test.ts
went red on all 3 test shards (windows 22/4, ubuntu 22/2, ubuntu 24/2)
because the branch carried the ranxianglei#7546 one-shot gate without the ranxianglei#7558
epoch-exception fix. This merge brings in the fix; the contributor's
commit is unchanged and the PR diff still shows only that commit.
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI fix: merged master into the PR branch to resolve the 3 red test shards.

All 3 failing jobs (test (windows-latest, 22, 4), test (ubuntu-latest, 22, 2), test (ubuntu-latest, 24, 2)) failed the same single test — tests/issue6069-epoch-pause-over-window.test.ts ("preflight summarized the new history", assertion at line 231). This is a stale-base failure, not a bug in the PR's code:

Fix: merged origin/master (carrying the #7558 fix) into the branch as an additive merge commit. The contributor's commit is untouched and the PR diff still shows only that commit (10 files, +95/−16). Verified locally before pushing:

Pushed the final head 62cccbe36db to werifu:local/fix-7380 (fast-forward, no force-push; no [ework:ci-held] marker — this is the branch's one full CI pass). A new CI run is in progress (plan ✓, test legs queued/running).


结构化八问

  1. 是什么问题:PR [PR] fix(plugin): accept longer tool call IDs #7557 的 3 个 test 分片(windows 22/4、ubuntu 22/2、ubuntu 24/2)全红,挂的是同一个测试 tests/issue6069-epoch-pause-over-window.test.ts("preflight summarized the new history" 断言失败,:231)。
  2. 什么原因导致的:分支基线过旧(stale-base)。分支从 9ad612e8bc([PR] Add a one-time gate to preflight collapse-before-forwarding: only triggers on first use for new conversations / old sess | preflight 转发前折叠加一次性门槛:只对新对话/未用过 bili 的老会话首次触发,掐断死循环从机制上不可能 (#7545) #7546 preflight 一次性门槛的合入点)切出,早于 [PR] fix: preflight one-shot gate must not block a replaced epoch's first fold (#7545) #7558 修复(434bf68843b)合入 master;分支带着 [PR] Add a one-time gate to preflight collapse-before-forwarding: only triggers on first use for new conversations / old sess | preflight 转发前折叠加一次性门槛:只对新对话/未用过 bili 的老会话首次触发,掐断死循环从机制上不可能 (#7545) #7546 的门槛、却没有 [PR] fix: preflight one-shot gate must not block a replaced epoch's first fold (#7545) #7558 的 epoch 例外修复,导致 Context limit exceeded. | 上下文超了 #6069 的 e2e(同 session id 下历史被整体替换后长到超窗)在 3 个分片全红。不是 PR 自身代码的 bug。
  3. 影响范围与严重程度:仅影响本 PR 的 CI 门禁(3 个 test 分片红,阻塞合并);不影响任何用户面/运行时行为。严重程度:CI 阻塞,非产品缺陷。
  4. 怎么修复的:把 origin/master(含 [PR] fix: preflight one-shot gate must not block a replaced epoch's first fold (#7545) #7558 修复)以附加 merge commit 合入 PR 分支——贡献者的 commit 原封不动,PR diff 仍只显示该 commit。本地先验证(原失败测试转绿、[PR] fix: preflight one-shot gate must not block a replaced epoch's first fold (#7545) #7558 新增测试 6/6 过、typecheck+build 过)再推最终 head。
  5. 是否有回归问题:无。merge 只带入 master 上已验证的 [PR] fix: preflight one-shot gate must not block a replaced epoch's first fold (#7545) #7558 修复代码,未改动贡献者的任何代码;PR diff 与合并前一致。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

判定:修复已推送(最终 head 62cccbe36db,无 ci-held 标记),新 CI run 进行中;本地已验证原失败测试转绿,预期 CI 转绿。

…to reorganized config seed

Master reorganized the config docs/seed (plugin.snapshotCapBytes + snapshot.shadow moved process.yaml -> server.yaml, sessions block relocated). Resolved the 4 conflicted files by taking master's regenerated version, re-adding the contributor's plugin.maxToolCallIdLength seed entry, and regenerating the docs via tools/gen-config-docs.mjs. Contributor's functional commit (src/config.ts, src/knobs.ts, src/plugin.ts, tests) is untouched. Verified: typecheck + the 3 contributor test suites (40 tests) pass.
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Resolved the merge conflict on this PR and pushed the final head (e8cfbd2b624).

What happened: master moved forward (73844f567ef → 045228cfa3e) and reorganized the config docs/seed — plugin.snapshotCapBytes + snapshot.shadow moved from process.yaml to server.yaml, the sessions block was relocated, and storage.archiveAfterDays became the last entry in process.yaml. The contributor's commit added plugin.maxToolCallIdLength to process.yaml + the docs, which collided with that reorganization on 4 files: docs/configuration.md, docs/configuration.zh-CN.md, docs/configuration.ja.md, and website/config-reference/process.yaml (the src/ + test files auto-merged clean).

How I resolved it: merged origin/master into the PR branch. For the 4 conflicted files I took master's regenerated version, then re-added the contributor's plugin.maxToolCallIdLength seed entry to process.yaml (after storage.archiveAfterDays), regenerated the docs via tools/gen-config-docs.mjs generate (re-adds the generated param-ref row to all 3 docs), and manually re-added the contributor's hand-maintained ### plugin section Type/Default update to all 3 docs (the gen script does not generate that section). The contributor's functional commit (src/config.ts, src/knobs.ts, src/plugin.ts, the 3 test files) is untouched.

Verified locally: typecheck pass; the 3 contributor test suites pass (40 tests: tests/plugin-call-identity.test.ts, tests/knobs-config-precedence.test.ts, tests/issue4580-claudecode-tooluseid-routing.test.ts); docs-sync clean (generate is idempotent — no diff after regeneration). The PR diff against master shows only the contributor's 10 files (the functional change is byte-identical to their original). New head e8cfbd2b624 (merge commit, parents 62cccbe36db + 045228cfa3e) pushed to the PR branch — master is now an ancestor of the head, so the PR is mergeable. CI is re-running on the new head (0 failed, 4 queued at last check).

八问:

  1. 是什么问题:PR 与 base 分支冲突(merge state: dirty)——master 在分支切出后又前进了(重组了 config 文档/种子),导致 PR head 无法干净合入。
  2. 什么原因导致的:master 重组了 config 文档/种子(plugin.snapshotCapBytes+snapshot.shadow 从 process.yaml 移到 server.yaml、sessions 块迁移、storage.archiveAfterDays 移到 process.yaml 末尾);贡献者的提交往 process.yaml+文档里加了 plugin.maxToolCallIdLength,与 master 的重组在 4 个文件上相撞。
  3. 影响范围与严重程度:只影响 PR 可合入性(因冲突合不了);无用户面影响——功能改动(knob)本身未变。严重度:阻塞性,但无功能回归。
  4. 怎么修复的:把 origin/master 合进 PR 分支;4 个冲突文件取 master 再生成版本,再把贡献者的 plugin.maxToolCallIdLength 种子条目加回 process.yaml(storage.archiveAfterDays 之后),用 tools/gen-config-docs.mjs generate 再生成文档(补回生成的参数引用行),并手工把贡献者手维护的 ### plugin 段 Type/Default 更新补回 3 个文档(gen 脚本不生成该段)。贡献者的功能提交(src/config.ts、src/knobs.ts、src/plugin.ts、3 个测试)自动合并干净、未动。
  5. 是否有回归问题:无回归。功能改动与贡献者原始字节一致(PR 对 master 的 diff 只显示贡献者的 10 个文件);文档/种子重组是 master 的(非我引入)。已验证:typecheck 过、3 个贡献者测试套件过(40 测试)、docs-sync 干净(generate 幂等无 diff)。
  6. 是否破坏缓存:不涉及——这是冲突解决(merge),未触碰任何缓存/重试/游标/去重逻辑。
  7. 是否改了设计方向:无——冲突解决同时保留了 master 的重组与贡献者的 knob,无架构转向。
  8. 是否引入了新的配置:PR 本身引入新配置键 plugin.maxToolCallIdLength(默认 4096,file-only)——但那是贡献者的改动,非我引入;我的冲突解决没有引入任何新配置,只是把贡献者的条目保留在重组后的种子里。

判定:冲突已解决、最终 head 已推送、PR 可合入;等 CI 在新 head 上跑绿即可合并。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

CI-lane result for PR #7557 — fix(plugin): accept longer tool call IDs

Conflict check: the "merge state: dirty" notification was stale. Verified against live sources this run: master (045228cfa3e) is already an ancestor of the PR head (e8cfbd2b624) — git merge-base --is-ancestor confirms it, and GitHub reports mergeable: true. The earlier run (floor 12) had already merged master in and resolved the config-docs/seed conflicts. No rebase/merge was needed and none was performed.

CI check + one self-inflicted hiccup (disclosed): the CI run for the final head (45249376100) was in_progress with 11 test shards running. I initially misread the timezone — the prompt timestamp was Beijing time (UTC+8), so I assumed those shards had been in_progress for ~8 hours and were stuck. In reality the run was only ~8 minutes old and the shards were running normally. I cancelled the run and re-ran the 11 test shards (the 16 gate jobs were preserved). No code changes were made — the branch was already clean and up to date.

Result: the re-run completed green — run 45249376100 on head e8cfbd2b624: 27 success + 1 skipped, 0 failed (completed 2026-11-23T19:53:28Z).

Current PR state (live): open, mergeable: true, mergeable_state: blocked. The blocked state is due to branch-protection requirements (human review), not conflicts or CI. Nothing further for the CI lane — the PR is clean and ready for human review/merge.

No pushes were made this run (no code changes required).


结构化八问

  1. 是什么问题:系统报告该 PR 与目标分支冲突(merge state: dirty),转交 CI lane 处理。
  2. 什么原因导致的:「dirty」标记是过期信息——上一轮(floor 12)已把 master 合入分支并解决了 config-docs/seed 冲突。另外我把提示里的时间戳(UTC+8 北京时间)误读成了 UTC,从而误判「11 个 test shard 已卡了约 8 小时」。
  3. 影响范围与严重程度:无用户侧影响。唯一副作用是把一个健康运行中的 CI run 取消并重新跑了它的 11 个 test shard(约浪费 7 分钟 CI 时间)。严重程度:可忽略,仅内部 CI。
  4. 怎么修复的:先核实并无真实冲突(master 是 head 的祖先、mergeable=true)。随后取消被误判为卡死的 run,重跑其失败/被取消的 test shard;重跑全绿。
  5. 是否有回归问题:无。本轮未改任何代码,分支与已验证过的 head e8cfbd2b624 字节一致;CI 全绿印证无回归。
  6. 是否破坏缓存:不涉及——未触碰任何代码或缓存逻辑。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及(PR 自带的 plugin.maxToolCallIdLength 是贡献者的改动,非本轮引入)。

判定:冲突为过期标记(无需处理);CI 在最终 head 上已全绿。PR 干净、可进入人工 review/merge,CI lane 无后续动作。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

CI-lane result for PR #7557 — fix(plugin): accept longer tool call IDs (this run: real conflict, resolved + CI green)

Conflict — this time it was real (unlike the 2026-11-24 wake, where the flag was stale): master moved 296 commits since the PR's merge point (045228cfa3e → 24ba3ad09e8, 2026-11-28), including the v0.1.217 release and the egress-plane work. The PR head (e8cfbd2b624, 2026-11-24) was no longer a descendant of master.

Resolution: merged origin/master into the PR branch. Exactly one textual conflict — the ./knobs.js import line in src/plugin.ts: the PR added pluginMaxToolCallIdLength, master added egressPlaneGateOn to the same line. Resolved as the union (both symbols exist in the merged knobs.ts and are both used in plugin.ts). All other files (config docs en/zh/ja, src/config.ts, src/knobs.ts, config-reference yamls) auto-merged cleanly; I verified the auto-merged docs are byte-identical to tools/gen-config-docs.mjs generate output from the merged seeds (no drift, i18n OK).

Local verification: npm run typecheck clean; targeted tests for the PR's changed area (tests/plugin-call-identity.test.ts + tests/knobs-config-precedence.test.ts) 24/24 pass.

Push: merge commit 32f6a28e8dc pushed to werifu:local/fix-7380 (fast-forward, no force-push; remote head re-checked immediately before push — no concurrent work).

New finding this run — stale-PR gate (#7785): the PR is now 7+ days old (> 72 h threshold), so the first push on the new head was skipped by the plan job (scope=skip; only the ~16 gate jobs ran, all green). The workflow's documented re-arm is the ci:force label — I added it, which triggered a fresh run of the core matrix: run 46205043569 completed success — 27 success + 1 skipped, 0 failed (completed 2026-11-29T00:19:58Z). The ci:force label is left on the PR: if review requests changes, the next push gets CI without re-labelling.

Final live state: open, mergeable: true (no conflict), mergeable_state: blocked — the remaining block is the branch-protection human-review requirement only. CI fully green on head 32f6a28e8dc. Ready for human review/merge.


结构化八问

  1. 是什么问题:系统报告该 PR 与目标分支冲突(merge state: dirty),转交 CI lane 处理。
  2. 什么原因导致的:这次冲突是真实的——master 自 PR 合入点起前进了 296 个提交(045228cfa3e → 24ba3ad09e8,含 v0.1.217 发版与 egress 平面工作),PR head(e8cfbd2b624,2026-11-24)不再是 master 的后代。唯一文本冲突在 src/plugin.ts 同一 import 行:PR 加了 pluginMaxToolCallIdLength,master 加了 egressPlaneGateOn。
  3. 影响范围与严重程度:无用户侧影响。冲突仅为单行 import;文档/配置类文件全部自动合并干净。严重程度:低(机械性冲突)。
  4. 怎么修复的:把 origin/master 合入 PR 分支,import 冲突取并集解决(两个符号在合并后的 knobs.ts 中都存在且都在 plugin.ts 中使用);验证自动生成文档与 seed 一致(无漂移、i18n OK)。另发现 stale-PR 门([CI] every label fires a no-op CI run, and PRs older than 72h still pay a full matrix per push — | 任意 label 都触发一轮空转 CI,且超过 72 小时的老 PR 每次推送仍跑完整矩阵 #7785):PR 已 7 天以上,test 矩阵在 push 时被 skip;按工作流文档化的再武装机制加 ci:force 标签,CI 核心矩阵跑绿。
  5. 是否有回归问题:无。typecheck 干净;PR 自身定向测试(plugin-call-identity + knobs-config-precedence)24/24 通过;完整 CI 核心矩阵绿(27 success + 1 skipped,0 failed)。PR 行为无语义变化——只是重新合入 master。
  6. 是否破坏缓存:不涉及——未触碰任何缓存逻辑。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及——本轮未引入新配置(PR 自带的 plugin.maxToolCallIdLength 是贡献者的改动,非本轮引入)。

判定:冲突已解决、CI 在最终 head 32f6a28e8dc 上全绿。PR 干净、可进入人工 review/merge。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Pi/Copilot] Auto-compression fails when toolCallId exceeds 512 characters

2 participants