Repository navigation
fix(worker): 修复 argv 首轮卡片停在启动中 - #3817
Merged
Merged
Conversation
冷启动绑定前保留首轮开始计时;绑定后为未终态的 argv 首轮补发开始事件并重绑 submission,避免工作中帧被会话网关拒收。 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 25, 2026 01:38
Owner
Author
评审结论:通过,代码侧可合(head
|
冷启动绑定前保留首轮开始计时;绑定后为未终态的 argv 首轮补发开始事件并重绑 submission,避免工作中帧被会话网关拒收。 Co-Authored-By: Claude Code <[email protected]>
仅在尚无 binding 时暂存开始事件,保留宿主按 bindingId 延迟排空与立即补全 runtime 的语义;补齐无 capability、语义重绑和已绑定 execution 的防重回归。 Co-Authored-By: Claude Code <[email protected]>
Co-Authored-By: Claude Code <[email protected]>
同时保留 #3814 的 evidenceAlreadyStarted 守卫与 argv 冷启动补发逻辑。 Co-Authored-By: Claude Code <[email protected]>
This was referenced Nov 25, 2026
|
🚀 Released in v3.59.33 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题与根因
Fixes #3726。
Pi 等 CLI 把首条 prompt 放进启动 argv,首轮没有后续交互式写入。冷启动
init在 runtime binding 建立前发送turn_execution_started,事件被会话网关以runtime_scope_missing丢弃;之后只补发 managed origin,没有补发执行开始事件,导致首轮 execution 一直未绑定,后续 working 帧也无法获得可证明的 runtime/execution scope 而被网关拒收,卡片从「启动中…」直接跳到「等待输入」。修复
markTurnExecutionStart()继续记录 execution clock、input delivery evidence 和 submission;仅在尚无 binding 时保留 turn、dispatchAttempt 和原始startedAtMs,不发送没有 bindingId 的 IPC。已有 binding 但尚未收到 assignment 的非 argv / 续轮写入仍立即发送,由宿主按 bindingId defer/drain 或补全 runtime,不吞事件。runtime_contract_assigned对尚未绑定 runtime、未终态的 argv-baked 首轮补发一次turn_execution_started,复用原始开始时间。补发资格在 spawn 确认 argv 投递时固化为argvBaked,不依赖会被 ready/idle 清掉的 UI seed 标志。recordSubmission(),使 init 时启动、没有捕获 binding 的屏幕采样器也能为后续 working 帧附上 runtime。影响面
验证
bun run build:通过(含 typecheck、dashboard bundle 和 dist 审计)。isolate-run --cpus 16 --timeout 30m -- bun run test test/worker-managed-origin-contract.test.ts test/session-contract-gateway.test.ts test/worker-traex-rpc-context.test.ts test/worker-codex-app-final-origin.test.ts test/restart-reattach-report-continuity.test.ts test/initial-prompt-arg-limit.test.ts test/worker-startup-native-working.test.ts test/mojo-worker-wiring.integration.test.ts test/worker-riff-env.integration.test.ts test/queued-activation-deferred-settlement.test.ts --maxWorkers=4:10 文件、337 项通过(含 fix(worker): 统一 deferred recheck 的 queuedActivationPending 幂等结算并补齐 observe 阻塞可观测性 #3814 deferred settlement 主测试)。isolate-run --cpus 16 --timeout 30m -- bun run test test/worker-argv-reaction-status.integration.test.ts --maxWorkers=1:16 项通过。集成用例使用真实 worker 子进程、真实SessionController与 SQLite 契约存储,断言首个 working 在回合结束前以kind=current入站,而不只是出现在 worker IPC 中。!binding?.runtime误吞 pending-binding 写入(2)、重新耦合 capability(1)、移除 resumed admission 已绑定防重(1)。每次验证后均恢复实现。独立对抗复核
markTurnExecutionStart()的文本冲突已按语义合并,同时保留evidenceAlreadyStarted包裹与!binding暂存逻辑;git merge-tree无冲突,merge head 的 build、337 项相关测试与 16 项完整 argv 集成均通过。binding.runtime暂空的非 argv / 续轮写入吞掉。现仅在完全没有 binding 时暂存,保留宿主按 bindingId defer/drain 或立即补全 runtime 的语义。真实 worker + 契约存储探针中,Mojo/Riff 均恰好产生 1 条 start,原始事件带 bindingId,随后以current入站;execution 进入submitting并绑定 runtime,实际riff_task_id与riff_access_url均为current,deferred 事件全部排空。另有非 argv 冷启动与进程内语义重绑 Turn 2 回归。startEvents=0、execution 保持queued/unbound;改为 spawn 时固化argvBaked资格后,复验为startEvents=1、execution=submitting且获得 runtime,后续 working 为current。新增契约与真实 Grok 延迟 assignment 回归。cancelled;重复 stale assignment 后仍starts=0,没有复活已取消执行。未部署、未重启 daemon、未发版。
🤖 Generated with Claude Code