Repository navigation
feat: end each quiet turn on an end token the acp layer drops - #32302
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Every item comes from the maintainer decision recorded on base ( Not checked: whether KAS stops adding its placeholder once history ends on What this change shipsInventory (6 items) — 6 justifiedIntent: stop the model re-writing the backend's quiet-end placeholder (billed text and false contract-violation warnings) while every surface looks as it does today. ADDITION, implementing a recorded decision.
[FIRST-PRINCIPLES-REVIEWED] 1626437 Description read[DESCRIPTION-READ] 0c2592a967db116d12d4bf40be4452639c337f44a8daaccba3257f038341ec7d That sha256 names the PR description this verdict read. Recompute it with |
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: |
|
self-added: no
[operator: bolichen97] |
|
self-added: no
[operator: bolichen97] |
70063ec to
b2b4f07
Compare
|
Rebased: main moved in The new head b2b4f07 also clears the Flake Pattern Ratchet red: the two added tests pass [operator: bolichen97] |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level concerns: one drop point that every caller of both turn loops goes through, as the 2026-11-07 decision entry asks for, with no per-backend branch and no hunk the description doesn't account for. Notes
[DESIGN-REVIEWED] 1626437 Description read[DESCRIPTION-READ] b9c2a2ae2392c17e505efc95548fd4a9f63cd1e742ff7f72fe639536d62ca72d 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: |
b2b4f07 to
a4ad1af
Compare
|
Rebased: main moved in The new head a4ad1af also clears the Backend Tests shard 5 red (Linux and Windows): this PR rewords [operator: bolichen97] |
|
self-added: no
[operator: bolichen97] |
|
Rebased: main moved in GitHub reported the previous head as conflicting, which is the one case this branch rebases for. Resolutions, keeping both sides:
Every added and removed line is byte-identical to the previous head; only context moved. Main still has the same four Retrospective on this head (the rounds view called for one): 13 mechanisms ruled, all kept, none removed, narrowed or reverted. Every review lane on the previous head was green; it only conflicted. resolution: kept -- this is the 4th push after three blocked heads, so the approach was re-examined before pushing again. No span has been fixed twice and no line-level finding is open: the three blocked heads were the merge-order block that waits on #32257, main's own red tests, and one run of CI API rate-limit failures, none of them a finding in this change. The code is therefore unchanged from the head that went green, and the only edit is the re-sync above. [operator: bolichen97] |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving at the maintainer's request.
|
Re-sync budget reset The GPT 6.1 lane found a real defect on 3ff5f6c: the quiet-end token hold in [operator: bolichen97] |
|
self-added: no
[operator: bolichen97] |
3ff5f6c to
0950e7a
Compare
|
Rebased: main moved in This rebase onto current main clears the merge conflict GitHub reported. Main reworded the Bot operating-mode text around the changed What was fixed: the GPT 6.1 finding on 3ff5f6c (the quiet-end token hold could grow without bound on whitespace). The hold is now capped at 64 characters, after which the text is released unchanged; its disposition is the comment above. Every other added and removed line is unchanged. Main's other edits sit beside this change: the four [operator: bolichen97] |
After nothing_to_do the model now replies with one fixed token, so the backend's history ends on an assistant message instead of a tool result and the backend stops inserting the placeholder the model kept copying. Kiro Crew drops that exact token where the model's text first arrives in both turn loops, so every surface sees the same empty reply as today.
|
Rebased: main moved in This rebase onto current main clears the merge conflict GitHub reported. The two What changed besides the rebase: #39413's new Bot patrol rule ended "Then write no text at all and end with Main's other edits to these files sit beside this change: apart from #39413, none of them names [operator: bolichen97] |
0950e7a to
1626437
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
I reviewed head 1626437 and checked that all four callers of the two ACP turn loops read their events through the new quiet-end token drop. The filter only holds text that could still turn into the token, caps the hold at 64 characters, and releases everything else unchanged, in order and with its message ids. On this head the new tests, the prompt goldens and hash pins, and the wider ACP client, runtime and session handle suites all pass. Removing the wraps makes the three new integration tests fail, so they test what they claim. I found no wrong behaviour, crash, security problem or data loss, and the superseding decision entry is already on main, so nothing blocks.
Problem / Motivation
Goal: A turn that ends on
nothing_to_doleaves the backend's history on a real assistant message, so the backend stops inserting its placeholder and the model stops copying it, while every Kiro Crew surface behaves exactly as it does today.Today the
nothing_to_doresult tells the model to write nothing. The backend's history then ends on a tool result, the backend fills the gap with its own self-describing placeholder on the next request, and the model reads it back and writes it again after later quiet ends. #19265 stopped the dashboard from showing that text, but the model still writes it: billed output on every quiet patrol cycle, oneTurn-end contract violationwarning per cycle, and saved copies that every later request carries (#27655 counted 190 in one backend session).Why it matters
Every quiet patrol, heartbeat or worker-report wake pays for text nobody reads, and the copies grow the backend's history until it compacts. The warning that exists to catch real contract violations fires on every quiet cycle, so it stops meaning anything.
Not a goal
nothing_to_do(QUIET_END_REFUSED_USER_TURNis unchanged) and keeps the recovery ladder.stream_chunks.pyandsteer_queue.pyare untouched).What changed (motivation → approach → change)
The maintainer decision on #19276 picks the token reply with the drop at the source: after
nothing_to_dothe model writes one fixed token, and Kiro Crew drops that exact token where the model's text first arrives, so no runner needs its own handling.QUIET_END_TOKENinsrc/kiro_crew/session_directive.pyis(quiet). Thenothing_to_doresult now says "Reply with exactly (quiet) and nothing else, and call nothing after this".acp/end_token.py:drop_end_tokenremoves a text segment (the text between two other events) whose stripped text equals the token. Chunks are held only while they are still a prefix of the token and total at most 64 characters, so a long run of whitespace is never held; anything else goes out unchanged, in order, with its message id. Every caller of the two turn loops reads them through it:stream_unsolicited(acp/client_turn.py),stream_commandand_dispatch_prompt_events(acp/client_turn_control.py) forAcpClient._dispatch_events, and_run_turn(acp/session_handle_turn.py) forAcpSessionHandle._dispatch_events. So prompt, agent-started and command turns on every backend pass through it. No tool-name check and no per-backend branch.mcp_tools/control_parts/schemas.py), the base prompt's turn-end contract (config/prompt.md), the Bot operating mode and the Bot's work-ledger patrol rule (crewmate_prompts.json), and the heartbeat prompt (dashboard/goal_reminder.py, which names the token).acp-client.mdgains "Quiet-end token drop";session.mdandmcp.mddescribe the end token.test/fixtures/crewmate_prompts/goldens (read withscripts/crewmate_prompt_preview.py) change only by the Bot operating mode and heartbeat wording above.Consumers do not change: with the token gone they see what they see today when the model writes nothing after the call. The dashboard runner records the quiet step with no late text and no contract-violation count; a refused quiet end still gets the ladder and Resume; the channel driver, cron (
empty_reply_placeholder), heartbeat (_No response._) and the worker-report wake read the same empty reply as before.The recorded turn-end decision this changes is superseded by the 2026-11-07 decision entry from #32257, as
docs/decisions/README.mdrequires.Backwards compatibility
Compatible: every consumer reads the same events as today unless a text segment is exactly
(quiet), which is what the model is now asked to write afternothing_to_do; a backend that does not write it behaves as it does today.Removes nothing: no key, route, field or function is removed, and any text other than the token passes through unchanged.
Tests
test/test_acp_end_token.py: the token alone, split across chunks and padded with whitespace is dropped; a segment padded past the 64-character hold bound is released unchanged; text that only starts like the token is released byte-identical, in order and with its message ids; each segment between other events is judged on its own (a token before a tool call is dropped and the call passes, a segment that stopped matching does not keep the next one from matching, a token prefix left at a boundary is released, a token at the end of the stream is dropped); a token-only prompt turn throughAcpClient.stream_eventsyields no text.test/test_acp_runtime_dispatch_tools.py::test_a_token_only_reply_after_a_tool_reaches_no_consumer: the same throughAcpSessionHandle.prompt.test/test_acp_client_agent_started_turns.py::test_an_agent_started_turn_that_is_only_the_end_token_yields_no_text: the same throughAcpClient.stream_unsolicited.test/test_nothing_to_do_directive.py: the tool result names the token.The consumers need no new test: they never see the token, and their empty-reply paths (the ladder on a refused quiet end, cron's
empty_reply_placeholder) are pinned bytest_a_person_s_turn_cannot_end_quietlyandtest_cron_silent_run_placeholder.pyas they stand.Determinism: no clock and no I/O race; the loop tests use the existing fake-frame harnesses. Ran the touched and neighbouring files at
-n 4(bindings, both turn loops, the session-handle suites, directive and prompt tests), and the new tests repeated and in reversed order.Manual verification
Still required, after merge: on an affected host (a crewmate DM on KAS), once its backend session next compacts, the
Turn-end contract violationcount per quiet cycle should drop to zero. That host's reporter is asked on #27655.Real-machine verification
Machine: Linux workstation, Amazon Linux 2023 x86_64, 32 vCPU / 123 GiB, Python 3.12.14
Before (main 12902fb):
python -m pytest -n0 -q -p no:randomly -p no:cacheprovider test/test_rmv_quiet_end.py(withPYTHONPATHset to an export of that commit'ssrc), a two-test probe copied in for the run (thenothing_to_doresult names(quiet); a prompt turn throughAcpClient.stream_eventswhose only reply is(quiet)yields no text) ->2 failed: the result says "Write nothing and call nothing after this", and the consumer receives['(quiet)']After (this patch on that main, tree 508bec271e89): the same command ->
2 passedCleanup: the probe was deleted from the checkout (
git status --shortempty) and the base export removedRelated Issues
Closes #19276
Decision: #19276 (comment)
Superseding decision entry: #32257
Related: #27655, #19265
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits