Skip to content

feat: show the KAS session recap when a chat is reopened - #9314

Open
jingchaodev wants to merge 1 commit into
kirodotdev:mainfrom
jingchaodev:feat/kas-recap-notice
Open

jingchaodev wants to merge 1 commit into
kirodotdev:mainfrom
jingchaodev:feat/kas-recap-notice

Conversation

@jingchaodev

@jingchaodev jingchaodev commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

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 at initialize with clientCapabilities._meta.kiro.settings.sessionRecap = {"enabled": true}. Crew sends settings: {}, so KAS never sends a recap, and Crew's display mapping drops the session_info_update kind recap anyway.

A live stdio trace against KAS 0.66.26 settled the wire behavior. With the opt-in on initialize alone, KAS sends a recap 1.1 to 1.4 s after each prompt response. It also replays the latest recap inside the session/load window, before the load response. A per-prompt _meta.kiro.sessionRecap does 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

  • Showing a recap after every turn. KAS sends one, and Crew drops it, because the user just read that turn.
  • Merging the recap with the session-summary panel. Both stay; the rider below asks the maintainer to confirm.
  • A recap emitter for kiro-cli or any other backend.

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, which session.eager_spawn turns 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.

Where What
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.json agent.session_recap (bool, default false). The loader reads it, the provider factory hands it to every AcpProvider through build_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, like agent.tool_search
providers/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.py every runtime the provider builds gets the flag: the first spawn, the resume-respawn fallback and the founding spawn of a shared chat process. ChatRuntimeKey keys on it, so a chat never joins a shared process started with the other value. _handshake_client_capabilities merges sessionRecap: {enabled: true} into the KAS initialize settings next to Tool Search. Off adds nothing, so the handshake matches main byte for byte
acp/runtime_reader_loop.py, acp/runtime_session_registry.py, acp/runtime_liveness.py a recap inside the session/load window is parked per session id in _kas_load_recaps: redacted with security.redact, capped at 1,200 characters, at most _INIT_NOTIFICATION_BUFFER_LIMIT ids, evictions counted as dropped frames, cleared on unregister and death. It never enters the init buffer, so load_session is 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.py LLMProvider.take_session_recap() (default None, H14) pops the parked text; the handle answers only on ACP_BACKEND_KAS. This reader and the provider's two typed KAS readers live in acp/session_provider_kas.py, which keeps acp/session_provider.py under 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 frame
dashboard/chat_turn/eager_spawn.py, dashboard/chat_runner.py a resume prefetch (_eager_spawn on 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: with session.eager_spawn off, or a turn already owning the slot, the recap is not shown
dashboard/chat_utils.py, dashboard/system_notices.py, dashboard/slot_projection.py, website/src/lib/systemNotice.ts one chokepoint, _append_recap_notice, writes a kind="recap" system notice and redacts again through security.redact. Both SYSTEM_NOTICE_KINDS twins carry recap, so last-word scans skip it. 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
website/src/pages/settings/ChatPanel.tsx, chatPanelOptions.ts, website/src/i18n/locales/, settingsRegistry.gen.ts, settings-registry.generated.json, ui-index.generated.json the toggle row under Session summaries, with configKey, in all 12 catalogs plus the pseudolocale
docs/system-specs/modules/ (acp-client, providers, session, session-summary, learn-cron-dashboard), src/kiro_crew/docs/configuration.md, docs/feature-map/README.md the opt-in, the display rule and the at-return path; a Session recap row in the feature map

Backwards 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 None default 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, the initialize settings carry sessionRecap.enabled when 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_recap is declared on LLMProvider and answers the parked text or None.
  • 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 idle last_turn_ts on 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_recap pops 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.py and test_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 of redact_text keeps.
  • 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 new slot.running reader and the factory rebuild.
  • test_config_patch.py: main's two agent.tool_search toggle tests take the key as a parameter, so the PATCH round trip and the non-boolean rejection also run for agent.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_recap is a keyed spawn input of ChatRuntimeKey.

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_recap argument or the key's field removed. The reopen-order test fails with the idle last_turn_ts set to last_ts, and the init-window test fails with that clause removed. Determinism: test_eager_spawn_resume_prefetch.py and test_acp_runtime_kas_recap.py pass 10 repeats in a row. Those two plus test_kas_session_recap.py, test_kas_display_mapping.py and test_midless_broadcast_dedup.py (121 tests) pass in 3 shuffled orders (seeds 11, 4242, 90210), and deriveFollowUpOptions.test.ts passes 10 repeats and the same 3 shuffled orders. The two chat-sharing tests and test_chat_runtime_key_completeness.py pass 20 repeats at -n0 and 10 at -n 4 beside test_chat_runtime_sharing.py and test_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 -n0 and 10 at -n 4 beside test_to_dict_board_fields.py and test_kas_session_recap.py.

Manual verification

A live trace (kiro-cli 2.28.0, KAS 0.66.26) with only the initialize opt-in: one recap after each turn, and the latest one replayed inside the session/load window. website/scripts/capture-kas-recap-notice.mjs shoots 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 --attach upload.

Reopened chat: the recap is the last row, before any new prompt (dark):

recap notice at return, dark

Light theme

recap notice at return, light

Settings → Chat → Sessions, with the setting on (dark):

session recap toggle, dark

Light theme

session recap toggle, light

Riders for the maintainer

  • Three re-orientation surfaces now coexist: the opt-in session-summary panel, main's warm task brief (feat: add return-triggered warm task briefs #20422) and this opt-in recap notice. In a crewmate thread with an open task, a return after 30 minutes or more can show both the brief and the recap. They differ in depth and cost. Bless the set, ask the recap to step aside when a brief shows, or direct a consolidation.
  • With the setting on, every KAS process the provider factory builds pays the extra model call, crons, channel threads and dedicated sub-agents included, while only a reopened dashboard chat shows the recap. Limiting the opt-in to dashboard sessions needs a pool decision first, because the warm pool spawns its processes with an empty session key before any chat claims them.

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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@jingchaodev
jingchaodev requested review from a team and buluoray September 7, 2026 22:04
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of cd4830481d1f54a926263dabae1980664c3097a5 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • Item 2 — duplicate of docs/system-specs/modules/session-summary.md: that panel already exists to "make re-entering a session cheap". The diff's own text calls the recap a "Sibling surface… also serves re-entry", and the description says "Both stay; the rider below asks the maintainer to confirm." Subtraction: if the maintainer does not confirm, delete agent.session_recap, the sessionRecap handshake merge, _kas_load_recaps and _surface_resume_recap, and keep the panel as the only re-entry surface.

What this change ships

Inventory (6 items) — 5 justified

Intent: show a returning user, before they type, where a reopened KAS chat left off. ADDITION.

  1. New Settings → Chat → Sessions toggle "Session recap" (agent.session_recap, off by default) — justified
  2. Reopening a KAS chat appends one "Where you left off: …" status row — duplicate of session-summary.md re-entry purpose
  3. With the setting on, KAS spends one more model call per turn — justified
  4. A recap KAS sends after each turn is dropped, never shown — justified
  5. Reopening again with no turn since the last recap adds no second row — justified
  6. LLMProvider.take_session_recap() returns None by default; only the KAS handle answers — justified

[FIRST-PRINCIPLES-REVIEWED] cd48304

Description read

[DESCRIPTION-READ] db62e4c95edbcadd7364e1f30fbeac4dd246d315b7545c43f89b435690fd58df

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of cd4830481d1f54a926263dabae1980664c3097a5 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • The session_recap_hint tooltip is in no screenshot. It is optional context, so it does not block. Its second sentence ("Session summaries write a fuller summary in the side panel.") describes the row above it. Move it there or drop it.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed cd4830481d1f54a926263dabae1980664c3097a5 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] cd48304

