WIP: Feat/ 待发送消息从前端队列移入rust #514

Draft
k88936 wants to merge 3 commits from feat/msg-queue-to-rust into master
Member

closes #499
沿用thread manager, 状态存在日志里

closes #499 沿用thread manager, 状态存在日志里
k88936 added 3 commits 2026-09-24 21:25:18 +08:00
- 新增 ADR:命令=入队、放行归 Thread Manager、待发消息队列作为运行态事件归宿主
- 新增实施计划:五步落地顺序、标识符映射表、每步不变式与验收证据
- CONTEXT.md:接单/拒单词条替换为入队/入队失败/放行,新增待发消息队列与待发消息词条
- docs/README.md 补两条索引;decision-log.md 追加同日决策记录
- 新增 `DirectThreadEvent::QueueEnqueued`(`queue.enqueued`,带 canonical 用户条目与可选 `creationType`,不带 prompt)与 `QueueRemoved`(`queue.removed`,`reason` 为 typed 枚举 `cancelled | dispatched`)
- 新增 typed 枚举 `DirectQueueRemovalReason` 与 `DirectQueueRemovalOutcome`,并重跑 ts-rs 绑定
- 新增 `agent/direct_thread_queue.rs`:`PendingDirectTurn`(入队时冻结 canonical 形状与 prompt)、上限 `MAX_PENDING_DIRECT_TURNS = 5`、`EnqueueOutcome` / `EnqueueRejection`
- Thread Manager 的 `observe_event` 认队列事件:在队期间的 `queue.enqueued` 不可回收,`queue.removed` 把它转成可回收,新订阅者的 bootstrap 因此天然看得见当前队列
- `DirectCodexUserItem` 及其子类型补 `PartialEq`,`DirectThreadEvent` 不再需要 `Eq`
Thread Manager:待发消息队列的入队 / 取消 / 放行认领
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m12s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m31s
Project CI / Backend tests (pull_request) Successful in 4m1s
Project CI / Frontend tests (pull_request) Successful in 2m5s
Project CI / Native shell tests (pull_request) Successful in 6m7s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 10m0s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 10m3s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m52s
Project CI / Repository checks (pull_request) Successful in 2m17s
053e0bd932
- `StoredEvent` 增加非序列化的 `pending` 产物字段:它的有无就是队列成员身份,队列的先后就是事件先后,不另建队列表
- 新增 `enqueue_pending_turn`:按 `clientTurnId` 幂等(判重范围「在队 ∪ 正在跑的那一轮」),容量用 `queue_has_room` 挡在队条目
- 新增 `remove_pending_turn`:typed 结果 `Removed | AlreadyDispatched | NotFound`,在临界区里取走产物并追加 `queue.removed{cancelled}`
- 新增 `claim_pending_turn`:同一临界区取队首 → 登记占用 → 追加 `turn.started` 与 `queue.removed{dispatched}`,已有未收口回合或队列为空时返回 `None`
- `mark_queue_events_cleanable` 跳过仍挂着产物的条目,保证在队条目永远不会被回收
- 新增薄包装 `enqueue_direct_pending_turn` / `remove_direct_pending_turn` / `claim_direct_pending_turn`,并补 5 条单测覆盖 bootstrap 可见、幂等、容量、放行原子性与三种取消结果
Some checks are pending
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m12s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m31s
Project CI / Backend tests (pull_request) Successful in 4m1s
Project CI / Frontend tests (pull_request) Successful in 2m5s
Project CI / Native shell tests (pull_request) Successful in 6m7s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 10m0s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 10m3s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m52s
Project CI / Repository checks (pull_request) Successful in 2m17s
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/msg-queue-to-rust:feat/msg-queue-to-rust
git checkout feat/msg-queue-to-rust
Sign in to join this conversation.