Repository navigation
fix(delegate): coalesce simultaneous completion notifications into one batched message - #230
Conversation
…e batched message (closes #157)
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-230Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr230.tgz
pi install ./packageThis comment is automatically updated on each push. |
|
review 这个是否还存在 看代码是否冲突 是否有回归问题 是否兼容多系统 |
Review 结论:可以合并(1 个小建议 + 2 个已知边界,均非阻塞)在 PR head 1. 问题是否还存在 → 存在,PR 仍然必要master 当前 2. 代码是否冲突 → 无冲突PR 分支基于 3. 回归问题 → 未发现回归,关键交互路径逐条核对过
两个已知边界(记录即可,不阻塞):
一个小建议:PR 没更新 4. 多系统兼容性 → 兼容
|
|
修复这个问题,然后本机实际测试一下。实际调起 Agent 测试是不是有问题? |
|
[bot] 两件事都完成了。 1. CHANGELOG 已补(已推送到 PR 分支)commit 2. 本机实际测试(真实进程级 e2e)先说限制:这台机器没有 pi CLI,也没有任何 LLM 凭据( S1 — 3 个 delegate 同时完成(2 成功 + 1 失败,完成时刻 300/700/1100ms):
S2 — 错峰完成(300/4000/4300ms):
S3 — 窗口期内 wait 消费:
落盘验证: 3. 推送后的分支状态
结论:修复有效、无回归、单 run 格式兼容旧行为。剩下可以合了(merge 留给你)。 |
# Conflicts: # CHANGELOG.md # src/delegate-tool.ts # tests/delegate-tool.test.ts
coreOutToAgentMessages now consumes kernel-rewritten tool-call text (hide-consumed dead-range filtering + summary stubbing, acp-kernel ranxianglei#230/ranxianglei#232) and syncs the compacted JSON back into toolCall.arguments for both projection paths (plain-id single-call and base#callId multi-call). Fail-safe: unparseable/absent kernel text keeps originals; string-form content (non-strict providers) keeps its shape. Bumps acp-kernel pin 0.0.56 -> 0.0.60 (published). Fixes ranxianglei#340
…ce-delegate-notifications fix(delegate): coalesce simultaneous completion notifications into one batched message
coreOutToAgentMessages now consumes kernel-rewritten tool-call text (hide-consumed dead-range filtering + summary stubbing, acp-kernel ranxianglei#230/ranxianglei#232) and syncs the compacted JSON back into toolCall.arguments for both projection paths (plain-id single-call and base#callId multi-call). Fail-safe: unparseable/absent kernel text keeps originals; string-form content (non-strict providers) keeps its shape. Bumps acp-kernel pin 0.0.56 -> 0.0.60 (published). Fixes ranxianglei#340
Problem (#157)
When multiple subagents finish near-simultaneously (or one after another while the main window is busy), each completion enqueues its own follow-up notification via
sendUserMessage(deliverAs: followUp). Every enqueued message triggers a full model turn, so N finishing delegates cost N extra turns — and notifications keep firing even after the model has already confirmed everything done. The user also observed the model idling between these queued notifications.Fix
Trailing-edge coalescing window in the async completion path (
src/delegate-tool.ts):scheduleRunNotification) and arms a 2s debounce (hard cap 10s from the first queued completion, so a stream of staggered finishes cannot starve delivery).flushDelegateNotificationsdelivers one batched message: header with counts ([acp_delegate] 3 delegates finished (2 completed, 1 FAILED)), one compact section per run (status, exit code, timeout note, task, result file, error excerpt for failures), then a single trailer with the still-running count, session delegate usage, and closing instructions.acp_delegate_wait/acp_delegate_cancelduring the window drop out of the batch (no duplicate delivery).findUndeliveredRunsnow treats queued-but-unflushed as scheduled, not lost) and piggyback on the next flush.Net effect: N simultaneous completions → 1 model turn instead of N; the main window stops getting peppered after it has wrapped up.
Tests
6 new tests in
tests/delegate-tool.test.tscovering coalescing, waiter/consumed exclusion, failed-send recovery, single-run legacy format,findUndeliveredRunsexclusion of queued runs, and section formatting. Full suite: 434 passed, typecheck clean, build clean.Closes #157