Repository navigation
fix(chat): apply the merge-card kept-prompt rule only on kiro-cli - #32470
Conversation
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) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS This is a narrow fix for #23164. It only changes behaviour on harnesses outside kiro-cli and KAS, where a wrong guess now sends a merge card twice instead of losing it. What this change shipsInventory (3 items) — 3 justifiedIntent: keep a fork's merge card from being silently dropped on harnesses where nobody has checked the kiro-cli kept-prompt contract. FIX.
[FIRST-PRINCIPLES-REVIEWED] b33e737 Description read[DESCRIPTION-READ] 68a03c72b9b7f9dd213fc0f25f9967bce327a4c49b58d9998fedcfca7efba1f6 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The change only narrows when a card counts as consumed, so the worst outcome is a card sent twice, never one lost. Notes
[DESIGN-REVIEWED] b33e737 Description read[DESCRIPTION-READ] 21a2c5e1971ebf1c06fa871656a27581c0ccbd87ce2776e2d51e9889ac56499d 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: |
_merge_cards_reached_the_model consumed an unlanded turn's merge card when kiro-cli's kept-the-prompt contract said the native session held it, on every harness. No other harness has been checked against that contract. Read it only when the turn's client is kiro-cli, so any other harness consumes a card only on a landed turn and a wrong guess sends the card twice instead of losing it. Pin it per known backend in the harness-parity suite. Fixes #23164
215d741 to
3fe0c95
Compare
|
KAS runs the Kiro CLI pick and is the default backend, so dropping the kept-prompt clause there re-sent a merge card to a live session that already held it. Gate on kiro-cli or KAS; every other harness still consumes a card only on a landed turn.
3fe0c95 to
b33e737
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (3 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: the merge-card kept-prompt rule applies only on the kiro-cli and KAS backends; with a parity test. Spec files changed as a ride-along (a minority of the diff on both file count and changed lines), not reviewed as a design decision: docs/system-specs/modules/session.md.
bolichen97
left a comment
There was a problem hiding this comment.
Approving b33e737 as maintainer. 98 checks pass. Fixes #23164.
About the one red check: the helper job "rerun / Re-run Sensitive Change Review" fails because it found no Sensitive Change Review run to rerun for this head. Sensitive Change Review itself passed on this same head at 17:44 UTC, so the helper's red does not block. We treated the same helper red the same way on #32279 today. I reran the helper once and it failed the same way.
What I checked:
_merge_cards_reached_the_modelnow counts the "kept the prompt" clause only when the provider is kiro-cli or KAS (is_kiro_backend/is_kas_backendexactlyTrue). Any other harness consumes a merge card only on a landed turn, so a wrong guess there repeats the card instead of losing it.- A landed turn, and the
_native_session_lacks_the_promptguard, are unchanged for every harness. - The new parity test runs the same unlanded
end_turnturn on every known backend and expects consumption only for the Kiro family. The session spec row says the same.
Auto-merge is already set by another maintainer, so I am not setting it.
Problem / Motivation
Goal: A merge card on a harness other than kiro-cli is never lost because of a kiro-cli-only rule; at worst it is sent twice.
_merge_cards_reached_the_model(src/kiro_crew/dashboard/chat_turn/turn_stats.py) stamps a merge card consumed for a turn that did not land when_kiro_cli_kept_the_promptsays the native session kept the prompt. That is kiro-cli's contract (it appends a prompt to its session log once the model has answered it), but the rule ran for everyagent.acp_backend. A harness that drops such a prompt would lose the card.Why it matters
The merge card's context is the only copy of what a fork added that reaches the parent's agent. On a harness nobody checked against the kiro-cli contract, a lost card silently drops the fork's work from the parent chat.
Not a goal
chat_turn/prompt_assembly.py, which also reads_kiro_cli_kept_the_prompt. It is not a merge card and is outside Merge-back: limit the merge-card consumption rule to named backends #23164._native_session_lacks_the_prompt: a landed turn consumes on every harness (otherwise a card would repeat forever), and the "lacks" rule only ever restores a card.What changed (motivation → approach → change)
Symptom: an unlanded turn's merge card can be stamped consumed on a harness whose session may not hold the prompt.
Cause: the kept-prompt clause in
_merge_cards_reached_the_modelis applied without asking which harness ran the turn.Change: the clause counts only when the turn's client positively reports
is_kiro_backend is Trueoris_kas_backend is True(H5: identity is positive). KAS stays in because it is the default harness and runs the Kiro CLI pick; dropping it re-sent cards to a live session that held them (Opus review, round 1). Every other harness consumes a card only on a landed turn, so a wrong guess re-sends the card instead of losing it. The spec row indocs/system-specs/modules/session.mdsays so.Backwards compatibility
Compatible: kiro-cli and KAS behave exactly as before; other harnesses can only get a card one extra time, never one fewer.
Removes nothing: no key, path, record or function is removed or tightened; one consumption clause is narrowed to the harness it was written for.
Tests
test/test_harness_parity.py::test_merge_card_kept_prompt_rule_is_kiro_only, parametrized overACP_BACKENDS_KNOWN: an unlanded turn after a realend_turnconsumes its card on kiro-cli and KAS and keeps it on each other backend (claude, codex, copilot, deepseek, goose, opencode, pi, strands).test_chat_runner_coverage_merge_cards.py,test_chat_merge_back*.py,test_recovery_l1_chat_runner.py(337 passed).Proof: not provable -- other: prove.py stops at BASELINE_RED on this host, where two untouched tests in test_harness_parity.py fail on an enterprise platform profile; a manual revert of the production gate fails 8 of the 10 new cases (every backend outside kiro-cli and KAS), and dropping KAS from the gate fails the kas case.
Manual verification
N/A — unit coverage sufficient: the change is one boolean clause, pinned per backend.
Related Issues
Deferred from #17165. Part of #3816.
Fixes #23164
Sibling sweep
Swept: git grep -n "_kiro_cli_kept_the_prompt(" -- src/
Sibling: src/kiro_crew/dashboard/chat_turn/turn_stats.py:429 -- changed here
Sibling: src/kiro_crew/dashboard/chat_turn/prompt_assembly.py:1266 -- not affected -- first-turn history settle, not a merge card; listed under Not a goal
Pattern harvest
Rule candidate: review-prompt
Pattern: a helper named for one harness's contract (
_kiro_cli_*) called on a path that runs for everyagent.acp_backendwithout a positive identity check.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.