@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of cd4830481d1f54a926263dabae1980664c3097a5 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level blocker: the feature is off by default, removes nothing, and its rendered evidence is committed.

Notes

  • With the setting on, cron, subagent and background KAS sessions also pay one extra model call per turn, but only a reopened dashboard chat ever shows a recap. The setting's help text should name those non-dashboard sessions too, or a later change should scope the opt-in to the processes that serve dashboard slots.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed cd4830481d1f54a926263dabae1980664c3097a5 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] cd48304

@jingchaodev
jingchaodev force-pushed the feat/kas-recap-notice branch from f7d4ea0 to 23efb32 Compare September 7, 2026 22:25
@jingchaodev

Copy link
Copy Markdown
Contributor Author

Round 2 — Design's timing finding fixed; both UX takeables taken (head 23efb32). FP ✅ PASS and Opus ✅ held on the first stamp.

  • Design (between-turns recap dies in the pre-turn drain), fixed at the drain: the pre-turn drain now recognizes a stranded KAS recap frame (beside its existing permission-request exception), keeps the LAST one (a newer recap supersedes an older one in the same gap), and the next turn's stream surfaces it FIRST — before the turn's own output — with the same snapshot-and-clear discipline as the stranded-permission notices. A recap emitted at session load/resume now renders when the user next engages instead of never. Pinned end-to-end in test_acp_runtime.py: two recaps + a stale frame stranded between turns → the next prompt() stream's first event is EVENT_SESSION_RECAP with the newer text, and the pending slot is cleared. The remaining gap — rendering at the very moment of return, before the user types — needs an idle-session event consumer that exists for no event today; declared in the spec as the follow-up shape.
  • UX (no visual system-notice marker), taken: the notice line now leads with the family's glyph treatment (🧭), matching the compaction notices' ✅/❌ pattern, so the row cannot read as an ordinary assistant reply. Screenshots re-captured with the marker.
  • UX (stale recap accumulation), half taken + half declared: the chokepoint now dedupes same-text recaps against the transcript tail (an unchanged recap re-emitted per resume stacks nothing); DIFFERENT text still appends, since newer information wins. Full supersede-in-place needs a row-replacement primitive that no notice kind has today — compaction rows accumulate identically — declared as the follow-up rather than invented ad hoc here. Both pinned in test_midless_broadcast_dedup.py.
  • UX evidence gap (screenshots not materialized in the lane): fork-structural; the dark/light shots are commit-pinned in the body and serve 200.

