Repository navigation
feat: show the KAS session recap when a chat is reopened - #9314
jingchaodev wants to merge 1 commit into
Conversation
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The new Session recap setting is off by default and adds a second "where you left off" surface beside the existing session-summary panel. That overlap is a note, not a blocker. Notes
What this change shipsInventory (6 items) — 5 justifiedIntent: show a returning user, before they type, where a reopened KAS chat left off. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] cd48304 Description read[DESCRIPTION-READ] db62e4c95edbcadd7364e1f30fbeac4dd246d315b7545c43f89b435690fd58df That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The committed screenshots show the new toggle and the recap row in both themes. No first-time reader has looked at them, which is a limit of the fork lane; pushing the branch to this repository runs that read. Notes
[UX-REVIEWED] cd48304 Description read[DESCRIPTION-READ] 4a16f749d2b22fa8f0a6b8fb5db3d6a3ba0fa131b29f1c10fc5c0ab7e3c680bd That sha256 names everything this verdict read: the PR description, plus the 7 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 (fork) — ✅ no blocking findingsReviewed |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level blocker: the feature is off by default, removes nothing, and its rendered evidence is committed. Notes
[DESIGN-REVIEWED] cd48304 Description read[DESCRIPTION-READ] 92e427c5e93b9b3393054a313868499ba4b901d7d8823dd9dcf59e29792846c3 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 |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
f7d4ea0 to
23efb32
Compare
|
Round 2 — Design's timing finding fixed; both UX takeables taken (head 23efb32). FP ✅ PASS and Opus ✅ held on the first stamp.
Suites: 47/47 across mapping + chokepoint + drain; flake8/mypy-linux clean; single commit. |
23efb32 to
eb82a10
Compare
|
Round 3 (head eb82a10): the Harness Parity Gate caught a genuine H5 violation in round 2's drain helper — |
eb82a10 to
e8c3734
Compare
|
Round 4 — GPT's blocking finding fixed (head e8c3734):
|
e8c3734 to
5d00f96
Compare
|
Round 5 — FP's three items + subtraction taken; UX/Design headline dispositioned (head 5d00f96). GPT ✅ and Opus ✅ held on the round-4 head.
|
5d00f96 to
5e6ff9c
Compare
|
Round 6 — GPT's blocking finding fixed at both kill sites (head 5e6ff9c):
|
5e6ff9c to
445f2df
Compare
|
Round 7 (head 445f2df): the one CI red on 5e6ff9c was isort on |
445f2df to
3ca0981
Compare
|
Round 8 — FP's two accuracy items + UX's anchoring taken (head 3ca0981). GPT ✅ / Design ✅ PASS held on 445f2df.
|
3ca0981 to
8382020
Compare
|
Round 9 — Design's encapsulation item taken; the delivery-moment call stays with the maintainer (head 8382020). GPT ✅ and Opus ✅ held on 3ca0981.
|
|
Settled-round disposition (head 8382020): the round settled 64 green / 1 red. The red — Backend Tests (Windows) (4) — is |
8382020 to
8851872
Compare
|
Rebase to clear the flake-red X (head 8851872): the single red on the previous head was a 1-in-20925 Windows flake in |
|
Rebased: main moved in
The fork CI runs need a maintainer to approve them. |
|
The fork Opus 5.5 lane did not review The other four lanes passed on this head: GPT 6.1 (no blocking findings, so the off-loop fix is accepted), First Principles, Design and UX. Backend tests are still running. |
|
Hi @buluoray @dodgeblaster @iamwhatever, could you please take a look at this one when you get a chance, it's green now on What's left needs a maintainer:
|
|
Rebased: #21930 on main conflicted in
The fork CI runs need a maintainer to approve them. The review ask in this comment still stands. |
|
Rebased: #20487 on main conflicted in
The fork CI runs need a maintainer to approve them. The review ask in this comment still stands. |
|
Rebased:
The fork CI runs need a maintainer to approve them. The review ask in this comment still stands. |
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 20% chance that this change introduces a defect, above the 12% limit for approving on its own. The PR adds an opt-in setting, agent.session_recap (off by default), that sends KAS's sessionRecap opt-in at initialize and shows the recap KAS replays during session/load as one "Where you left off" status row when a chat is reopened through the resume prefetch. Verified in code: off changes nothing in the handshake. The flag reaches all three runtime spawns in acp_runtime_start, ChatRuntimeKey and chat-share placement, and the factory rebuild path. The recap held during the load window is KAS-only, bounded, redacted and cleared on unregister and death. A recap sent after a turn is dropped in the pre-turn drain without counting as a leftover frame. No wrapper provider hides take_session_recap: AcpProvider and AcpSessionProvider are the only LLMProvider subclasses. The recap kind is in both notice-kind lists, so the history scans skip it. last_turn_ts keeps main's calculation except that it skips recap rows. The PATCH is strict boolean, and change cards class the setting as unable to widen. Tests cover each behaviour. No blocking defect found. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for the careful work here. One defect in code this PR adds needs a fix before this can move on.
kiro_crew/dashboard/chat_turn/eager_spawn.py:1141(_surface_resume_recapcalling_append_recap_noticeinkiro_crew/dashboard/chat_utils.py:481). Trigger:agent.session_recapis on, and the user focuses an older KAS chat that has had a turn since its last recap. Outcome: the recap is written as a durable assistant row stamped with the current time.summarize_rows(slot_row_memo.py:132) takeslast_tsfrom the newest non-transient row and does not skip notices, andslot_projection.py:392setslast_turn_ts = last_tsfor an idle slot. The sidebar sorts, labels, groups by date and tints bylast_turn_ts(website/src/pages/chat/sessionOrder.ts:103says this key moves only when a prompt arrives or a turn ends). So just opening a days-old chat moves it to the top, under "Today", stamped "just now", with no turn run. The row is persisted, so the wrong order survives a gateway restart. Rider 2 calls the fix outside this PR. But main has no row written on focus, so this PR is what causes the reorder, and a defect in code a PR adds is in scope for that PR. Smallest fix: have an idle slot'slast_turn_tsskip rows whose kind isrecap(leavelast_tsalone, since the unread watermark reads it), or stamp the recap row with the previous durable row'sts. Add a test that reopening a chat with the setting on leaves itslast_turn_tsand sidebar position unchanged.
After this is fixed, a maintainer still needs to rule on the open riders (three re-entry surfaces, and the per-turn cost) before this can merge.
Optional:
- Nothing pins the
self._session_inits_in_flightclause in the new reader-loop recap branch (runtime_reader_loop.py:714). Every recap test sets it to 1. A test that feeds a KAS recap with no init in flight and asserts_kas_load_recaps == {}would cover the refusal side. - Three new tests in
test/test_eager_spawn_resume_prefetch.py(around lines 229, 339, 356) cancel the prefetch TTL task without awaiting it, and two skip the cancel if an earlier assert fails. Usingtry: ... finally: await _cancel_prefetch_ttl(slot), as your two window-load tests already do, fixes both. - The second
redactin_append_recap_noticerepeats the redaction the normalizer already ran on the only path that reaches it. You could drop it and the local import, or keep it and stop calling the transcript an external surface in the docstring.
|
Answers to the review on
The open riders (the re-entry surfaces and the per-turn cost) still need a maintainer's ruling. The fork CI runs need a maintainer to approve them. |
|
Rebased: main conflicted with Main is red on mypy right now ( The fork CI runs need a maintainer to approve them, and the review answers are in this comment. |
|
Rebased: main's
The PR's own changes are the same, and every eager spawn test passes. Main's mypy red (#36458) is still open, and the fork CI runs still need a maintainer to approve them. |
|
Thanks for the follow-up. This re-review covers head 05c1fef and my earlier change request. Earlier items:
This adds a third recap surface on return, including in Bot threads where an accepted RFC says the warm brief is the only return greeting, so a maintainer needs to sign off the design before it can merge. A maintainer will post the decision here. The open question is the one your riders raise. With Review result: we found no blocking defect. The setting is off by default, and when it is off the KAS handshake is the same as on main. The opt-in can only reach a KAS host. The recap text is size-checked and redacted before the 1200 character cut. The parked slot is bounded and cleared on unregister and on death. In our local run, the new and changed backend tests passed. We also removed each of 15 guards one at a time, and every removal turned at least one test red. Optional:
|
|
Answers to the follow-up on
|
|
Rebased: main conflicted with |
|
Rebased: main conflicted with
The PR's other changed lines are the same. |
|
Rebased: main conflicted with
The PR's other changed lines are the same. |
|
Rebased: main conflicted with
The PR's other changed lines are the same. |
|
Rebased: main conflicted with |
|
Rebased: main conflicted with |
|
Rebased: main conflicted with
The PR's other changed lines are the same. |
|
Rebased: main conflicted with |
|
Rebased: main's chat runtime sharing metrics (#37189) conflicted with
The PR's own changed lines are byte-identical. |
|
Rebased: main conflicted with |
|
Rebased: main conflicted with
Base Main is red without this PR at |
|
Rebased: main conflicted with #36400 (KAS-only chat sharing) merged cleanly in Base |
|
Rebased: main conflicted with #37032 merged cleanly in Base |
|
Rebased: main conflicted with Pass 1, onto
Pass 2, onto One semantic fix: #37218's Generated files regenerate byte-identical. The PR's part of Main is red without this PR at |
|
Rebased: main conflicted with
|
KAS writes a short "where we are" recap only for a client that opts in with clientCapabilities._meta.kiro.settings.sessionRecap at initialize, and Crew never sent that setting, so KAS never sent a recap. Add agent.session_recap (default off, Settings > Chat > Sessions). When on, the KAS handshake carries the opt-in, the factory hands it to every AcpProvider, and every runtime the provider builds passes it on. Chat runtime sharing keys on it, so a chat never joins a process started with the other value. With the opt-in, KAS sends a recap after every turn and replays the latest one inside the session/load window. Crew shows only that replay. The runtime reader parks it per session, bounded and redacted, outside the init buffer, so load_session is unchanged. The dashboard's resume prefetch takes it right after the load through a new LLMProvider.take_session_recap and appends a kind "recap" system notice, "Where you left off: ...", before the user types. That prefetch is the only surface: a recap no prefetch takes is never shown. When a recap notice already follows the transcript's last real message, the prefetch takes the new recap and appends nothing. The check walks back past rows no turn wrote (system notices, a warm task brief, an error row), so a chat reopened with no turn in between keeps one recap row. A recap that reaches a turn stream or the pre-turn drain is dropped, and the drain does not count it as a leftover frame. The notice joins both SYSTEM_NOTICE_KINDS twins, so last-word scans skip it, and the file-change flush never gives it a turn's chips. An idle slot's last_turn_ts reads past the recap row, so a reopened chat keeps its place in the session list; last_ts still counts the row for the unread watermark. AcpSessionProvider's take_session_recap and its two typed KAS readers live in acp/session_provider_kas.py, so acp/session_provider.py stays under the 2,000-line cap. Includes a capture harness for the dark and light screenshots and spec updates.
|
Rebased: main conflicted with
The rest of the PR diff is unchanged. Generated files regenerate byte-identical, and the PR's part of |
Problem / Motivation
Goal: Show the recap that KAS sends for a resumed session as one status line in the transcript, instead of dropping it.
KAS (the agent engine behind
kiro-cli acp --agent-engine v3) can write a short "where we are" recap of a session: the goal, the current task and the next action. It writes one only for a client that opts in atinitializewithclientCapabilities._meta.kiro.settings.sessionRecap = {"enabled": true}. Crew sendssettings: {}, so KAS never sends a recap, and Crew's display mapping drops thesession_info_updatekindrecapanyway.A live stdio trace against KAS 0.66.26 settled the wire behavior. With the opt-in on
initializealone, KAS sends a recap 1.1 to 1.4 s after each prompt response. It also replays the latest recap inside thesession/loadwindow, before the load response. A per-prompt_meta.kiro.sessionRecapdoes nothing.Why it matters
Re-orienting from the transcript is expensive: the tail is tool noise, and the goal sits hundreds of messages up. KAS can produce the one line a returning user needs, and Crew shows nothing.
Not a goal
What changed (motivation → approach → change)
A new setting, Session recap (
agent.session_recap, off by default, Settings → Chat → Sessions), turns the KAS recap on. When a user reopens a KAS chat, the transcript shows one status line before they type:Where you left off: <recap>. They see the goal and the next step without scrolling back through tool output.With the setting on, every turn on that KAS process costs one more KAS model call, so the setting is opt-in, and the row says "Uses tokens on every turn. Kiro Agent backend only." Crew shows only the recap KAS replays during
session/load, and only through the dashboard's resume prefetch, whichsession.eager_spawnturns on by default. The recap KAS sends after each turn describes a turn the user just read, so it is dropped.A chat reopened with no turn since its last recap keeps that one row: the prefetch still takes the new recap, but appends nothing while a recap notice already follows the transcript's last real message. Status rows, such as Reload session's notice or a warm task brief, are not a turn. A turn in between ends that, so the next reopen shows the new recap.
config/sections_agent.py,config/loader_builders.py,config/loader_config.py,agent_sdk/drivers/acp.py,session_parts/config_apply.py,dashboard/handlers/core_config_schema.py,change_card_catalog_kinds.py,config-baseline.jsonagent.session_recap(bool, default false). The loader reads it, the provider factory hands it to everyAcpProviderthroughbuild_acp_provider, the dashboard can PATCH it as a strict boolean, and a change rebuilds the factory for new sessions. Change cards class it as a setting that cannot widen, likeagent.tool_searchproviders/acp.py,providers/acp_runtime_start.py,providers/chat_share.py,acp/chat_runtime_sharing.py,acp/runtime_class.py,acp/runtime_spawn_launch.py,acp/kas_wire.pyChatRuntimeKeykeys on it, so a chat never joins a shared process started with the other value._handshake_client_capabilitiesmergessessionRecap: {enabled: true}into the KASinitializesettings next to Tool Search. Off adds nothing, so the handshake matches main byte for byteacp/runtime_reader_loop.py,acp/runtime_session_registry.py,acp/runtime_liveness.pysession/loadwindow is parked per session id in_kas_load_recaps: redacted withsecurity.redact, capped at 1,200 characters, at most_INIT_NOTIFICATION_BUFFER_LIMITids, evictions counted as dropped frames, cleared on unregister and death. It never enters the init buffer, soload_sessionis unchanged from main (H13)providers/base.py,acp/session_provider.py,acp/session_provider_kas.py,acp/session_handle_kas.py,acp/session_handle_class.py,acp/session_handle_runtime_contract.py,acp/session_handle.py,acp/session_handle_turn.pyLLMProvider.take_session_recap()(defaultNone, H14) pops the parked text; the handle answers only onACP_BACKEND_KAS. This reader and the provider's two typed KAS readers live inacp/session_provider_kas.py, which keepsacp/session_provider.pyunder the 2,000-line cap. A recap that reaches a turn stream is dropped, and the pre-turn drain drops a post-turn recap without counting it as a leftover framedashboard/chat_turn/eager_spawn.py,dashboard/chat_runner.py_eager_spawnon slot focus) takes the recap right after the load and appends it (_surface_resume_recap), unless a recap notice already follows the transcript's last real message (the check walks back past rows no turn wrote). A lazily restored transcript loads off the event loop first (load_window_off_loop), and a turn or slot change during that load drops the row. It is the recap's only surface: withsession.eager_spawnoff, or a turn already owning the slot, the recap is not showndashboard/chat_utils.py,dashboard/system_notices.py,dashboard/slot_projection.py,website/src/lib/systemNotice.ts_append_recap_notice, writes akind="recap"system notice and redacts again throughsecurity.redact. BothSYSTEM_NOTICE_KINDStwins carryrecap, so last-word scans skip it. An idle slot'slast_turn_tsreads past the recap row, so a reopened chat keeps its place in the session list;last_tsstill counts the row for the unread watermarkwebsite/src/pages/settings/ChatPanel.tsx,chatPanelOptions.ts,website/src/i18n/locales/,settingsRegistry.gen.ts,settings-registry.generated.json,ui-index.generated.jsonconfigKey, in all 12 catalogs plus the pseudolocaledocs/system-specs/modules/(acp-client, providers, session, session-summary, learn-cron-dashboard),src/kiro_crew/docs/configuration.md,docs/feature-map/README.mdBackwards compatibility
Compatible: the setting is off by default, and off sends exactly main's handshake. The PR adds one config key, one provider method with a
Nonedefault and one notice kind.Removes nothing: no key, kind, row, path or public function is renamed, narrowed or deleted.
Tests
test_kas_spawn.py: against a stub KAS agent, theinitializesettings carrysessionRecap.enabledwhen on, sit beside Tool Search, and stay{}when off.test_kas_session_recap.py: off by default; the loader and the factory carry the value; every runtime construction gets it, and two chats that differ only on it get two chat-sharing keys;take_session_recapis declared onLLMProviderand answers the parked text orNone.test_eager_spawn_resume_prefetch.py: a resumed prefetch appends the recap once; a turn that owns the slot gets none; no recap or a fresh spawn appends nothing. A reopen after the prefetch TTL with no turn between keeps one recap row, though the two recaps differ, so the check reads the row's kind and never its text. A status row between two reopens (a reload notice, a warm task brief or its claim, a start error) still keeps one row. A turn between two reopens gives two rows. A reopen leaves the idlelast_turn_tson the last turn's row, so the chat keeps its place in the session list. A skipped recap is still taken. A lazily restored transcript loads on a worker thread before the check, and a turn that starts, or a slot replaced or deleted, during that load gets no row.test_acp_runtime_kas_recap.py: the load-window slot is parked outside both queues, bounded, redacted and KAS only, and nothing is parked with no session init in flight.take_session_recappops once and reads nothing on kiro. A turn shows no recap, even with one parked, and never claims it. The drain drops a post-turn recap and counts only the real leftover.test_acp_runtime_session_handle.pyandtest_acp_runtime_client_parity.py: the parked slot is cleared on unregister and on death.test_kas_display_mapping.py: a recap inside a turn maps to nothing; the normalizer keeps, redacts, caps and drops text. It also removes a secret whose label sits inside a removed URL, which the URL-then-credential order ofredact_textkeeps.test_midless_broadcast_dedup.py,deriveFollowUpOptions.test.ts,test_harness_parity.py,test_slot_running_readers.py,test_session_config_hot_reload.py: the notice wording and single delivery, follow-up chips, the declared KAS identity tests, the newslot.runningreader and the factory rebuild.test_config_patch.py: main's twoagent.tool_searchtoggle tests take the key as a parameter, so the PATCH round trip and the non-boolean rejection also run foragent.session_recap, with no copy of either test.test_runtime_bindings.py,test_session_handle_bindings.py,test_acp_bindings.py: the member inventories of the split runtime, handle and provider classes name the new members.test_chat_runtime_key_completeness.py:session_recapis a keyed spawn input ofChatRuntimeKey.The one-row test fails with the check removed, and three of the four status-row cases fail with a check that stops at the first row that is not a system notice. The two chat-sharing tests fail with the founding spawn's
session_recapargument or the key's field removed. The reopen-order test fails with the idlelast_turn_tsset tolast_ts, and the init-window test fails with that clause removed. Determinism:test_eager_spawn_resume_prefetch.pyandtest_acp_runtime_kas_recap.pypass 10 repeats in a row. Those two plustest_kas_session_recap.py,test_kas_display_mapping.pyandtest_midless_broadcast_dedup.py(121 tests) pass in 3 shuffled orders (seeds 11, 4242, 90210), andderiveFollowUpOptions.test.tspasses 10 repeats and the same 3 shuffled orders. The two chat-sharing tests andtest_chat_runtime_key_completeness.pypass 20 repeats at-n0and 10 at-n 4besidetest_chat_runtime_sharing.pyandtest_acp_runtime_kas_recap.py. The reopen-order and init-window tests and the three prefetch tests that cancel the TTL task pass 20 repeats at-n0and 10 at-n 4besidetest_to_dict_board_fields.pyandtest_kas_session_recap.py.Manual verification
A live trace (kiro-cli 2.28.0, KAS 0.66.26) with only the
initializeopt-in: one recap after each turn, and the latest one replayed inside thesession/loadwindow.website/scripts/capture-kas-recap-notice.mjsshoots the real built SPA: the at-return tail with the earlier turn's follow-up chips intact, and the Settings row, each dark and light. Run:cd website && node scripts/capture-kas-recap-notice.mjs.Blind read: a reader who saw only the dark notice capture called the line an automatic recap from the app, shown when you come back to a chat. It also said the recap repeats the one reply above it, and that the step after "Next:" names no one. The capture's chat has a single reply and made-up recap text. A real recap is KAS's own text, and Crew adds only the "Where you left off:" label.
Screenshots / video
The four PNGs are committed under
temp-screenshots/kas-recap/because a fork has no--attachupload.Reopened chat: the recap is the last row, before any new prompt (dark):
Light theme
Settings → Chat → Sessions, with the setting on (dark):
Light theme
Riders for the maintainer
Related Issues
no linked issue: KAS sends this recap only to a client that opts in, and no issue tracks the opt-in. (Prior art: #3621, #3666 built the KAS display-mapping seam this extends.)
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)