Skip to content

fix(dashboard): let Older Sessions ask for user conversations only - #13033

Merged
chenmingwei23 merged 1 commit into
mainfrom
fix/12370-older-sessions-namespace-filter
Sep 23, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
fix/12370-older-sessions-namespace-filter

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

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:

default                    04:58 PM
subagent_ba1f91c9
default                    04:51 PM
subagent_eb3b2493

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_status and spawn_continue read 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_key folds subagent:<id> into the stem subagent_<id>, beside real chats. list_sessions() returns every stem with no namespace test, and api_sessions narrowed only on exclude_open. Every subagent guard in the tree is spelled startswith("subagent:"), which can never match a stem — so nothing stopped these rows.

GET /api/sessions gains an opt-in user_only flag beside exclude_open. Set, it drops machine-namespace rows before total and has_more are 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.

Row With user_only Why
subagent, secretary, channel dropped a machine run nobody addressed
wf, wf-pool, wf-unpooled, wf-worker, wf-author, wf-scope dropped workflow internals
dashboard, slack, discord, … kept the reader's own conversations
cron kept a job without hide_in_chat backs a real slot
side kept the slot's own side panel, which the reader typed into
taskrunner kept the namespace holds conversations too — see below

The 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.py dispatches a memory-mode lookup (colon-only, wf-family, includes wf-scope), and handlers/cron.py answers live-and-shared (colon-only, wf-family plus subagent, omits wf-scope). Hoisting the three into one constant would force a meaning none of them has. The cron.py omission 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, and wf-unpooled, wf-worker and wf-scope are live session keys absent from it, so a derived filter missed them. _in_namespace accepts both separators, so stem and live key classify alike.

taskrunner is deliberately absent: to-chat opens a titled chat slot on taskrunner:<task_id>:chat:<token>, so the namespace holds conversations as well as runs and the key cannot separate them once _safe_key has folded every :. Listing a plain run is the declared residual — anything unlisted stays visible.

Three files carry it: src/kiro_crew/dashboard/handlers/sessions.py reads the flag and applies the drop, website/src/api/client.ts puts it on the query string, and website/src/store/chatSlice.ts is the one caller that sets it. src/kiro_crew/messaging/link.py gains 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.md and docs/feature-map/README.md document 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, that api_sessions_clear answers 200 with ok: false on 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 filter search_sessions() are also out — the ruling and its reasons are recorded on the issue.

Backwards compatibility

Compatible: user_only is 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 set DELETE /api/sessions clears is unchanged.

Tests

test/test_dashboard_sessions_older_exclusion.py — machine rows drop and total follows; cron_, dashboard_, side_, Slack and Discord rows stay; subagent:abc and subagent_abc classify alike; all six wf* siblings drop, including the three the telemetry registry never listed; a taskrunner_ row stays as the declared residual; without the flag the body is byte-identical for a missing and a user_only=0 param; 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 taskrunner to the list reds the residual test; removing a wf* sibling reds the sibling test; putting cron in 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_, 1 taskrunner_, 1 wf_ — and read it through the real handler over a real ConversationLog. 11 rows became 5: the four subagent_ rows and the wf_ row dropped, and the taskrunner_ 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.ts and the one call site in store/chatSlice.ts — no component, page, app or stylesheet — so the pane's markup, layout and copy are byte-for-byte main's, and the earlier revision's Delete-all and empty-state changes have been reverted entirely.

The no-visual-delta marker 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.py live-shared predicate omits wf-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 fire

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|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

@iamwhatever
iamwhatever requested review from a team and hoang-phan98 September 23, 2026 07:54
@iamwhatever

Copy link
Copy Markdown
Contributor Author

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.
Not a goal: Changing the endpoint's documented full-inventory default, filtering the shared transcript-search corpus, changing what Delete-all clears, or altering what is written to disk.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 23, 2026
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ✅ PASS

UX-level review of 2b1d751e46de1b21e361cebeee88ca309ff3674a — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 2b1d751e46de1b21e361cebeee88ca309ff3674a — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 2b1d751e46de1b21e361cebeee88ca309ff3674a — 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/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify secretary_ and channel_ transcripts never hold a conversation a person addressed — both drop on the author's classification alone, beyond the reported subagent/wf repro.

Not justified as shipped

  • Item 4 — rides along: the link.py registry comment is not needed to remove the defect; it is declared ("gains a comment only") and carries no surface, so it is inventory only.

What this change ships

Inventory (6 items) — 5 justified

Intent: 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.

  1. Older Sessions no longer shows subagent/workflow/secretary/channel rows — justified
  2. GET /api/sessions gains opt-in user_only (default byte-identical, pinned by test) — justified
  3. api.sessions client gains a userOnly argument, set by one caller — justified
  4. Comment on the telemetry prefix registry pointing new namespaces at the pane filter — rides along
  5. Specs/feature-map updated in the same commit — justified
  6. taskrunner_, cron_, side_ rows deliberately stay visible (declared residual) — justified

Counts run: api.sessions( callers — 3 real (chatSlice.ts:1566 sets the flag; MemoryTab.tsx:255, recentsProvider.ts:259 need the full inventory, which is why it is a flag, not a default). Sibling tuples grepped — _shared.py:2486 and cron.py:2310 are colon-only and disagree with each other and with _TELEMETRY_LOCAL_PREFIXES (which lacks wf-unpooled/wf-worker/wf-scope, confirmed in link.py:108-127), so no existing mechanism does this job. taskrunner:<id>:chat:<token> confirmed at taskrunner.py:51. Unfixed siblings (search_sessions, Delete-all set) are counted, declared, and filed (#13083, #13084, #13091).

[FIRST-PRINCIPLES-REVIEWED] 2b1d751

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 2b1d751e46de1b21e361cebeee88ca309ff3674a and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2b1d751

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 2b1d751e46de1b21e361cebeee88ca309ff3674a: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 2b1d751e46de1b21e361cebeee88ca309ff3674a — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2b1d751

Verdict parsed from the review's SHA-scoped output markers for commit 2b1d751e46de1b21e361cebeee88ca309ff3674a.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 2b1d751e46de1b21e361cebeee88ca309ff3674a: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 23, 2026
@iamwhatever
iamwhatever force-pushed the fix/12370-older-sessions-namespace-filter branch from 5741656 to a6ded35 Compare September 23, 2026 08:16
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 23, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Task Runner "to chat" sessions hidden by the taskrunner namespace span=448c56730e4b
    self-added: yes
    mechanism: a chat path segment exempts a key from the machine-namespace drop

Fixed in a6ded35. Legitimate and reproduced: _task_result_slot
(dashboard/handlers/taskrunner.py:51) mints taskrunner:{task_id}:chat:{token},
binds it as a slot's linked_session_key, and api_taskrunner_to_chat sets
slot.title = f"Plan: {run.task_id}". That is a titled conversation, so the
filter was hiding a real chat once its tab closed.
The fix exempts any key carrying a delimited chat segment
(_USER_CHAT_SEGMENT_RE = re.compile(r"[:_]chat[:_]")), not the whole
namespace: a plain taskrunner_<id> and a taskrunner_<id>_runtime row are
still dropped, and a test pins both arms.
Matched as delimited text rather than by segment index on purpose. _safe_key
folds EVERY : to _, so a task_id containing _ shifts the index; a
positional check drops exactly the rows with underscores in their spec name.
A parametrized case (taskrunner_my_nightly_task_chat_9c81d0) reds under the
positional variant and passes under this one.
Enumerated the class rather than the named site: of the eight dropped
namespaces this is the only one where a chat slot is opened on the key
(get_or_create_slot with a machine-namespaced linked_session_key has one
call site). side: cannot reach the pane at all — handlers/side.py states
side messages "never enter slot.messages or any persistent store", so no
transcript is written.
Residual, deliberate: a spec named literally chat would exempt a
non-conversation row. Showing one machine row too many is the defect this
filter narrows; hiding one real conversation is worse, so ambiguity resolves
toward showing it.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • ns not in ("dashboard", "cron") leaves taskrunner chat slots in the drop set span=21910eb8fc84
    self-added: yes
    mechanism: a chat path segment exempts a key from the machine-namespace drop

Fixed in a6ded35. Verified independently of the GPT lane's report: read
_task_result_slot (dashboard/handlers/taskrunner.py:44-60), which builds
session_key = f"taskrunner:{task_id}:chat:{token}" and passes it as
linked_session_key to get_or_create_slot, and api_taskrunner_to_chat
(:527), which sets slot.title = f"Plan: {run.task_id}". So the persisted
stem taskrunner_<id>_chat_<token> is a titled conversation the reader opened,
and the subtraction was hiding it.
The namespace subtraction is unchanged; the exemption is a delimited chat
segment, so taskrunner_<id> and taskrunner_<id>_runtime still drop. Tests
pin both arms, and removing the exemption reds four of them.
The wider risk your finding implies — a namespace silently inheriting
"hidden" — is now a gate rather than a reading:
test_every_telemetry_namespace_has_a_visibility_decision asserts
set(_MACHINE_ONLY_NAMESPACES) | {"dashboard", "cron"} equals every
_TELEMETRY_LOCAL_PREFIXES member and that the two sides are disjoint. A newly
minted namespace fails that test instead of vanishing from the pane.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Pin _MACHINE_ONLY_NAMESPACES membership with a sync test span=a8dacd8620b9
    self-added: yes
    mechanism: sync test asserting the namespace split covers and partitions _TELEMETRY_LOCAL_PREFIXES

Taken, in a6ded35. The suggestion named the exact hazard the two
line-level lanes then found an instance of, so it is a gate rather than a nicety:
the set is derived by SUBTRACTION, so a new _TELEMETRY_LOCAL_PREFIXES member
joins the dropped side with nothing failing.
test_every_telemetry_namespace_has_a_visibility_decision asserts
set(_MACHINE_ONLY_NAMESPACES) | {"dashboard", "cron"} equals every namespace
in _TELEMETRY_LOCAL_PREFIXES, AND that the two sides are disjoint — covering
alone would let a namespace sit on both. Its docstring names the two ways to
make it pass again, so the failure reads as a decision to record rather than a
number to bump.
Proven non-vacuous: adding a third name to the kept tuple in sessions.py
leaves that namespace on neither side and reds this test alone.

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 57416566de7f7c90e71dc4a832b46b75be1ac92a; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 57416566de7f7c90e71dc4a832b46b75be1ac92a: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for a6ded3536c10ea57faa6503f25d5d167b81e35fc; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt a6ded3536c10ea57faa6503f25d5d167b81e35fc: <one-sentence reason>

@iamwhatever
iamwhatever force-pushed the fix/12370-older-sessions-namespace-filter branch from a6ded35 to 0c342c6 Compare September 23, 2026 08:34
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased: main moved from 18f9984b to 21182a5e and the new base carries 21182a5e94 ("fix(ci): record restyle-ratchet progress from #12805 so main lints again", #13008). My base predated that repair, so Frontend Lint & Type Check failed on this branch for main's reason, not this diff's: the tree measured 347 restyle sites in 50 files while the baseline my base carried still recorded 349 in 51, naming website/src/pages/members/MembersPage.tsx: 2 -> 0 — a file this PR does not touch. Verified on a clean origin/main worktree at 21182a5e, where the ratchet passes; after the rebase it passes here too. The baseline was not edited on this branch.

The five AI review lanes on the previous head all failed on gh: API rate limit exceeded for installation (HTTP 403) before reaching a verdict, so none of them judged that head. This push re-runs them.

The two Windows backend shards were float-tolerance flakes in files this PR does not touch — test_diag_procs.py::test_an_unchanged_process_still_gets_its_rate (assert 45.45... == 50.0 ± 1) and test_knowledge.py::TestFileReaderPdf::test_read_pdf_runs_in_the_bounded_child (assert 120.00000000000045 <= 120.0).

The diff is unchanged by the rebase: 6 files, +275/-14.

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 0c342c6f4370bc84d2642897e559a3327caca7fd; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 0c342c6f4370bc84d2642897e559a3327caca7fd: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 0c342c6f4370bc84d2642897e559a3327caca7fd; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 0c342c6f4370bc84d2642897e559a3327caca7fd: <one-sentence reason>

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 0c342c6f4370bc84d2642897e559a3327caca7fd; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 0c342c6f4370bc84d2642897e559a3327caca7fd: <one-sentence reason>

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 23, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • A one-line pointer at the minting site would catch a new namespace at authoring time span=c795917556be
    self-added: yes
    mechanism: a pointer comment on _TELEMETRY_LOCAL_PREFIXES naming the pane's classification list

Taken in 4460641. You offered the minimal version of an ask I had declined the larger form
of last head, and declining this one too would have been unreasonable — it is a comment, it
changes no behaviour, and it addresses a theme that has now surfaced in four separate findings.
Placed on messaging/link.py's _TELEMETRY_LOCAL_PREFIXES rather than at each minting
f-string. The minting sites are scattered across workflows/agent_pool.py,
workflow_memory.py, channel.py and session.py, so a pointer at each would be four
copies of the problem it is meant to prevent; that registry is the closest thing to a
roll-call and is what an author adding a namespace already touches.
The comment says three things, and the middle one is the part I would not have written
without this PR's history: being absent from that registry is not itself a bug (wf-unpooled,
wf-worker and wf-scope are live keys that are legitimately unlisted), but a namespace
whose transcripts reach disk also needs classifying at _MACHINE_NAMESPACES, and
unclassified means VISIBLE there — so a new machine namespace silently repopulates the
pane until added.
Stating the default explicitly is the load-bearing half: an author who reads "unclassified
means visible" knows the failure mode without needing to find this pane.
test/metrics/test_startup_channel_attrs.py, which pins that registry, still passes.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Only the unfiltered list is narrowed; at 2+ characters the pane's source becomes the un-narrowed search span=fccbdb807220
    self-added: no
    mechanism: none — search_sessions() is scoped out by an explicit ruling, and the consequence is stated rather than implied

Not fixed, accurate as written, and this is its second head — so rather than repeat last
head's answer I will be more precise about the boundary.
You are right about the mechanism: ChatSidebar.tsx:9996 prepends historySearchResults
verbatim, and GET /api/sessions/search carries no narrowing, so past SEARCH_MIN_CHARS a
content match re-surfaces exactly the subagent_* / wf* transcripts the default listing
drops.
search_sessions() is excluded from this change by an explicit ruling, and the reason is that
it is not this pane's corpus — it is the ONE ranking shared by the dashboard history filter,
the search_chat_history MCP tool and Discord session resume. Narrowing it is a decision
about three consumers with three different expectations, and #12370's reporter asked for it
precisely because they had noticed the same thing. The ruling declining it is recorded on that
issue.
So the shipped boundary, stated plainly because it was previously only implied: the pane's
default listing excludes machine transcripts; a content search still reaches them.
That is
defensible — a reader typing a query is looking for something specific rather than browsing a
conversation list, which is the presentation this PR repairs — but it is a boundary, not an
accident, and it should be findable in the thread rather than inferred from what the diff
omits.
I am not claiming the boundary is ideal. If a maintainer wants search narrowed, it needs its
own change with those three consumers surveyed, not a fifth parameter added here.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Not fixed, and this one I am escalating rather than answering again. Fourth occurrence of
this span
(rounds 0, 1, 4, now here), and the mechanism it asks for was BUILT on an earlier
head of this PR and then deliberately removed.
The history matters more than my reasoning here. I did fix exactly this: gated the control on
historyOpen alone so it survived an empty pane, then on
historyOpen && (history.length > 0 || historyHidden > 0) when the UX lane showed the first
version was too wide, plus an empty-state line naming the hidden count and a count-bearing
confirm. Four review rounds of UI accretion on one button. A maintainer then ruled the whole
Delete-all class pre-existing and out of this PR's scope, and ChatSidebar.tsx is now
byte-identical to main on purpose.
Your observation is correct on its own terms: on an install whose only closed sessions are
machine runs, the pane is empty and the in-pane route to those transcripts is gone. The
per-row X and DELETE /api/sessions remain, and retention still applies. It is filed as
#13091 with all three options and their tradeoffs, alongside #13083 for the partial-failure
gap on the same control.
My standing instruction is not to patch this class again and not to re-argue it, so I am
reporting it to my maintainer as a question instead. If the ruling should be overridden, that
is a human decision about a PR that has already been cut back once for this exact accretion —
not something I should decide by rebuilding the mechanism a fifth time.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 23, 2026
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
@iamwhatever
iamwhatever force-pushed the fix/12370-older-sessions-namespace-filter branch from 4460641 to 2b1d751 Compare September 23, 2026 14:29
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 23, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • secretary and channel lack round-trip assertions, so their removal would silently restore machine rows span=448c56730e4b
    self-added: yes
    mechanism: every member of the tuple now has an assertion, so deleting any one of them reds a test

Fixed in 2b1d751. Accepted exactly as written, and it is the sharpest test finding on
this PR because the failure mode it names is invisible.
You are right that the coverage was partial: subagent_ and the wf* family had
assertions, cron/side/taskrunner had them on the KEPT side, but secretary and
channel sat in the tuple with nothing pinning them. Deleting either would have passed the
whole suite while quietly returning its rows to the pane — silent, because nothing errors, a
row simply reappears.
test_user_only_drops_the_machine_namespaces now carries secretary_a41f and
channel_C0AP3QR_agent7 alongside the existing rows, so every member of
_MACHINE_NAMESPACES is covered by some assertion. Verified by mutation rather than by
reading: removing "secretary", "channel" from the tuple reds that test, where before the
suite stayed green.
This is also the concrete version of a worry three lanes have raised in the abstract — that
the list is hand-maintained and drifts. A full exhaustiveness pin has no authoritative
registry to check against, which is why I declined that larger ask; this is the part
that was actually achievable, and it costs four lines of test.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • The new spec clause contradicts the same paragraph and the code span=c3b0cae4175d
    self-added: yes
    mechanism: the clause now distinguishes which narrowing Delete-all adopts from the one it does not

Fixed in 2b1d751. Correct, and I verified it against the paragraph before changing it
rather than taking the finding on trust.
My clause said search_sessions() and the Delete-all key set "deliberately adopt neither
narrowing". Two sentences earlier the same paragraph states that exclude_open's "same
predicate protects a session from DELETE /api/sessions" — so Delete-all DOES adopt that
narrowing, and _clearable_history_keys is where it does. "Neither" was false, and a spec
that contradicts itself within one paragraph is worse than one that says nothing.
It now reads that the two read the same directory and deliberately do not adopt this
narrowing, notes explicitly that Delete-all does apply exclude_open, and states the
consequence: the two opt-ins differ in reach, so a content search and a bulk delete both
still see machine transcripts the pane no longer lists.
The cause is worth recording, because it is the second false claim of this shape on this PR.
I wrote that clause while the diff still contained the Delete-all changes, where "adopts
neither" was nearly true of the version in front of me; the conductor's revert then made it
plainly false, and I re-published the paragraph without re-reading its neighbours. A sentence
written against a superseded diff does not announce itself — after a revert, re-read the prose
that described what was reverted.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • The pane's search path carries no user_only and is spread first into filteredHistory span=fccbdb807220
    self-added: no
    mechanism: none — search_sessions() is scoped out by an explicit ruling; the boundary is now in the spec, not only in the thread

Not fixed. Third head for this span, and your tracing has got more precise each time —
this round naming useDebouncedSessionSearch → api.sessionsSearch / instancesSearchSessions
and the spread order into filteredHistory. I have checked each version and none of it is
wrong.
search_sessions() is excluded by an explicit ruling, and the reason is that it is not this
pane's corpus: it is the ONE ranking shared by the dashboard history filter, the
search_chat_history MCP tool and Discord session resume. Narrowing it is a decision about
three consumers with different expectations. #12370's reporter asked for it for the same
reason you are raising it, and the ruling declining it is recorded on that issue.
What changed this round is that the boundary is no longer only in these comments. The spec
paragraph in learn-cron-dashboard.md now states it: search_sessions() and the Delete-all
key set read the same directory and do not adopt this narrowing, so a content search and a
bulk delete both still reach machine transcripts the pane no longer lists. A reader of the
spec finds the limit without having to reconstruct it from what the diff omits — which is the
durable part of what you have been pointing at.
The remaining ask is a change to a shared ranking, which needs its own PR with those three
consumers surveyed. I am not going to add a fifth parameter here to reach it.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Not fixed, accurate, and already tracked. The Design lane raised the same mismatch on the
previous head (9a65bdd9a2b5) and I filed #13091 for it — "Older Sessions: the visible
set and the Delete-all set no longer agree" — which is where this belongs rather than in a
fourth revision of the confirm text.
Your reading of the copy is right: "Permanently delete all closed sessions? This cannot be
undone." scans as the list on screen, and after this PR that list is narrower than the set
_clearable_history_keys resolves. On one measured host the unstated remainder was 186
transcripts.
Why the confirm is not being changed here. That exact fix was built on an earlier head of this
PR — a count-bearing confirm, plus an empty-state hidden count, a gate change and error
handling — and a maintainer then ruled the whole Delete-all class out of this PR's scope after
four rounds of accretion on one button. website/src/pages/ChatSidebar.tsx is byte-identical
to main on this branch on purpose. Rebuilding the confirm would reverse that ruling by the
back door, so I am reporting it for an override decision instead of deciding it myself.
#13091 carries all three remedies with their tradeoffs — name the remainder in the confirm
(cheapest; both counts are already in hand), narrow the delete to match (changes a contract
other callers read, and strands machine transcripts with no UI path), or document the mismatch
honestly — and records that option 1 is where this PR's reviewers converged. It has the
deferred-finding label, an assignee and a due date, and is linked from the PR body.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 23, 2026
@chenmingwei23
chenmingwei23 merged commit e093cce into main Sep 23, 2026
137 of 138 checks passed
@chenmingwei23
chenmingwei23 deleted the fix/12370-older-sessions-namespace-filter branch September 23, 2026 16:07
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 23, 2026
wknight1 pushed a commit to wknight1/KiroCrew that referenced this pull request Oct 5, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Older Sessions lists subagent transcripts as chat rows titled with their own storage key (46% of one host's session inventory)

2 participants