Suites: 47/47 across mapping + chokepoint + drain; flake8/mypy-linux clean; single commit.

@jingchaodev
jingchaodev force-pushed the feat/kas-recap-notice branch from 23efb32 to eb82a10 Compare September 7, 2026 22:35
@jingchaodev

Copy link
Copy Markdown
Contributor Author

Round 3 (head eb82a10): the Harness Parity Gate caught a genuine H5 violation in round 2's drain helper — self._runtime.acp_backend != ACP_BACKEND_KAS tested harness identity by inequality, which would silently capture every harness added later. Restructured to the positive form (== ACP_BACKEND_KAS guards the whole body; everything else returns False), exactly the shape harness-parity.md prescribes. Local gate re-run green (HARNESS_BASE_REF, exit 0); suites 36/36. Await Fast Gate and Coverage Gate on 23efb32 failed closed downstream of the parity red — nothing independent to fix.

@jingchaodev
jingchaodev force-pushed the feat/kas-recap-notice branch from eb82a10 to e8c3734 Compare September 7, 2026 22:47
@jingchaodev

Copy link
Copy Markdown
Contributor Author

Round 4 — GPT's blocking finding fixed (head e8c3734):

  • BLOCKING (recap masks empty-response recovery), fixed by subtraction: the recap dispatch branch no longer sets _produced_visible_output. The adjudicator's mechanism analysis was exactly right — the recap surfaces at stream start on precisely the first prompt after a resume, and counting it as visible output suppressed the whole empty-response ladder (silent re-queue, auto-continue, and the give-up notice that tells the user to re-send) for that turn. A recap-only turn now runs the ladder like any other empty turn; the notice renders either way. Pinned structurally: the branch must call the chokepoint and must NOT set the flag.
  • FP/Design/UX re-stamped CONCERNS on the previous head — their bodies will be triaged when they re-stamp on this head (the standing items: between-turns push follow-up, supersede-in-place follow-up, fork blind-read).

@jingchaodev
jingchaodev force-pushed the feat/kas-recap-notice branch from e8c3734 to 5d00f96 Compare September 7, 2026 23:01
@jingchaodev

Copy link
Copy Markdown
Contributor Author

Round 5 — FP's three items + subtraction taken; UX/Design headline dispositioned (head 5d00f96). GPT ✅ and Opus ✅ held on the round-4 head.

  • FP (premise contradicted by session-summary), taken: the description no longer claims "no cheap way to re-orient" — it names the session-summary panel as the same-need surface with different economics (opt-in token-spending intent description vs. zero-cost backend one-liner), the session-summary spec now cross-references the recap notice as its ambient sibling with a disagreement rule (panel wins), and the coexistence is a maintainer rider.
  • FP (description omits the drain capture), taken: the change list now carries the pre-turn-drain bullet and names it as the mechanism for the central case.
  • FP (partial delivery undeclared), taken: the render-at-next-prompt limitation and the idle-session-consumer follow-up are declared in both the change list and the riders.
  • FP subtraction (_kas_recap_text duplicates the mapping extraction), taken: deleted; the drain now calls _handle_kas_session_info inside the recap guard (pure for the recap kind) — one extraction authority. 48/48 across the three suites; mypy/parity/black/syncio green.
  • UX/Design headline (recap renders after the prompt): the same partial-delivery point — now declared everywhere (spec, description, riders); the follow-up shape is named. Blind-read/materialized-shots gap: fork-structural, standing.

@jingchaodev
jingchaodev force-pushed the feat/kas-recap-notice branch from 5d00f96 to 5e6ff9c Compare September 7, 2026 23:29
@jingchaodev

Copy link
Copy Markdown
Contributor Author

Round 6 — GPT's blocking finding fixed at both kill sites (head 5e6ff9c):

  • BLOCKING (load-window recap dropped before the drain exists), fixed: the adjudicator's trace was exact — during session/load the queue registers only after _send_and_await returns, so a recap emitted inside the replay window took the reader loop's flood-drop path; and even a staged frame would then have been eaten by drain_init. Two changes close both:
    1. The reader loop's init-staging branch now retains a KAS recap session/update beside the MCP init frames (new shared predicate kas_wire.is_recap_update, used by both the runtime and the pre-turn drain so the two shapes can never drift).
    2. load_session extracts the last staged recap from buffered_init BEFORE queueing (so drain_init cannot consume it) and parks its redacted text on the handle's _pending_recap slot via the same mapping path — one emission point (next turn's stream start) now serves both arrival windows.
  • Pinned two ways in test_acp_runtime.py: an end-to-end load test (recap staged mid-load → _pending_recap populated → next prompt's first event is the recap with the right text) and a predicate shape test. The probe that found drain_init as the second killer is what the end-to-end test now guards.
  • Spec updated with the load-window path. Suites 50/50; black/syncio/parity green; single commit.

@jingchaodev
jingchaodev force-pushed the feat/kas-recap-notice branch from 5e6ff9c to 445f2df Compare September 7, 2026 23:49
@jingchaodev

Copy link
Copy Markdown
Contributor Author

Round 7 (head 445f2df): the one CI red on 5e6ff9c was isort on session_handle.py (my miss — the round-2/6 import additions were never isorted). Fixed; suites 47/47. On that head the lanes read GPT ✅ / Opus ✅ / Design ✅ PASS with FP/UX advisory — the load-window fix landed clean through all three heavyweight lanes.

@jingchaodev
jingchaodev force-pushed the feat/kas-recap-notice branch from 445f2df to 3ca0981 Compare September 8, 2026 00:08
@jingchaodev

Copy link
Copy Markdown
Contributor Author

Round 8 — FP's two accuracy items + UX's anchoring taken (head 3ca0981). GPT ✅ / Design ✅ PASS held on 445f2df.

  • FP (mechanism misattributed), taken: the change list now names both capture mechanisms accurately — the runtime staging branch + buffered_init extraction carries the load-window central case; the pre-turn drain carries the between-turns case; one emission point serves both.
  • FP (dedupe undeclared / falsifies the mirror claim), taken: the chokepoint bullet now declares the same-text tail dedupe as the one deliberate divergence from the compaction family, with its rationale.
  • UX (stale recap reads as a plan for the new prompt), taken: the composed line is now temporally anchored — 🧭 Recap — session so far: … — so it cannot read as the agent's plan for the prompt it follows. Tests + capture fixtures updated; screenshots re-captured.
  • FP blessing items (two re-entry surfaces; mechanism-vs-moment): standing riders in the body for the maintainer — both restated, not new.
  • UX evidence gap: fork-structural, standing.

@jingchaodev
jingchaodev force-pushed the feat/kas-recap-notice branch from 3ca0981 to 8382020 Compare September 8, 2026 00:31
@jingchaodev

Copy link
Copy Markdown
Contributor Author

Round 9 — Design's encapsulation item taken; the delivery-moment call stays with the maintainer (head 8382020). GPT ✅ and Opus ✅ held on 3ca0981.

  • Design (runtime reaches into handle privates), taken: load_session now hands the staged recap through a public handle.stage_recap(update) seam — extraction authority (mapping + redaction + empty-drop) stays inside the handle, and the runtime touches no private attribute. Suites 49/49; parity/black/syncio green.
  • All three lanes' shared headline (recap renders at the next prompt, not at return): this is the author-declared rider, explicitly deferred for the maintainer's product call — the capture plumbing is forward-compatible with the idle-consumer follow-up (Design's own reading: "nothing here is wasted"). Standing, awaiting blessing.
  • UX (different-text accumulation across resumes): same accumulation the compaction family has; the named smallest fix is the row-replacement primitive already declared as a follow-up. Standing.
  • Two re-entry surfaces: standing rider. Blind read: fork-structural, standing.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Settled-round disposition (head 8382020): the round settled 64 green / 1 red. The red — Backend Tests (Windows) (4) — is test_work_ledger.py::test_two_conductors_binding_one_worker_at_once_yield_exactly_one_binding, 1 failure out of 20925 on that shard, in a file this PR does not touch; the test's own assertion message names the failure shape ("a bare OSError from a Windows sharing violation") as a known non-clean-refusal cause, and one thread reported invalid_value in exactly that pattern. Windows-flake class, not attributable to this diff.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebase to clear the flake-red X (head 8851872): the single red on the previous head was a 1-in-20925 Windows flake in test_work_ledger.py (untouched by this PR; dispositioned above) — but a red X is a red X for anyone triaging, and a fork cannot rerun upstream workflows. Rebased the one commit onto current main (106 commits, clean merge), regenerated the pseudolocale, re-ran the full local gate sweep (51/51 backend, 88/88 frontend, parity/black/syncio green), re-captured the screenshots, and re-pinned the body. The fresh round re-runs every check.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in config-baseline.json, docs/feature-map/README.md, docs/system-specs/modules/{acp-client,learn-cron-dashboard,session}.md, src/kiro_crew/config/loader_config.py, src/kiro_crew/dashboard/handlers/core_config_schema.py, src/kiro_crew/change_card_catalog_kinds.py, src/kiro_crew/dashboard/chat_utils.py and the locale catalogs since this head went green (996da10f3f -> e7e3413e17); CI re-running on adcfee16a4.

  • The rebase had no conflict, and the PR's own changes are the same as 6bebdccffe, including the GPT 6.1 fix.
  • On c64b8e6e5b, all five review lanes, Internal Content Scan, Sensitive Change Review and Screenshot Evidence could not run: the GitHub App hit "API rate limit exceeded for installation" around 23:00 UTC. Dependency License Gate failed on every PR in the same window. This push runs all of them again.

The fork CI runs need a maintainer to approve them.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

The fork Opus 5.5 lane did not review adcfee16a4. Run https://github.com/kirodotdev/KiroCrew/actions/runs/40621756039 stopped at "Resolve and validate PR": api.github.com refused the connection on all 3 tries. So this head has no Opus 5.5 Review check. A re-run of that run should post it.

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.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Hi @buluoray @dodgeblaster @iamwhatever, could you please take a look at this one when you get a chance, it's green now on adcfee16a4: all CI checks pass, and GPT 6.1, First Principles, Design and UX all pass. The items from the needs-author-decision note are done, the conflict and the CI reds it mentioned are fixed, the recap only shows when a chat is reopened (before any new prompt, never between a prompt and its reply), and the blind read is in the body.

What's left needs a maintainer:

  • re-run the fork Opus lane, https://github.com/kirodotdev/KiroCrew/actions/runs/40621756039 got api.github.com connection refused so this head has no Opus 5.5 Review check
  • a ruling on whether the recap and the session summary both stay, that's Rider 1 in the body, First Principles leaves it to you, Riders 2 and 3 are smaller
  • if you're ok with it, remove needs-author-decision, approve and merge, I can't turn on auto-merge from a fork, thanks

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: #21930 on main conflicted in src/kiro_crew/docs/ui-index.generated.json. I took main's copy and ran npm run gen:ui again, so this PR's part of that file is still +15/-2. Base e7e3413e17 -> 278fc2d253; CI re-running on a87b303d92.

  • git range-diff against adcfee16a4 shows only the regenerated digest and setting counts in that file. The PR's own changes are the same, including the GPT 6.1 fix.
  • This push re-runs the Opus 5.5 lane, so the re-run ask in this comment is no longer needed.

The fork CI runs need a maintainer to approve them. The review ask in this comment still stands.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: #20487 on main conflicted in src/kiro_crew/dashboard/chat_runner.py. Both sides added one name to the same chat_utils import list, so I kept both. Base 278fc2d253 -> cc27bed8a2; CI re-running on cd4830481d.

  • git range-diff against a87b303d92 shows only that import context. The PR's own changes are the same.
  • On a87b303d92, all five review lanes passed, including Opus 5.5.

The fork CI runs need a maintainer to approve them. The review ask in this comment still stands.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: cd4830481d -> 371776135c, onto main 4e4bba39ea (5,929 commits newer than the old base cc27bed8a2), still one commit. The merge conflict is gone.

  • Conflicts: the instance-field lists in the docstrings of acp/runtime_reader_loop.py, acp/runtime_session_registry.py, acp/runtime_spawn_launch.py, acp/session_handle_kas.py and providers/acp_runtime_start.py keep main's fields and add this PR's. Both SYSTEM_NOTICE_KINDS twins keep main's Task Runner kinds and add recap. The specs and the feature map keep main's text and this PR's lines. In de.json the setting's description uses main's word for a turn, "Durchlauf". The binding tests re-pin the two __init__ digests. ui-index.generated.json is main's copy plus npm run gen:ui; this PR's part is still +15/-2.
  • Main's feat(acp): share one agent process across dashboard chats, behind the chat_runtime_sharing preview #33855 (chat runtime sharing) adds a third runtime construction and a key completeness test. The shared founding spawn now passes session_recap, and ChatRuntimeKey keys on it, so a chat never joins a shared process started with the other value. Two tests in test_kas_session_recap.py pin it.
  • acp/session_provider.py reached the 2,000-line cap on main, so its KAS readers, take_session_recap included, moved to acp/session_provider_kas.py and are bound by name.
  • Main's flake-pattern ratchet flagged the 1 s prompt timeout in test_acp_runtime_kas_recap.py; it uses default_timeout() now.

The fork CI runs need a maintainer to approve them. The review ask in this comment still stands.

@KiroCrewCaptain

KiroCrewCaptain commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: 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 4272936725 · 2179 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the careful work here. One defect in code this PR adds needs a fix before this can move on.

  1. kiro_crew/dashboard/chat_turn/eager_spawn.py:1141 (_surface_resume_recap calling _append_recap_notice in kiro_crew/dashboard/chat_utils.py:481). Trigger: agent.session_recap is 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) takes last_ts from the newest non-transient row and does not skip notices, and slot_projection.py:392 sets last_turn_ts = last_ts for an idle slot. The sidebar sorts, labels, groups by date and tints by last_turn_ts (website/src/pages/chat/sessionOrder.ts:103 says 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's last_turn_ts skip rows whose kind is recap (leave last_ts alone, since the unread watermark reads it), or stamp the recap row with the previous durable row's ts. Add a test that reopening a chat with the setting on leaves its last_turn_ts and 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_flight clause 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. Using try: ... finally: await _cancel_prefetch_ttl(slot), as your two window-load tests already do, fixes both.
  • The second redact in _append_recap_notice repeats 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.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Answers to the review on 371776135c. All four are in a100a39dc9, rebased onto main ff344c78ec, still one commit.

  1. A reopen moves the chat to the top of the session list: fixed in a100a39dc9. An idle slot's last_turn_ts now reads past a kind="recap" row (_newest_non_recap_ts in dashboard/slot_projection.py), and last_ts still counts the row for the unread watermark. test_a_reopen_keeps_the_chat_where_it_was_in_the_session_list reopens a chat whose last turn is old and checks that last_turn_ts stays on that turn's row while last_ts takes the recap row. It fails with the old last_turn_ts = last_ts. The rider that called this out of scope is gone from the body.
  2. Nothing pins the _session_inits_in_flight clause: fixed in a100a39dc9. test_load_window_recap_needs_a_session_init_in_flight feeds a KAS recap with no init in flight and checks that nothing is parked. It fails with the clause removed.
  3. Three prefetch tests cancel the TTL task without awaiting it: fixed in a100a39dc9. All three await _cancel_prefetch_ttl(slot) in a finally, so a failed assert no longer skips the cancel, and the helper's assert says when the resumed path was not reached.
  4. The second redact in _append_recap_notice: kept, and the docstring is fixed in a100a39dc9. It no longer calls the transcript an external surface: the second pass makes a caller that skips the normalizer still write a redacted row.

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.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with a100a39dc9 in the generated src/kiro_crew/docs/ui-index.generated.json. I took main's copy and ran npm run gen:ui, so this PR's part is still +15/-2. Base ff344c78ec -> d4b588bf02; head a100a39dc9 -> 36d3fb2a4e, still one commit. The PR's own changes are the same.

Main is red on mypy right now (cli_commands_memory.py:335, tracked in #36458), so the lint lane will be red on this head until that fix lands. This PR does not touch that file.

The fork CI runs need a maintainer to approve them, and the review answers are in this comment.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main's focus_resume change conflicted with 36d3fb2a4e in three places, and each keeps both sides. Base d4b588bf02 -> bb69752651; head 36d3fb2a4e -> 05c1fefe62, still one commit.

  • docs/system-specs/modules/learn-cron-dashboard.md: the ws.py entry keeps main's focus_resume text and adds this PR's recap sentence after it.
  • providers/acp_runtime_start.py: the docstring's field list names both _session_recap and focus_resume.
  • test/test_eager_spawn_resume_prefetch.py: the imports keep main's StartPriority and this PR's two imports.

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.

@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Thanks for the follow-up. This re-review covers head 05c1fef and my earlier change request.

Earlier items:

  1. Reopening a chat moved it to the top of the session list: fixed. _newest_non_recap_ts (dashboard/slot_projection.py:90) skips recap rows when it sets an idle slot's last_turn_ts, and leaves last_ts alone for the unread watermark. When the fix is reverted, test_a_reopen_keeps_the_chat_where_it_was_in_the_session_list goes red.
  • Optional, init-in-flight pin: fixed by test_load_window_recap_needs_a_session_init_in_flight.
  • Optional, TTL cancel: fixed. All three tests now await _cancel_prefetch_ttl in a finally.
  • Optional, second redact: kept, with a corrected docstring. That answer holds for an optional note.

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 agent.session_recap on, a reopened chat gets a third "where you left off" surface, next to the session summary panel and the warm task brief. Every KAS process also pays one extra model call per turn. The PR edits docs/feature-map/README.md and five module specs too, and a maintainer reviews those as design. No CI has run on this head yet, because the fork workflows are waiting for a maintainer to approve them.

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:

  • dashboard/chat_turn/eager_spawn.py:1144 takes the recap before await load_window_off_loop(slot). If the user leaves the chat during that await, this reopen loses the recap. Loading the window first would keep it parked.
  • test_reader_loop_staging_branch_covers_recap_updates only calls kas_wire.is_recap_update. A name like test_is_recap_update_accepts_only_the_recap_union would match what it covers.
  • The PR body credits test_acp_runtime_kas_recap.py with the unregister and death clears. Those are pinned in test_acp_runtime_session_handle.py and test_acp_runtime_client_parity.py.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Answers to the follow-up on 05c1fefe62. The fixes are in ea78598291, rebased onto main bdc3839731 (was bb69752651), still one commit.

  1. eager_spawn.py:1144 takes the recap before the window load: rebutted. Loading first would keep the recap parked, but nothing reads it later. _surface_resume_recap is the only reader of the parked recap, and it runs only after a new session/load, which parks a fresh replay. Two things can happen during that await, and with either order the user sees no recap:

    • A turn starts. A turn never reads the parked recap (test_pre_turn_drain_drops_a_post_turn_recap_without_counting_it), and a recap kept parked past that turn would describe the chat before it.
    • The slot is closed or replaced. A tab close cancels this task and removes the session, and unregister_session drops the parked text. A slot that takes over the live session never reaches _surface_resume_recap: its own prefetch finds the session registered (is_new=False) and stops.

    The next reopen that runs session/load gets the recap from KAS again. Take-first also lets a resumed prefetch with the setting off (the default) return before it reads a pending transcript window from disk.

  2. The test name: fixed in ea78598291. It is now test_is_recap_update_accepts_only_the_recap_shape.

  3. The body credits the wrong file for the unregister and death clears: fixed in the body. The test_acp_runtime_kas_recap.py bullet no longer claims them, and a new bullet credits test_acp_runtime_session_handle.py and test_acp_runtime_client_parity.py.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with ea78598291 in the generated src/kiro_crew/docs/ui-index.generated.json. I took main's copy and ran npm run gen:ui, so this PR's part is still +15/-2. Base bdc3839731 -> 9e91876bef; head ea78598291 -> d041150406, still one commit. The PR's own changes are the same.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with d041150406 in three files, and each keeps both sides. Base 9e91876bef -> 5b211de42b; head d041150406 -> 050cf9e032, still one commit.

The PR's other changed lines are the same.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with 050cf9e032 in two files, and each keeps both sides. Base 5b211de42b -> 2f4e88a3bc; head 050cf9e032 -> e92f962025, still one commit.

  • docs/system-specs/modules/learn-cron-dashboard.md, the ws.py line: main's new sentence on the skill read-ahead a slot_focused frame starts (docs: bring specs and docs in line with the merged speed changes #36239), then this PR's recap sentence after it.
  • src/kiro_crew/docs/ui-index.generated.json: main's copy, then npm run gen:ui, so this PR's part is still +15/-2.

The PR's other changed lines are the same.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with e92f962025 in two files, and each keeps both sides. Base 2f4e88a3bc -> c28afeaceb; head e92f962025 -> 11e724b090, still one commit.

  • docs/feature-map/README.md, the Sessions row: main's rename to Conductor mode (refactor: rename Ultra Mode to conductor mode #36924), plus this PR's session-recap in the CompactionCard.tsx note.
  • src/kiro_crew/docs/ui-index.generated.json: main's copy, then npm run gen:ui, so this PR's part is still +15/-2.

The PR's other changed lines are the same.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with 11e724b090 only in the generated src/kiro_crew/docs/ui-index.generated.json. I took main's copy and ran npm run gen:ui, so this PR's part is still +15/-2. Base c28afeaceb -> d15505809e; head 11e724b090 -> 254719e9c8, still one commit. The PR's other changed lines are the same.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with 254719e9c8 in docs/feature-map/README.md, the Sessions row. I took main's row, which drops a stale sentence (#37044), and kept this PR's session-recap in the CompactionCard.tsx note. Base d15505809e -> 205d08d0eb; head 254719e9c8 -> 3ddaffb1fd, still one commit. The PR's other changed lines are the same.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with 3ddaffb1fd in four places, and each keeps both sides. Base 205d08d0eb -> 6a61c8465f; head 3ddaffb1fd -> d42adea78e, still one commit.

The PR's other changed lines are the same.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with d42adea78e only in the generated src/kiro_crew/docs/ui-index.generated.json. I took main's copy and ran npm run gen:ui, so this PR's part is still +15/-2. Base 6a61c8465f -> 02e103f144; head d42adea78e -> d04bc28d1e, still one commit. The PR's other changed lines are byte-identical.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main's chat runtime sharing metrics (#37189) conflicted with d04bc28d1e in two files, and each keeps both sides. Base 02e103f144 -> 671eb7149b; head d04bc28d1e -> 39f8de4cc5, still one commit.

  • src/kiro_crew/acp/kas_wire.py: main's KIND_QUEUED constant, then this PR's KIND_RECAP.
  • src/kiro_crew/acp/session_handle_kas.py: main's metrics.chat_runtime_share import beside this PR's security.redact import, and main's queued branch before this PR's note that a recap update is dropped there.
  • src/kiro_crew/docs/ui-index.generated.json (on the later base 0f3e09c97f): main's copy, then npm run gen:ui, so this PR's part is still +15/-2.

The PR's own changed lines are byte-identical.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with 39f8de4cc5 only in the generated src/kiro_crew/docs/ui-index.generated.json. I took main's copy and ran npm run gen:ui, so this PR's part is still +15/-2. Base 671eb7149b -> 30f3498ab1; head 39f8de4cc5 -> 6bf033f6f7, still one commit. The PR's other changed lines are byte-identical.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with 6bf033f6f7 in src/kiro_crew/change_card_catalog_kinds.py and the generated src/kiro_crew/docs/ui-index.generated.json.

Base 30f3498ab1 -> af94fac51f, head 6bf033f6f7 -> 2097bab2f1. The rest of the diff is unchanged.

Main is red without this PR at af94fac51f: 7 tests in test_autonudge_row_scrub.py, test_history.py and test_one_conversation_one_session.py fail. They plant the same AWS documentation key and expect #36640 to scrub it.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with 2097bab2f1 only in the generated src/kiro_crew/docs/ui-index.generated.json. I took main's copy and regenerated it. This PR's part stays +15/-2.

#36400 (KAS-only chat sharing) merged cleanly in chat_runtime_sharing.py, runtime_class.py, runtime_session_registry.py, session_provider.py and chat_runner.py. Its sharing tests pass with this PR.

Base af94fac51f -> 99dc8daacf, head 2097bab2f1 -> 90470f9974. The rest of the diff is unchanged.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with 90470f9974 only in the generated src/kiro_crew/docs/ui-index.generated.json. I took main's copy and regenerated it. #37406 dropped the digest and count lines, so this PR's part is now +13/-0, added lines only.

#37032 merged cleanly in session_handle_class.py and session_handle_kas.py. Its worker-grant tests pass with this PR.

Base 99dc8daacf -> a39d30d56a, head 90470f9974 -> 4272936725. The rest of the diff is unchanged.

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with 4272936725 in 12 files over two passes. Head 4272936725 -> 24157d8d4e, base a39d30d56a -> 09e5482863. Still one commit.

Pass 1, onto e1d7ff2428 (chat runtime sharing by session tree, #37466 / #37826 and the harness sharing PRs):

  • chat_runtime_sharing.py, chat_share.py, test_chat_runtime_key_completeness.py: main's new tree_root / member_id / memory_store / tool_surface_pinned key fields stay. session_recap stays a keyed spawn input, right after kas_telemetry and before main's defaulted fields.
  • runtime_class.py, runtime_spawn_launch.py: main's _spawn_spec, build_reuse import and harness memory pin stay. The recap opt-in still follows them in _handshake_client_capabilities.
  • runtime_session_registry.py: the "Instance fields written" list names both _session_harness_states and _kas_load_recaps.
  • session_provider.py: fix(acp): warn when kiro-cli, or a KAS relay's kiro-cli, is outside its tested range #37637 compacted the KAS notice readers with _handle_str and added kas_untested_version_notice. Those stay as main wrote them, so session_provider_kas.py now holds only take_session_recap and the two typed readers. session_provider.py is 1,851 lines with this PR.
  • chat_runner.py: main dropped BLOCKED_LINKS_ORDERED_KEY from that import, so the PR adds only _append_recap_notice.
  • learn-cron-dashboard.md: main's ws.py audience text plus the PR's recap sentence; the PR's eager_spawn row plus main's app_agent_binding row.

Pass 2, onto bbd03e5d8d (#36872 memory preview): the kas_memory and kas_wire imports, the agent.orchestrator_memory and agent.session_recap schema rows, and main's new handshake test beside the PR's two in test_kas_spawn.py, each kept side by side.

One semantic fix: #37218's test_the_pin_reaches_only_a_harness_that_reads_the_settings_channel calls _handshake_client_capabilities on a stub runtime, and that function reads _session_recap. The stub gains _session_recap=False.

Generated files regenerate byte-identical. The PR's part of ui-index.generated.json is +13/-0.

Main is red without this PR at bbd03e5d8d: test_acp_runtime_load_session.py::TestAcpRuntimeLoadSession::test_load_session_keeps_the_transcript_path_alongside_the_agents (KeyError: 'settings') and the three test_kas_orchestrator_memory.py::TestTheRealSessionNewRequest::test_an_unconfirmed_resume_is_evicted_without_deleting_its_record cases (DID NOT RAISE AcpRuntimeError).

@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with 24157d8d4e only in the import block of src/kiro_crew/acp/runtime_spawn_launch.py. Head 24157d8d4e -> faa18887cd, base 09e5482863 -> 0fda5a7d6c. Still one commit.

  • fix(acp): wait for systemd scope admission as its own startup stage #37008 added scope_admission to the from kiro_crew.acp import ... line, and the PR adds kas_wire there. Both stay, and the line is wrapped to fit the line limit.
  • The rest of the PR diff is unchanged. Generated files regenerate byte-identical, and the PR's part of ui-index.generated.json is still +13/-0.
  • The four tests named in the last Rebased comment as red on main (test_load_session_keeps_the_transcript_path_alongside_the_agents and the three test_an_unconfirmed_resume_is_evicted_without_deleting_its_record cases) pass on this base.

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.
@jingchaodev

Copy link
Copy Markdown
Contributor Author

Rebased: main conflicted with faa18887cd in src/kiro_crew/acp/runtime_spawn_launch.py and src/kiro_crew/dashboard/handlers/core_config_schema.py. Head faa18887cd -> 2d7edeabb6, base 0fda5a7d6c -> e72cf2edbb. Still one commit.

The rest of the PR diff is unchanged. Generated files regenerate byte-identical, and the PR's part of ui-index.generated.json is still +13/-0.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) needs-author-decision PR blocked on author input readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants