Skip to content

task-signal-sync: MECE 完成信号检测(commit/verify/authorization)→ 提醒同步 tasks - #6

Closed
agnitum2009 wants to merge 8 commits into
openpi-dev:mainfrom
agnitum2009:feat/commit-task-sync
Closed

task-signal-sync: MECE 完成信号检测(commit/verify/authorization)→ 提醒同步 tasks#6
agnitum2009 wants to merge 8 commits into
openpi-dev:mainfrom
agnitum2009:feat/commit-task-sync

Conversation

@agnitum2009

@agnitum2009 agnitum2009 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

multi-signal-sync: MECE 五类完成信号(A commit/B verify/C authorization 自动检测 + D/E 收口纪律),dual-channel(footer setStatus 驻留 + context 注入 agent 不可忽略)。A/B/C 三信号验证通过(notify 确认触发)。v5 footer 驻留显示。

agnitum2009 pushed a commit to agnitum2009/openpi that referenced this pull request Aug 12, 2026
更新 commit-task-sync-implementation.md:
- v1 ui.notify + v2 context injection 演进
- 双通道验证(user TUI ✅ + agent context injection ✅)
- tsc TS2769 修复(event 类型推断)
- openpi hook 机制发现(pi.on tool_result/context + post-edit/injectTaskProjection 范本)
- pi.on 可用事件清单
- PR openpi-dev#6(tt-a1i/openpi)
- 结论:tasks 残留从靠记忆力变机制强制提醒
@agnitum2009 agnitum2009 changed the title commit-task-sync: detect git commit → remind agent to sync tasks (dual-channel) task-signal-sync: MECE 完成信号检测(commit/verify/authorization)→ 提醒同步 tasks Aug 12, 2026
pi-agent added 7 commits August 12, 2026 13:41
tasks 残留根因(遗忘+机制不全)→ commit-task-sync hook 尝试:
- extensions/commit-task-sync/index.ts:pi.on(tool_result) 检测 bash git commit 成功 →
  pi.on(agent_settled) ctx.ui.notify 提示 agent 同步 tasks(仿 post-edit,fire-and-forget)
- tsc 通过(exit 0)
- docs/knowledge-base/:obsidian vault(residual-root-cause + hook-design + implementation)
- 发现:openpi 有 pi.on(tool_result) 事件(PostToolUse 等价)
双通道提醒:
1. agent_settled → ui.notify(TUI/业主,建议性)
2. context → injectCommitReminder(对话/agent,强制——注入 <commit-task-sync> 块到下轮 messages)
context injection 仿 injectTaskProjection(tasks/index.ts:483 pi.on(context) return {messages})。
commit 检测后下轮注入提示+reset(仅提醒一次)。agent 不能忽略(在对话上下文)。
tsc 通过。
更新 commit-task-sync-implementation.md:
- v1 ui.notify + v2 context injection 演进
- 双通道验证(user TUI ✅ + agent context injection ✅)
- tsc TS2769 修复(event 类型推断)
- openpi hook 机制发现(pi.on tool_result/context + post-edit/injectTaskProjection 范本)
- pi.on 可用事件清单
- PR openpi-dev#6(tt-a1i/openpi)
- 结论:tasks 残留从靠记忆力变机制强制提醒
升级 commit-task-sync(单信号 A)→ multi-signal-sync(MECE 全场景):
- A commit(git commit exit 0,tool_result 检测)
- B verify(tsc/test/verify PASS exit 0,tool_result 检测)
- C authorization(user message 授权语,context 检测)
dual-channel:agent_settled ui.notify + context injectSyncReminder(<multi-signal-sync> 块)
D/E(无变更/取消)无信号 → 收口审计纪律(提醒文本已含)
第一性原理:tasks 完成 = 真实完成信号驱动,非 agent 记忆。
MECE:commit/验证/授权 三信号互斥穷尽(tool_result + context 可检测面)。
tsc 0错(TS2769 修复:event 类型推断)。
…ttled notify)

bug: context 注入时 reset signals → agent_settled notify 不触发(signals 被 context 消费后已空)。
fix: 两个通道独立——signals(context 注入,下轮消费)+ pendingNotify(agent_settled notify,本轮消费)。
addSignal 同时加到两通道;context 消费 signals(注入块);agent_settled 消费 pendingNotify(notify)。
…s Indicator)

问题:ui.notify 瞬时消失(业主看不到驻留)。
fix:agent_settled → ctx.ui.setStatus(footer 驻留状态,跨 render 持续显示——tui.md Pattern 4)。
- 信号轮:setStatus('multi-signal-sync', '⚠️ 完成信号(...)— 请同步 tasks') 驻留
- 下一轮(无新信号):setStatus undefined 清除
- 双通道:对话 context 注入块(agent 提醒)+ footer 驻留状态(user 持续看到)
tsc 0错。
MECE 五类信号(A commit/B verify/C authorization/D 无变更/E 取消)+ 演进(v1-v5)+ 验证记录(A/B/C 三信号 notify 确认触发)+ v5 驻留(footer setStatus)+ openpi 机制发现。
@tt-a1i
tt-a1i force-pushed the feat/commit-task-sync branch from 5662041 to 0245d93 Compare August 12, 2026 05:52
@tt-a1i

