Repository navigation
fix(sessions): scope Older Sessions Delete all to the rows it lists - #23638
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks: no pixels change, so no screenshot is needed. The only frontend change is the query flag sent behind the existing "Delete all". Notes
[UX-REVIEWED] a1fbb33 Description read[DESCRIPTION-READ] d485b745a9f14ad901bc609d5e789b6c6e12865bad616380be52d42fd74a34f8 That sha256 names everything this verdict read: the PR description, plus the 3 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level concerns: the list and the bulk delete now use one predicate, the flag is opt-in, and callers that omit it keep today's behaviour. [DESIGN-REVIEWED] a1fbb33 Description read[DESCRIPTION-READ] ea7c828bd7d31b9ee57c439d57c5aaf50626bc8d5546215287ff5b2fce7305c0 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix is aimed at the cause: the listing and the bulk delete now share one row filter. Two pieces of new flag surface have no caller that uses them. Notes
What this change shipsInventory (6 items) — 4 justifiedIntent: delete only the old sessions the reader can see in Older Sessions, never the hidden ones. This is a FIX (#13091).
[FIRST-PRINCIPLES-REVIEWED] a1fbb33 Description read[DESCRIPTION-READ] a80e869138febaa80bd830be0e0dad327f889b3e34a39ee8fae67000d1917fd4 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
c0f32c1 to
6989c06
Compare
🤖 AI-assisted comment 🤖 |
6989c06 to
a1fbb33
Compare
|
Review-ready on head a1fbb33.
🤖 AI-assisted comment 🤖 |
cruisercohen
left a comment
There was a problem hiding this comment.
Approving — non-security, clean.
This narrows the Older Sessions Delete all to exactly the rows the user_only=1 listing shows, so machine-namespace transcripts (subagent / secretary / wf / channel …) and never-used sessions now survive the bulk clear. What I verified:
- One shared predicate.
_is_user_listed_row/_has_user_contentare extracted and used by the listing, the clearable-count, and the clear, so the confirmation count cannot drift from the set the delete takes. - Additive opt-in, no default loosening. The SPA's Delete all sends
user_only=1; an unflaggedDELETE /api/sessionskeeps the full reach (every closed session), so memory consolidation and other callers are unchanged. - Tightening only. It deletes fewer rows, never more — I saw no over-deletion path.
- Tests: 52 pass across the clearable-count / clear / older-exclusion suites on the merge with current main; forcing
_is_user_listed_rowto list every row turnstest_user_only_clear_deletes_exactly_the_listed_rowsred, so the scoping is pinned.
Final sign-off is a maintainer's where required.
Problem / Motivation
Goal: The Older Sessions "Delete all" deletes only the sessions that pane shows, never hidden ones.
Since #13033 the pane lists with
user_only=1, which hides machine transcripts (subagent_,wf*,secretary,channel) and never-used sessions. "Delete all" still calledDELETE /api/sessionswith no filter, so it also deleted every hidden transcript. On one measured host that was 186 extra files the reader never saw.Why it matters
"Delete all" is permanent. A reader who sees 5 rows and confirms expects 5 rows gone, not 5 plus a hidden remainder of subagent and workflow history.
Not a goal
DELETE /api/sessionsclears for other callers: without the new flag it clears every closed session, as before.What changed (motivation → approach → change)
Decision (the issue was
crew: needs human; the operator asked for the most conservative fix): option 2 of the issue, made opt-in. "Delete all" now deletes exactly what the pane can show, never more. Rows the pane hides stay on disk.history_reads.py: theuser_onlyrow test moves into one shared function,_is_user_listed_row. The listing uses it unchanged.src/kiro_crew/dashboard/handlers/sessions.py: the facade manifest names the three new helpers.delete_routes.py:DELETE /api/sessionsandGET /api/sessions/clearable/countacceptuser_only=1. With it, the shared selector skips any row_is_user_listed_rowrejects. Without it, nothing changes.website/src/api/client/sessions.ts:api.clearSessions(userOnly)adds?user_only=1.website/src/store/chat/lifecycle.ts: the Older Sessions thunk passestrue.docs/system-specs/modules/learn-cron-dashboard.md: the Sessions spec now states the flagged Delete all reach and the unflagged full reach.This keeps the listing and the delete on one predicate, so they cannot drift again.
Backwards compatibility
Compatible: the flag is opt-in, and
DELETE /api/sessionswithout it clears the same set as on main.Reader: website/src/store/chat/lifecycle.ts:clearHistorySessions -- chat -- now sends
user_only=1, deletes only listed rows (testChatSliceCoverageSecondPass"records nothing when Delete all left nothing behind")Reader: src/kiro_crew/dashboard/handlers/sessions_parts/delete_routes.py:api_sessions_clear -- app -- app callers are refused by
_app_bulk_history_refusalbefore the flag is read; flagless callers unchanged (test_clear_without_user_only_still_clears_every_closed_session)Reader: src/kiro_crew/dashboard/handlers/sessions_parts/delete_routes.py:api_sessions_clearable_count -- crew page -- same flag, same selector, so the count matches the delete (
test_user_only_clear_deletes_exactly_the_listed_rows)Tests
test_user_only_clear_deletes_exactly_the_listed_rows: real files on disk. The listing, the count and the clear agree; only the listed row is unlinked;subagent_*andsecretary_*survive.test_clear_without_user_only_still_clears_every_closed_session: the flagless contract is unchanged.website/src/test/ApiClient.coverage.construction.test.tsx:clearSessions()vsclearSessions(true)URLs.website/src/test/ChatSliceCoverageSecondPass.test.tsx: the thunk callsclearSessions(true).Proof: PROVEN test/test_dashboard_sessions_clearable_count.py::test_user_only_clear_deletes_exactly_the_listed_rows (head 6989c06)
Run locally: the 4 related backend files (186 passed), the 3 related vitest files (222 passed), mypy/isort/flake8 on the changed Python files,
tsc -p tsconfig.app.json(clean). Local gpt and opus reviews: no findings.Manual verification
N/A — unit coverage sufficient: the backend test drives the real handlers over real files on disk, and the frontend change is one query flag pinned by two tests.
Screenshots / video
Why no screenshot: the pane renders the same; only the request behind "Delete all" gains a query flag.
Related Issues
Closes #13091
Sibling sweep
Swept: git grep -n "user_only" -- src website/src
Sibling: src/kiro_crew/dashboard/handlers/sessions_parts/history_reads.py -- changed here
Sibling: website/src/store/chat/lifecycle.ts -- changed here
Pattern harvest
Rule candidate: review-prompt
Pattern: a bulk action next to a filtered list must apply the same filter predicate as the list.
Checklist