Repository navigation
feat(chat): nothing_to_do directive ends a quiet turn without recovery - #16429
Conversation
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The channel driver's new "skip the notice after a quiet end" branch can never fire: every channel call to Not justified as shipped
What this change shipsInventory (10 items) — 7 justifiedIntent: let a patrol, cron or wake turn that found nothing end with no message bubble and no recovery cards. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 01cab5c Description read[DESCRIPTION-READ] 7707a009f543cb5f0ac3f6fd47fc2238051e81602873695d9925ed12e91ade28 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The rule that a turn a person opened can't end quietly relies on Watch
Suggestions
[DESIGN-REVIEWED] 01cab5c Description read[DESCRIPTION-READ] 9af6416cef6ee655db91474d61a9ddb2411043f169b8d1f936f070b287070ec6 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
UX Review (Opus 5.5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS When the quiet end is refused, the card still says "Nothing to report" with a green check, while its output says "Error". A first-time reader can't tell whether the step worked. Watch
Suggestions
[UX-REVIEWED] 01cab5c Description read[DESCRIPTION-READ] a264f5058528bc54a25662098c87508dabb7d5a7f2bf9d8641d9b6fb6c01ab12 That sha256 names everything this verdict read: the PR description, plus the 9 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
de8ed82 to
27781a2
Compare
|
/ai-review override first-principles 27781a2: Maintainer decision, recorded on issue #16392 (2026-10-03): the turn-end contract (closing text or nothing_to_do, never a bare tool stop) is the product shape for every agent, so quiet patrol cycles stop producing recovery cards and noise bubbles. No RFC will be written for it; the issue thread and the session/mcp specs updated in this PR are the record. |
Human judgment recorded@CrysisDeu marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
27781a2 to
69f8874
Compare
|
/ai-review override first-principles 69f8874: Maintainer decision recorded on issue #16392 (2026-10-03): the turn-end contract (closing text or nothing_to_do, never a bare tool stop) is the product shape for every agent, so quiet patrol cycles stop producing recovery cards and noise bubbles. No RFC will be written; the issue thread and the session/mcp specs updated in this PR are the record. Same override as on the pre-rebase head 27781a2. |
Human judgment recorded@CrysisDeu marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
65aa5a0 to
c23822c
Compare
|
/ai-review override first-principles c23822c: Maintainer decision recorded on issue #16392 (2026-10-03): the turn-end contract (closing text or nothing_to_do, never a bare tool stop) is the product shape for every agent, so quiet patrol cycles stop producing recovery cards and noise bubbles. No RFC will be written; the issue thread and the session/mcp specs updated in this PR are the record. Same override as on 65aa5a0. |
Human judgment recorded@CrysisDeu marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
c23822c to
b40964d
Compare
|
This adds a new nothing_to_do directive so a quiet tool-only turn can end with no bubble and no recovery card. It also replaces the prose match on QUESTION_CARD_SHOWN_PREFIX with a structured signal. HOLD for three reasons. The PR is CONFLICTING with main (mergeable=dirty, "merge conflict" label). It is a large new feature and agent-contract change (+1706/-116 across 33 files, including chat_runner.py, session_directive_apply.py, the messaging driver and prompt.md). And its UX lane is still at CONCERNS: a refused quiet end shows a green check and "Nothing to report" while the step output says Error. I did not do a line-level review because the head cannot merge as it stands. Please rebase onto main, resolve the conflicts, answer the UX concern on the new head, and get a maintainer to accept the new directive. — crew-pr-reviewer |
A crewmate patrol turn that ran its checks and found nothing to report had no sanctioned way to end: a closing text is a noise bubble the product rule forbids, and stopping bare after a tool reads to the runner as a failed generation (continue nudge, then a give-up card). The only silent exit was a shown ask_question card, detected by matching the applier's outcome prose. Turn-end contract (issue #16392): after its tool calls a turn ends with a closing text or with `nothing_to_do`, never by stopping bare. The new kirocrew-core directive takes an optional one-line `note`, needs no surface, slot or provenance gate (a cron wake or patrol cycle with nothing to report is its designed caller; it mutates nothing), and its applied outcome on the tool card is the inspectable record that the turn ended on purpose. No assistant bubble, no notice card, no continuation. The terminal-turn signal is now structured, as #9324 asked: `apply_session_directive_outcome` returns `DirectiveOutcome(text, ends_turn)`, set only where the effect landed (a card a client renders; a quiet end recorded) and never derived from the outcome text. The dashboard runner reads it to skip the empty-response ladder, and `ask_question` is moved onto the same signal; the channel driver reads the consumer's `True` and owes the thread no empty-turn notice. A bare tool stop keeps today's recovery, which is what makes `nothing_to_do` the only silent exit. Activity after the directive is counted and reported once as a privacy-safe WARNING, never re-arming recovery. The base prompt states the contract and describes the tool. Specs: docs/architecture/mcp.md, docs/system-specs/modules/session.md, docs/system-specs/modules/messaging.md.
A `nothing_to_do` turn ends on its tool row, so its transcript tail (`[user|nudge, tool…]`) is shape-identical to a gateway that died mid-turn: the composer offered Resume and the sidebar flagged the session as interrupted on every quiet patrol cycle. `is_turn_interrupted` and its frontend mirror `selectTurnInterrupted` now treat the applied directive's tool row as a terminator like the Stop card, matched on the row's persisted trusted identity (`meta.tool_name` + `meta.mcp_server`), never on its title, so a shell command printing the name cannot close a turn. The runner's own recovery cards (continue, give-up, post-compaction resume) now carry `meta.kind = "empty_turn"`, and the Crewmate chat drops a notice row by that tag, never by its words: a person reading a crewmate has nothing to do with the runner's recovery, while an untagged notice (an automation arm refusal) still draws. The Sessions page is unchanged. Review round (bolichen97): the applier's ONE gate is who opened the turn. A monitor wake or a headless producer may end quietly; a turn a person opened (a user-facing dashboard turn, or any channel turn, since the channel driver cannot yet tell a human from a loop's wake) is REFUSED, so a model that dodged a question fails visibly through the ladder, Resume and the channel notice. The runner stamps `meta.ends_turn` on the applied directive's row (persisted and patched live), and the interrupted-turn scan on both ends requires that flag plus the trusted identity, and only when the row is the turn's last tool row. The two conductor grant tuples gain `@kirocrew-core/nothing_to_do` (and the byte-pinned spec goldens move with them); a parity test pins the frontend mirror's constants to the backend's. On a channel turn the quiet end silences only a CLEAN close: a refusal or an `error:` terminal after the directive keeps its empty-turn notice, since that fault is still the user's to hear. Also: the two runner imports that lost their last caller are removed (and dropped from the composition baseline), the test module no longer narrates issue numbers, and `website/scripts/capture-nothing-to-do.mjs` is the fixture-driven harness behind the PR's screenshots.
|
This merged while I was finishing a review. The directive itself checks out (provenance gate, ends_turn stamp, last-tool-row rule and fault terminals are all mutation-pinned). One remaining issue is still true on main: the Crewmate chat now hides every |
Problem / Motivation
Goal: a crewmate (or any agent) turn that ran its checks and found nothing the user needs to read can end quietly — no bubble, no recovery card — by calling
nothing_to_do.Today a tool-only turn that stops with no text has no sanctioned ending. The product rule for the crewmate DM thread is "surface only what needs a human", so a closing "nothing new" bubble is noise; but stopping bare after a tool reads to the dashboard runner as a failed generation: it posts an
ℹ️ The turn ended without a closing reply — continuing once…card, injects a synthetic continuation, and on the second empty turn posts a give-up card. In the reproduction on #16392 the turn did not even reach that ladder — the chat sat on the thinking indicator until the user typed. The only silent exit was a shownask_questioncard, and the runner detected it by matching the applier's outcome prose (QUESTION_CARD_SHOWN_PREFIX), which #9324 asked to replace with a structured signal.Why it matters
Every quiet patrol cycle, cron wake and "checked, nothing changed" turn today either spams the thread with a status bubble the product forbids, or costs a recovery turn plus two notice cards that read as a crash. Members whose whole job is to patrol quietly cannot do it without one or the other.
Not a goal
nothing_to_dothe only silent exit).What changed (motivation → approach → change)
Decision recorded on #16392 (Zezhen, 2026-10-03), the turn-end contract: after its tool calls, a turn ends in exactly one of two ways — a closing text, or a
nothing_to_docall — never by stopping bare after an ordinary tool. The contract makes the existing ladder the enforcement and the new tool the only sanctioned silent exit.Approach: build
nothing_to_doas a session directive likeask_question(stateless tool → marker → consumer applies to its own session), and make the "this directive ended the turn" fact structured instead of a prose match, so both terminal directives ride one signal.session_directive.DIRECTIVE_TOOLSgainsnothing_to_do;validation.NOTHING_TO_DO_SCHEMA(one optionalnote, clamped likeautonudge_stop.reasonso a long note never costs the quiet end);mcp_tools/control.pydescriptor + handler; titleEnd turn quietlyindata/mcp_tool_titles.json.dashboard/session_directive_apply.py: newDirectiveOutcome(text, ends_turn)andapply_session_directive_outcome(...);TERMINAL_DIRECTIVES = {ask_question, nothing_to_do}.ends_turnis set only where the effect landed — a card a client renders, a quiet end recorded — and_outcome()forces it False on anyError:text.apply_session_directivestays as the text-only entry._nothing_to_dohas ONE gate — who opened the turn: a monitor wake (producer_is_self_wake) or a headless producer (cron, crew, app, task runner) may end quietly; a turn a person opened (user-facing dashboard turn, or any channel turn, since the channel driver cannot yet tell a human's message from a loop's wake) is REFUSED (QUIET_END_REFUSED_USER_TURN,ends_turnFalse), so the ladder, Resume and the channel notice run as before and a model that dodged a question fails visibly. No slot or surface gate otherwise (it mutates nothing a wrong identity could misdirect); sub-agent isolation is the structural isolation every directive has.dashboard/chat_runner.py:_terminal_question_posted+ prefix match →_terminal_directive_applied, set fromDirectiveOutcome.ends_turn; the empty-response branch is skipped for such a turn (no notice, no continuation, no budget spent). Text or a tool call after the terminal directive is counted and reported once as a privacy-safe WARNING (Turn-end contract violation, counts + directive kind only); it never re-arms recovery, because that would turn the quiet end the model asked for into a notice card. The transcript's record is the tool card's applied outcome (Nothing new to report. <note>; declared pill titleNothing to report— no "turn", a word the UX review's blind reader could not place); no assistant bubble.messaging/driver.py+messaging/dispatch.py:DirectiveConsumermay answerTrue(the consumer returnsoutcome.ends_turn);TurnDriver.terminal_directive_appliedthen makes a CLEAN terminal owe noempty_turn_notice. Arefusalorerror:-family terminal after the directive keeps its notice (_is_fault_terminal) — that fault is still the user's to hear — and an exhausted stream still gets the unclosed notice, since that fault is the transport's.chat_turn/directives.py: not-applied outcome line for the new kind.chat_runner.pykeepsQUESTION_CARD_SHOWN_PREFIXandapply_session_directivebound (the runner's base-names ratchet intest_chat_runner_composition_contract.pymay only tighten), even though the turn loop itself consumes the structured outcome.agent.py:_CONDUCTOR_CORE_GRANTSand_PIPELINE_CONDUCTOR_CORE_GRANTSgain@kirocrew-core/nothing_to_do, so a quiet patrol cycle never trades a noise bubble for an approval prompt;agent_materialization/conductor_agents._HISTORY_CORE_VERBSlists it too (main's new shipped-grant history: every grant an installer writes must be named there); the byte-pinned spec goldens (test_agent_refactor_spec_bytes.py,test_agent_refactor_contracts.py) move with them.dashboard/state.py+website/src/store/chat/selectors.ts: an APPLIED quiet end is a FINISHED turn for the interrupted-turn scan. The runner stampsmeta.ends_turn = Trueon the applied directive's tool row (persisted, and patched live overchat_message_update) — scoped like the mcp-app flag beside it: only a row THIS turn wrote (_rows_before_turn) and only when the id names one call (_tcid_identifies), so a transcript-preserving reset that reuses an earlier turn'stool_call_idcannot rewrite that older refused row into an applied one; the scan requires that flag plus the trusted identity, and only when the row is the turn's LAST tool row (a later tool row means the model kept working past it, and a gateway that died there must not hide behind it). A refused call carries the identity and no flag. Its tail ([user|nudge, tool…]) is shape-identical to a gateway that died mid-turn, so without this every quiet patrol cycle offered Resume and flagged the session as interrupted in the sidebar.is_quiet_end_row/isQuietEndRowmatch the applied directive's tool row on its persisted TRUSTED identity (meta.tool_name+meta.mcp_server, the backend's_meta.kirofields), never on its title, so a shell command printing the name cannot close a turn. (Found while taking the screenshots below — the "before" frame still offers Resume.)chat_utils.EMPTY_TURN_NOTICE_KIND+components/chat/crewmateBubbles.ts: the ladder's own cards (continue, give-up, post-compaction resume) now carrymeta.kind = "empty_turn", and the Crewmate chat drops anoticerow by that tag — never by its words. A person reading a crewmate has nothing to do with the runner's recovery; an untagged notice (an automation arm refusal) still draws because it may need them. The Sessions page keeps drawing the cards. This closes the "before" crewmate frame below for good: even a turn that violates the contract no longer puts those two cards into the crewmate's chat.config/prompt.md: the tool bullet next toask_question, and the turn-end contract under Rules (all surfaces).docs/architecture/mcp.md(directive list, terminal-signal paragraph),docs/system-specs/modules/session.md(ladder: terminal directive is not an empty turn),docs/system-specs/modules/messaging.md(verdict table row, consumer contract).No RFC exists for this product-shape change; the decision and its triage live on #16392. If the First Principles lane blocks on that, it needs the maintainer override.
Backwards compatibility
Compatible:
apply_session_directivekeeps itsstrreturn;DirectiveConsumer's awaited type widens fromNonetoAnyand an older consumer returningNoneis judged exactly as before (pinned bytest_an_older_consumer_returning_none_keeps_the_verdict);QUESTION_CARD_SHOWN_PREFIXis still exported and still the card's wording — only the runner no longer branches on it.Removes nothing: no key, path, record or public function is removed or renamed;
nothing_to_dois additive and every existing directive applies as before.Tests
test/test_nothing_to_do_directive.py(new, 22 tests):note, oversized note clamped not refused,TERMINAL_DIRECTIVES ⊆ DIRECTIVE_TOOLS, every directive has a not-applied line.nothing_to_do→ends_turn=Truewith slot, slot-less (channel) and headless producer;ask_questionshown → True, dropped (0 clients) → False, refused → False;Error:text never ends a turn; string entry returns text only; unknown kind is a structured error.True+ clean close → no empty-turn notice;refusal/error:*after the directive → notice kept;None→ verdict unchanged; forged marker under a shell tool sets nothing; flag resets perrun()._run_chatwith the real applier: a shell tool +nothing_to_do+end_turnqueues no recovery, spends no budget, renders no notice and no assistant bubble, and the tool card carries the quiet line with the note (marker stripped); the same turn without the directive is recovered (counterfactual); text after the directive logs the WARNING with no model text in it and still re-arms nothing.test_nothing_to_do_directive.py: a person's turn +nothing_to_do→ refused, recovery re-armed, noends_turnflag,is_turn_interruptedTrue (the blocking review item); wake / headless / self-wake-on-user-slot → applied; channel → refused; the applied row carriesends_turnand a live patch;QUIET_END_TOOL/QUIET_END_SERVERpinned againstselectors.ts; an older refused row sharing the new call's id is not stamped (fails without the guard).crewmateBubbles.test.ts: a tagged recovery card is dropped from the crewmate chat; the same words untagged, and a differently tagged notice, still draw.test_nothing_to_do_directive.pyasserts every card the ladder writes carries the tag.test_to_dict_board_fields.py+website/src/test/chatSlice.continuable.test.ts: a quiet-end tail is not interrupted; a shell row whose title names the tool, and the right name on a foreign server, still are.test_session_directive.py(case table),test_directive_refusal_not_lost_marker_8635.py(hostile-call row), and the spies intest_acp_tool_identity.py,test_session_directive_input_digest.py,test_discord_resumed_busy.py,test_driver_session_directives.pynow patchapply_session_directive_outcomeand return aDirectiveOutcome.Run locally once (files touched only): the new module plus the nine directive/runner/driver/MCP test files above, all green;
black/isort/flake8on the touched files,mypy --platform linux src/kiro_crew,scripts/docs-lint.shclean. Full suites are CI's.Manual verification
Screenshots below come from the REAL built SPA (
website/dist) with every/api/**call answered from fixtures (website/scripts/capture-nothing-to-do.mjs, same shape as the other transcript harnesses) — no gateway, no agent. The fixture rows are exactly what the backend persists for such a turn (a shell tool row, then the@kirocrew-core/nothing_to_dotool row whosemeta.outputis the applier's quiet line), and the "before" rows are the two notice cards main writes for the same turn with no directive. The harness also asserts the page text: after = quiet line present, no notice, no Resume; before = notice present, Resume offered. A live-gateway run is still owed (the Dev Fleet pod for this worktree answeredrepo_unavailablefrom this session); the real-runner tests above drive_run_chatwith the event stream a live call produces.Screenshots / video
Sessions page — the same patrol turn. After: the directive's tool row expanded to its quiet line; no bubble, no card, the composer offers Send. Before (main): two
ℹ️recovery cards and a Resume button.Two more Sessions frames the UX review asked for: the quiet-end row as it ships when the model gives the call no purpose line (the pill falls back to the declared title
Nothing to report), and the REFUSED case — a person opened the turn, the model still callednothing_to_do, the applier refused, the ladder ran its two cards, and the composer offers Resume.Crewmate page — the crewmate's earlier reply, then a monitor wake that found nothing. After: the chat is unchanged (tool rows are machinery there). Before (main): the two notice cards are drawn into the crewmate's chat — main's untagged rows; with this PR the runner tags them and the crewmate chat drops them.
Related Issues
Fixes #16392. Implements the structured terminal-turn signal from #9324 for the two terminal directives (the rest of that inventory stays open there). Hang observation recorded on #14238. Related: #11237.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)