tt-a1i commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

OpenPI review — changes applied

P0 [fixed]

  • Removed the superseded commit-task-sync extension so commit events are not auto-loaded twice.
  • Made authorization detection once-per-user-message instead of once-per context call.
  • Reduced obvious false positives: quoted examples, git commit --dry-run, failed commands, and negated authorization no longer trigger.
  • Clear the persistent footer status during session shutdown.
  • Excluded the task reminder extension from Direct/Workflow child resources because children cannot use parent-owned tasks_* tools.
  • Rebased onto current main; Biome format/lint now pass.

Tests added

  • authorization idempotence and new-message retrigger
  • negated authorization
  • quoted examples / dry-run / failed verification
  • footer shutdown cleanup
  • parent-only child resource boundary

Verification

  • bun install --frozen-lockfile
  • bun run check
  • 600 Node tests and 29 Vitest tests
  • npm pack: 122 files; exactly one new runtime extension
  • git diff --check

P1 product decisions still open

  • Whether broad authorization/verification heuristics should ship always-on.
  • Whether this behavior belongs inside the existing tasks extension/config rather than a separate extension.
  • README/package-facing documentation is still absent; the added knowledge-base docs are not shipped by the npm allowlist.

I am not approving or merging; final read-only re-review is running.

@tt-a1i
tt-a1i force-pushed the feat/commit-task-sync branch from 0245d93 to d4a27c7 Compare August 12, 2026 06:02
@tt-a1i

tt-a1i commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Re-review update

The final P0 reviewer found two remaining heuristic false positives. Fixed at d4a27c7:

  • strip single/double/curly-quoted segments before command or authorization matching, including examples like echo "example; git commit"
  • reject additional authorization negations such as 未同意, while preserving a later genuinely new authorization turn

Regression tests added; full local gate remains green: 603 Node tests + 29 Vitest tests, Biome format/lint, TypeScript/Effect, frozen Bun install, pack allowlist, and git diff --check.

GitHub CI is not running yet because this repository requires workflow approval for first-time fork contributors (approval_policy: first_time_contributors). The PR should not merge until those workflows are approved and green. P1 product decisions from the prior comment remain open.

@tt-a1i

tt-a1i commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

方案结论:收敛到现有 tasks,不做完成信号推断

感谢这个 PR 抓到了真实问题:用户连续执行多个任务时,模型可能完成了工作,却没有及时调用 tasks_update,导致任务面板一直停留在旧状态。

我们进一步审计了当前 Codex CLI 0.147.0update_planHermes Agent 0.20.0todo 实现。两者的共同设计是:

  • task/todo 状态由模型通过结构化工具显式更新;
  • runtime 负责存储、恢复、约束和 UI 投影;
  • 不根据 commit、测试命令或用户的“同意/授权”措辞自动推断任务完成;
  • commit / test / authorization 最多是证据候选,不能代表某个具体 task 已完成。

因此我们不会沿着独立 multi-signal-sync 正则扩展继续扩大匹配规则。复合 Shell 命令的整体成功无法证明其中某条命令成功,授权文本也无法可靠绑定到具体 task;尤其 blocked → done 不是授权解除后的通用正确迁移。

接下来方案收敛为修改现有 extensions/tasks

  1. 强化模型协议:开始某项前标记 in_progress;每项产生结果后立即同步为 done / blocked / dropped;最终答复前对本轮涉及的 tasks 做一次对账。
  2. tasks_add / tasks_update 返回完整但有界的当前任务快照,让模型明确看到下一项及未收口项,而不只看到本次变更行。
  3. 保持证据语义:done 仍要求 task-scoped note,但任务记录只是声明;文件、Git、测试、工具结果和用户确认仍是真相,不自动改状态,也不阻塞正常 final answer。
  4. 增加“四个任务逐项执行、逐项更新、Widget 随每次 tasks_update 刷新”的自然语言 E2E 回归。
  5. 保持 parent-only 边界;Direct/Workflow child 不接收无法执行的 parent task 提醒。

所以:问题成立,当前实现方向不采用;我们会把有效目标整合进已有 tasks 状态机,而不是合并基于正则的旁路提醒扩展。 前面已经完成的 P0 修复和测试对厘清边界很有帮助,感谢贡献。

@tt-a1i

tt-a1i commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

已按前面讨论的方向实现替代方案:#7

新 PR 将修复收敛进现有 extensions/tasks:逐项 in_progress / 终态同步、final 前对账,以及每次 mutation 返回完整有界快照;没有 commit/test/authorization 正则推断,也没有自动 task mutation。

真实 Pi/model 四任务 E2E 已验证严格序列 add → start/done ×4,持久化 revision 1–9 逐次推进并在最后关闭批次。这个 PR (#6) 先保持打开,等 #7 CI/审查完成后再做最终 disposition。

@tt-a1i

tt-a1i commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

#7 已完成替代实现并通过 Node 22.19/24 全部 CI 与只读复审。关闭此 PR 作为 superseded;保留讨论和修复记录,感谢贡献。

@tt-a1i tt-a1i closed this Aug 12, 2026
@agnitum2009
agnitum2009 deleted the feat/commit-task-sync branch August 25, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants