feat: thread poke — resume head step with supplementary prompt (Phase 1) #144

Closed
opened 2026-06-07 04:57:25 +00:00 by xiaoju · 0 comments
Owner

动机

协调者需要在 step 完成后给 agent 追加指令,更新当前 step output,不触发 moderator 重路由。

#142 拆出

这是 #142 的 Phase 1,最小 MVP。#142 整体太大,Claude Code 两次超时(121 turns / 73 turns 没完成)。

命令

uwf thread poke <thread-id> -p "reviewer 漏检了 X,请补充"

语义

  • Resume head step 的 agent session,发补充 prompt
  • 输出覆盖当前 step(prev 指向原 head 的 prev)
  • Moderator 不重新跑 — poke 不改变 thread 路由状态
  • completedAtMs 更新
  • --agent 可选,默认从 step detail 读上次用的 agent

约束

  • 只能 poke 最新 step(head)
  • Thread 必须 idle(非 running/completed/cancelled)
  • Head 必须是 StepNode(不能 poke 只有 StartNode 的 thread)

影响范围

  • packages/cli/src/commands/thread.ts — 新增 cmdThreadPoke
  • packages/cli/src/cli.ts — 注册 thread poke 子命令
  • packages/util-agent/src/run.ts — 可能需要暴露 spawnAgent 给 poke 复用

测试要点

  1. CLI 参数解析(-p 必填,--agent 可选)
  2. 错误:不存在 / running / completed / 只有 StartNode
  3. 成功 poke:output 更新、completedAtMs 更新、head 变化
  4. 不触发 moderator 重路由
  5. --agent 覆盖 vs step detail 默认
  6. poke suspended thread 也可以(poke ≠ resume)
  7. 失败回滚(agent 报错时恢复原 head)

参考

#142 第二轮 Claude Code 已写出完整 cmdThreadPoke(638 行,在 .worktrees/fix/142-thread-poke-step-ask),可作为参考。

小橘 🍊(NEKO Team)

## 动机 协调者需要在 step 完成后给 agent 追加指令,更新当前 step output,不触发 moderator 重路由。 ## 从 #142 拆出 这是 #142 的 Phase 1,最小 MVP。#142 整体太大,Claude Code 两次超时(121 turns / 73 turns 没完成)。 ## 命令 ``` uwf thread poke <thread-id> -p "reviewer 漏检了 X,请补充" ``` ## 语义 - Resume head step 的 agent session,发补充 prompt - 输出覆盖当前 step(prev 指向原 head 的 prev) - **Moderator 不重新跑** — poke 不改变 thread 路由状态 - `completedAtMs` 更新 - `--agent` 可选,默认从 step detail 读上次用的 agent ## 约束 - 只能 poke 最新 step(head) - Thread 必须 idle(非 running/completed/cancelled) - Head 必须是 StepNode(不能 poke 只有 StartNode 的 thread) ## 影响范围 - `packages/cli/src/commands/thread.ts` — 新增 `cmdThreadPoke` - `packages/cli/src/cli.ts` — 注册 `thread poke` 子命令 - `packages/util-agent/src/run.ts` — 可能需要暴露 `spawnAgent` 给 poke 复用 ## 测试要点 1. CLI 参数解析(`-p` 必填,`--agent` 可选) 2. 错误:不存在 / running / completed / 只有 StartNode 3. 成功 poke:output 更新、completedAtMs 更新、head 变化 4. 不触发 moderator 重路由 5. `--agent` 覆盖 vs step detail 默认 6. poke suspended thread 也可以(poke ≠ resume) 7. 失败回滚(agent 报错时恢复原 head) ## 参考 #142 第二轮 Claude Code 已写出完整 `cmdThreadPoke`(638 行,在 `.worktrees/fix/142-thread-poke-step-ask`),可作为参考。 小橘 🍊(NEKO Team)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/united-workforce#144