Repository navigation
feat(workhub): queue new delegations behind active Sessions - #9
Conversation
Reuse ordinary next-turn Message admission for busy and waiting targets, with bounded preflight under the existing Session admission lease. Preserve target settings, native cancellation and legacy shared-Turn protection. Refs #8 Generated-by: OpenAI Codex
|
审查提交: 确认 2 项 P2,未发现已验证的 P1。建议修复后再合并。 [P2] 在取消源委派前检查并预留改投目标的队列容量 这段新增检查在 进一步验证:即使释放目标容量,再用新的 actionId 重试同一改投,也返回 应在取消源委派前完成目标容量检查及预留;容量不足时保留源 Message 和正常重试能力,避免一次被拒绝的改投先取消原任务。 代码位置:execution-composition.ts:2590–2596。 [P2] 排队委派不能把原任务 Turn ID 作为实际执行进度的标识返回 新委派已改成独立的 实际 Host + Desktop 适配器复现:手工 Turn A 运行时提交委派 D;A 完成后,D 已进入另一个独立 Turn,实际状态仍为 持久 admission Turn 可以继续用于准入记录,但状态查询必须依据委派 Message 的执行证据解析实际 Turn;D 尚未开始时应返回 pending,不能用原任务的完成事实证明新委派已经完成。 代码位置:execution-composition.ts:2573–2575。 验证结果:
专项复现使用真实 Host composition、SQLite 持久化及现有 Desktop status 适配器,模型后端使用 FakeBackend。上述既有测试通过不代表覆盖了这两项缺陷;本次没有运行完整 Electron / Windows 测试。 |
Reserve replacement queue capacity before source retirement and report delegation progress through Message execution ownership. Generated-by: OpenAI Codex
|
已按审查中的两项 P2 修复,并普通推送到同一分支:
回执契约变化已将协议兼容 epoch 升至 精确提交的本地验证(macOS):
PR 描述与 #8 已同步。未运行真实 Windows smoke/打包,不以 inventory 代替平台验证。Hosted 主 CI 仍在运行;自动 request-review 检查仍因缺少 请重新审查;本次不自动合并,也不启动下一步。审查报告未确认 P1,这不等于证明所有路径不存在 P1。 AI assistance: OpenAI Codex assisted with reproducing, implementing, testing and reporting these fixes at the repository owner's request. Owner review is still pending. |
|
复审提交: 确认仍有 1 项 P2,未发现已验证的 P1。建议修复后再合并。 上一轮的 Message 状态误报已修复;满队列拒绝时保留原委派、释放容量后用新 actionId 重试,也已独立验证通过。但容量预留仍漏掉目标新产生的 Interaction。 [P2] 将消息容量预留纳入 Interaction 的 Session 快照准入检查 这里新增的预留只保存在 已用真实 Host composition + SQLite、FakeBackend 控制 Stop 时序复现两次,未改变生产代码或容量常量:
关键实测结果: {
"correction": { "ok": false, "code": "session_busy", "message": "Session projection capacity is full" },
"sourceTurnStatus": "cancelled",
"replacementCommitted": false,
"replacementIntent": true,
"terminalAbort": false,
"newActionRetry": { "ok": false, "code": "operation_conflict", "message": "WorkHub delegation already has a different replacement intent" }
}需要让所有会增长同一 Session snapshot 的准入路径都计入尚未消耗的预留,尤其是 Interaction/sandbox boundary 的 代码位置:新增 reservation 存储、仅在消息路径合并 reservation、Interaction 快照预检。 本次验证:
本次本地验证环境为 macOS / Node v24.19.0;未运行完整 Electron 或真实 Windows 测试。 |
Account for queued replacement reservations in shared Session snapshot preflight, including Interactions and sandbox boundaries, without exposing phantom Messages or double-counting admission. Generated-by: OpenAI Codex
|
复审指出的 P2 已在 本次将预留统一接入现有
已加入实际 Host + SQLite + FakeBackend 的 Stop 屏障回归:目标预留 48 KiB 后,3 个大问题在持久化前收到 精确提交的本地验证:
仅修改 5 个相关文件;未提高容量上限、新增数据库或持久队列,也未增加测试重试、放宽断言或更改协议字段。本次 epoch 保持 205。PR 描述与 #8 已更新。 以上是本地验证结果;新提交的 hosted CI 单独确认,不沿用上一提交的绿色状态。本机未运行真实 Windows smoke 或 Windows 打包。仍等待仓库所有者复审与合并,未自动合并,也未开始下一阶段。 本次 hosted AI assistance: OpenAI Codex assisted with the investigation, fix, tests and this follow-up at the repository owner's request. Owner review of the updated implementation is pending. |
|
再次复审: 本轮未发现已验证的 P1/P2;上一轮报告的 Interaction 占用预留容量 P2,已验证修复。 本次改动把 admission-only 使用独立复核脚本、真实 Host composition + SQLite + FakeBackend,验证了以下 4 项实际调用路径:
相关既有及新增测试也验证了 sandbox boundary 的共享预算、小问题可容纳、释放预留后容量恢复、Message 去重和公开队列不包含虚假预留。 本轮验证结果:
验证环境为 macOS / Node v24.19.0。本轮未运行完整 Electron 或真实 Windows 测试,也未独立确认最新 hosted CI:CI 读取工具当前提示需要连接 GitHub 账户,因此不沿用上一提交的绿色状态或将修复说明中的 CI 结果作为本轮验证。这里的结论仅覆盖已审查代码与上述本地验证,不等于证明所有执行路径不存在缺陷。 |
Summary
Refs #8(分步交付计划中的 PR 1)
将 WorkHub 发给忙碌 Session 的新委派改为现有的
next_turn / followup持久消息:针对 首轮审查 和 后续复审 的 P2,补充完成:
fitsCandidate使用 admission-only 容量投影,公开read()保持无虚假消息;按 Message ID 去重,避免准入自己的预留时重复计数。合法且仍能容纳的小问题继续准入,预留释放后恢复相应容量。targetMessageId;排队尚未执行时不再把祖先 admission Turn 当作执行 Turn 返回。Desktop 的status先查询 Message 执行所有权,未启动返回 pending,已启动再查询实际 Turn/Run,并校验身份。历史 Turn-only 回执与 linked resume 仍兼容。204升至205;旧持久 assignment 的 admission Turn 保持不变。本阶段不加入新权限设置、全局并发配置、跨 Session 通信或新前端。后续阶段等本 PR 由仓库所有者检查合并后再继续。
Verification
最新验证提交:
da83162b963eae89cb31d4953eaab9201f4a3782。环境:macOS arm64,Nodev24.19.0,npm11.19.0。基线:dcef64275ef435049a4a0c65a0d81199b45ed498。389 passed / 0 failed,包含 Interaction、Message、WorkHub 改投/状态、Storage conformance、Core 回执及 Desktop runtime。2240 passed / 0 failed / 12 skipped,使用--test-concurrency=2。10137 passed / 0 failed / 22 skipped,使用--test-concurrency=2。50/50。workhub-pending-question.spec.ts:1/1通过(重载、浮出/停靠、原问题选项与焦点)。check:release通过,其中 release 测试214/214;本次仅修改内部容量检查,epoch 保持205,提交后相对 main 的协议兼容检查通过204 -> 205。主要复跑命令:
node --test --test-concurrency=2 \ packages/core/dist/__tests__/runtime-event.test.js \ packages/storage/dist/__tests__/execution-provider-conformance.test.js \ packages/runtime-host/dist/__tests__/canonical-session-projection.test.js \ packages/runtime-host/dist/__tests__/interaction-coordinator.test.js \ packages/runtime-host/dist/__tests__/execution-composition.test.js \ packages/runtime-host/dist/__tests__/message-coordinator.test.js \ packages/runtime-host/dist/__tests__/workhub-coordination-action-gate.test.js \ packages/runtime-host/dist/__tests__/workhub-coordination-coordinator.test.js \ packages/runtime-host/dist/__tests__/workhub-assignment-crash-recovery.test.js \ apps/desktop/dist/main/__tests__/workhub-runtime.test.js node --test --test-concurrency=2 'packages/runtime-host/dist/**/*.test.js'Verification limits and compatibility
初始提交
44480144695cfda557912d77f80e4985c0a133c3的两轮全仓库并行测试不是全绿,未修改的用例出现以下失败。保留这些历史记录;最新提交上述有界并发运行已通过:single-flights one limit-bound writer and snapshots admitted inputs:首次完整运行失败;本分支独立复跑 30 次有 3 次失败。另在从精确基线提取、重新编译的源代码上复跑 30 次,有 1 次相同的 lease / limits 断言失败,确认问题在本补丁之前已存在。kills login-shell descendants when capture times out:第二轮并行运行未生成 PID 文件;独立复跑通过,基线独立复跑也通过。real health probe falls back to GET and bounds stalled responses:第二轮并行运行在 100ms 探测窗口中超时;独立复跑通过,完整 Host 的双进程复跑通过。这些用例及对应生产模块没有被本 PR 修改,也没有增加重试、延长超时或跳过断言来让它们变绿。
本机没有运行真实 Windows smoke、Windows 打包或完整 Electron 全套;Windows inventory 不是 Windows 运行证据。本阶段未修改 Windows 后端。
本次 hosted
test首跑 在未修改的Windows opens the store page in installed Chrome, not the default browser用例失败:期望 URL,实际读到空字符串。夹具只等待临时结果文件存在,没有等待内容写完;该测试及生产模块与 main 的 Git blob 完全相同。本机原样连续复跑 20 次,80/80通过,未修改断言或增加代码重试。已发起失败工作流的第二次运行,尚未确认全绿;首跑后续 Runtime Host 和 Electron E2E 被跳过,不能计为远端通过。另一个request-review因缺少COPILOT_REVIEW_TOKEN失败,未改动工作流或 secrets。兼容性边界:
AI use
Select exactly one:
Tool(s) and scope: OpenAI Codex assisted with source inspection, implementation, tests, the ADR update and this PR at the repository owner's request. The owner will independently review and merge; this PR has not been automatically merged. The commit includes a
Generated-by: OpenAI Codextrailer.Checklist
Does this PR entail a change in behavior?