From 225552fb321b1b735b8c0ceaa407f92505289a42 Mon Sep 17 00:00:00 2001 From: _Kerman Date: Sun, 26 Jul 2026 22:08:35 +0800 Subject: [PATCH] fix(tui,tool-tasks): finish removing dispose-ness from delivery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TUI's referenced-prompt snapshot now rides the prompt's own admission transaction instead of a pre-admission inject: while idle, a one-shot prepended agent/prompt-submit wrapper appends the snapshot to the allow decision's additionalContexts, so a blocking hook discards the prompt and its attached context together instead of stranding the snapshot in history for the next unrelated prompt. A prompt discarded before admission releases the wrapper; steering keeps the inject path since it bypasses admission and drains at the same boundary. The session-reference snapshot adapter pinned the old context-before-prompt order; the branch-wide order (prompt first, its contexts after) is now asserted and the fixture re-recorded. tool-tasks drops the last consumer of the removed thrown-disposed contract: completion notices now inject unconditionally, which is well-defined during owner teardown — the loop treats disposal like any cancel, so the notice appends as durable idle context (persisted for resume while the session is attached, dropped with the detached log after). README pair and the owner-disposal tests state the new delivery contract. --- packages/tasks/tool-tasks/README.i18n.yaml | 4 +- packages/tasks/tool-tasks/README.md | 2 +- packages/tasks/tool-tasks/README.zh.md | 2 +- packages/tasks/tool-tasks/src/index.ts | 25 ++-- .../tasks/tool-tasks/tests/tool-tasks.spec.ts | 18 +-- packages/ui/tui/src/index.ts | 66 +++++++++-- .../tui/tests/session-reference.snapshot.ts | 7 +- .../snapshots/session-reference.expected.txt | 14 +-- packages/ui/tui/tests/tui.spec.ts | 110 +++++++++++++++++- 9 files changed, 196 insertions(+), 52 deletions(-) diff --git a/packages/tasks/tool-tasks/README.i18n.yaml b/packages/tasks/tool-tasks/README.i18n.yaml index af141a1a2b..efa174ffae 100644 --- a/packages/tasks/tool-tasks/README.i18n.yaml +++ b/packages/tasks/tool-tasks/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write -README.md: 70c0c7da6ef17129241902d37359dd58b6d56605 -README.zh.md: 3ad8d8897ab348832b0d357436a0e78bf98c429b +README.md: 276ca3f8284b366bee54e585297c3a033a65c8d1 +README.zh.md: f4d61b23c1b90e24591efd6773ffe9f9c46c2b4b diff --git a/packages/tasks/tool-tasks/README.md b/packages/tasks/tool-tasks/README.md index 70c0c7da6e..276ca3f828 100644 --- a/packages/tasks/tool-tasks/README.md +++ b/packages/tasks/tool-tasks/README.md @@ -18,7 +18,7 @@ When a producer supplies `outputLimitBytes`, `task_output`, terminal `task_kill` ## Completion notices -An unreported completion injects `background task (: