Repository navigation
fix(dashboard): let Older Sessions ask for user conversations only - #13033
Conversation
|
Intent: Stop the sidebar's Older Sessions pane from presenting background machine runs as the reader's own conversations, by letting that one caller ask the sessions endpoint for user-originated rows only. |
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Verify #13091 before merge: "Delete all" now clears machine transcripts the pane hides, so "all closed sessions" covers rows the user can't see. [UX-REVIEWED] 2b1d751 |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify #13091 stays tracked: Delete-all's confirm count now exceeds the rows the narrowed pane shows, and clears transcripts the reader no longer sees. [DESIGN-REVIEWED] 2b1d751 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify Not justified as shipped
What this change shipsInventory (6 items) — 5 justifiedIntent: stop the Older Sessions pane listing untitled machine transcripts as the reader's conversations (issue #12370, repro in description, tests red on base) — a FIX.
Counts run: [FIRST-PRINCIPLES-REVIEWED] 2b1d751 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 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: |
Opus 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: |
5741656 to
a6ded35
Compare
|
|
|
GPT 5.6 Review —
|
GPT 5.6 Review —
|
a6ded35 to
0c342c6
Compare
|
Rebased: main moved from The five AI review lanes on the previous head all failed on The two Windows backend shards were float-tolerance flakes in files this PR does not touch — The diff is unchanged by the rebase: 6 files, +275/-14. |
GPT 5.6 Review —
|
GPT 5.6 Review —
|
1 similar comment
GPT 5.6 Review —
|
|
|
|
The sidebar's Older Sessions pane listed every transcript on disk, so a
background subagent run appeared as a chat row. Those transcripts carry no
title, so each row rendered its own storage key as the label. On one host 51
of 112 rows were subagent runs; on another, 186 of 1005.
`GET /api/sessions` gains an opt-in `user_only` flag beside `exclude_open`.
Set, it drops rows whose key is in a machine namespace, before `total` and
`has_more` are computed so one page describes one list. The default is
unchanged: memory consolidation and the command palette's recents read the
full inventory and would silently skip rows if the endpoint narrowed on their
behalf.
The namespace list is a literal tuple, spelled the way `handlers/_shared.py`
already spells the same roster. Deriving it from
`messaging.link._TELEMETRY_LOCAL_PREFIXES` reads as tighter but is not: that
registry exists to bound telemetry label cardinality, and `wf-unpooled`,
`wf-worker` and `wf-scope` are all live session keys absent from it, so a
derived filter missed them. Matched through `_in_namespace`, which accepts
both separators, because `history._safe_key` folds `subagent:<id>` to the stem
`subagent_<id>` and every other subagent guard in the tree is spelled with a
colon that can never match a persisted name.
`taskrunner` is deliberately not in the list. `POST /api/taskrunner/{id}/to-chat`
opens a real chat slot on `taskrunner:<task_id>:chat:<token>` and titles it
`Plan: <task_id>`, so the namespace holds conversations as well as runs and the
key cannot separate them once every `:` has been folded. Listing a plain run is
the declared residual, and it is the safe side of the trade: showing a machine
row costs less than hiding a conversation. Anything unlisted stays visible.
The pane's bulk delete is untouched. Its gate, its confirm text and the set
`DELETE /api/sessions` clears are all `main`'s; machine transcripts were always
inside that set and were simply visible before. A pre-existing gap found while
reviewing this change — `api_sessions_clear` answers 200 with `ok: false` on a
partial failure and no caller reads it — is filed as #13083.
Only the Older Sessions loader passes the flag. `search_sessions()` and the
set Delete-all clears are untouched.
Closes #12370
4460641 to
2b1d751
Compare
|
|
|
|
…irodotdev#13033) The sidebar's Older Sessions pane listed every transcript on disk, so a background subagent run appeared as a chat row. Those transcripts carry no title, so each row rendered its own storage key as the label. On one host 51 of 112 rows were subagent runs; on another, 186 of 1005. `GET /api/sessions` gains an opt-in `user_only` flag beside `exclude_open`. Set, it drops rows whose key is in a machine namespace, before `total` and `has_more` are computed so one page describes one list. The default is unchanged: memory consolidation and the command palette's recents read the full inventory and would silently skip rows if the endpoint narrowed on their behalf. The namespace list is a literal tuple, spelled the way `handlers/_shared.py` already spells the same roster. Deriving it from `messaging.link._TELEMETRY_LOCAL_PREFIXES` reads as tighter but is not: that registry exists to bound telemetry label cardinality, and `wf-unpooled`, `wf-worker` and `wf-scope` are all live session keys absent from it, so a derived filter missed them. Matched through `_in_namespace`, which accepts both separators, because `history._safe_key` folds `subagent:<id>` to the stem `subagent_<id>` and every other subagent guard in the tree is spelled with a colon that can never match a persisted name. `taskrunner` is deliberately not in the list. `POST /api/taskrunner/{id}/to-chat` opens a real chat slot on `taskrunner:<task_id>:chat:<token>` and titles it `Plan: <task_id>`, so the namespace holds conversations as well as runs and the key cannot separate them once every `:` has been folded. Listing a plain run is the declared residual, and it is the safe side of the trade: showing a machine row costs less than hiding a conversation. Anything unlisted stays visible. The pane's bulk delete is untouched. Its gate, its confirm text and the set `DELETE /api/sessions` clears are all `main`'s; machine transcripts were always inside that set and were simply visible before. A pre-existing gap found while reviewing this change — `api_sessions_clear` answers 200 with `ok: false` on a partial failure and no caller reads it — is filed as kirodotdev#13083. Only the Older Sessions loader passes the flag. `search_sessions()` and the set Delete-all clears are untouched. Closes kirodotdev#12370 Co-authored-by: Joe Guo <zejiangg@amazon.com>
Problem / Motivation
The chat sidebar's Older Sessions pane listed background machine transcripts as if they were the reader's own conversations. A subagent transcript has no title, so each row rendered its raw storage key as the label:
On the reporter's host 51 of 112 rows were subagent runs — 46% of the pane. On another host, 186 of 1005, and those files are 125-byte metadata-only stubs with no title and no messages. There was no setting anywhere to suppress them.
Why it matters
Half the pane was rows nobody can return to, and the share grows with every fan-out: one parallel round adds 3-9 more. The endpoint pages at 50, so machine runs pushed real conversations off the first page. Deleting them is not a workaround — they regenerate, and
spawn_statusandspawn_continueread those same transcripts, so they must stay on disk.What changed (motivation → approach → change)
A session key is flattened on the way to disk:
history._safe_keyfoldssubagent:<id>into the stemsubagent_<id>, beside real chats.list_sessions()returns every stem with no namespace test, andapi_sessionsnarrowed only onexclude_open. Every subagent guard in the tree is spelledstartswith("subagent:"), which can never match a stem — so nothing stopped these rows.GET /api/sessionsgains an opt-inuser_onlyflag besideexclude_open. Set, it drops machine-namespace rows beforetotalandhas_moreare counted, so one page describes one list. The default is unchanged deliberately: memory "Consolidate all" and the palette's recents read the full inventory and would silently skip rows if the endpoint narrowed for them. Only the Older Sessions loader asks.user_onlysubagent,secretary,channelwf,wf-pool,wf-unpooled,wf-worker,wf-author,wf-scopedashboard,slack,discord, …cronhide_in_chatbacks a real slotsidetaskrunnerThe list is a literal tuple, and a presentation judgement for this one pane rather than a shared roster. Two other modules carry similar-looking tuples that answer different questions and do not agree with each other:
handlers/_shared.pydispatches a memory-mode lookup (colon-only, wf-family, includeswf-scope), andhandlers/cron.pyanswers live-and-shared (colon-only, wf-family plussubagent, omitswf-scope). Hoisting the three into one constant would force a meaning none of them has. Thecron.pyomission looks like a pre-existing gap and is filed as #13084.Literal rather than derived from
messaging.link._TELEMETRY_LOCAL_PREFIXES: that registry bounds telemetry label cardinality, andwf-unpooled,wf-workerandwf-scopeare live session keys absent from it, so a derived filter missed them._in_namespaceaccepts both separators, so stem and live key classify alike.taskrunneris deliberately absent:to-chatopens a titled chat slot ontaskrunner:<task_id>:chat:<token>, so the namespace holds conversations as well as runs and the key cannot separate them once_safe_keyhas folded every:. Listing a plain run is the declared residual — anything unlisted stays visible.Three files carry it:
src/kiro_crew/dashboard/handlers/sessions.pyreads the flag and applies the drop,website/src/api/client.tsputs it on the query string, andwebsite/src/store/chatSlice.tsis the one caller that sets it.src/kiro_crew/messaging/link.pygains a comment only: a pointer on the prefix registry saying a new namespace also needs classifying for this pane, since unclassified means visible here.docs/system-specs/modules/learn-cron-dashboard.mdanddocs/feature-map/README.mddocument the parameter in the same commit.Deliberately not here. The pane's Delete all keeps
main's behaviour untouched: its row-count gate, its confirm text, and the set it clears. Machine transcripts were always inside that set — they were simply visible before — so nothing about that action changes. A real but pre-existing gap found while reviewing this PR, thatapi_sessions_clearanswers 200 withok: falseon a partial failure and no caller reads it, is filed as #13083 rather than widened into this diff. The issue's asks to flip the endpoint default and to filtersearch_sessions()are also out — the ruling and its reasons are recorded on the issue.Backwards compatibility
Compatible:
user_onlyis absent by default, and with it absent the response is byte-identical to today — a test pins exactly that. No existing caller sends it. The setDELETE /api/sessionsclears is unchanged.Tests
test/test_dashboard_sessions_older_exclusion.py— machine rows drop andtotalfollows;cron_,dashboard_,side_, Slack and Discord rows stay;subagent:abcandsubagent_abcclassify alike; all sixwf*siblings drop, including the three the telemetry registry never listed; ataskrunner_row stays as the declared residual; without the flag the body is byte-identical for a missing and auser_only=0param; the two narrowings compose.website/src/test/ChatSliceCoverage.test.tsx— the Older Sessions fetch passes the flag.ApiClient.coverage.test.tsx— the query string the client builds.Every branch was mutated to confirm a test reaches it: dropping the filter reds 4; re-adding
taskrunnerto the list reds the residual test; removing awf*sibling reds the sibling test; puttingcronin the dropped set reds the cron test.Manual verification
Seeded an isolated data home with the inventory the issue reports — 4 dashboard chats, 1 cron job, 4
subagent_, 1taskrunner_, 1wf_— and read it through the real handler over a realConversationLog. 11 rows became 5: the foursubagent_rows and thewf_row dropped, and thetaskrunner_row stayed, which is the residual above.Screenshots / video
No watched frontend surface is touched. The only frontend changes are one query-string parameter in
api/client.tsand the one call site instore/chatSlice.ts— no component, page, app or stylesheet — so the pane's markup, layout and copy are byte-for-bytemain's, and the earlier revision's Delete-all and empty-state changes have been reverted entirely.The
no-visual-deltamarker is still not used, for the same reason it was not used on the earlier heads: the row count the pane displays does change, so the marker would be a false statement even though no watched path is in the diff. What changes is which rows the server sends, stated exactly in Manual verification above.Related Issues
Closes #12370
Follow-ups filed, not fixed here: #13083 (Delete all reports success on a partial failure), #13084 (
cron.pylive-shared predicate omitswf-scope) and #13091 (the visible set and the Delete-all set no longer agree)Pattern harvest
Rule candidate: review-prompt
Pattern: a guard written against a live session key (
subagent:) is reused where the PERSISTED filename stem (subagent_) arrives, so the check can never fireChecklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)