Repository navigation
fix(dashboard): report a partial Older Sessions Delete all - #20807
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (8 items) — 8 justifiedIntent: when "Delete all" in Older Sessions leaves sessions on disk, the person who clicked it finds out instead of seeing a fake success. FIX (closes #13083).
[FIRST-PRINCIPLES-REVIEWED] bd42c46 Description read[DESCRIPTION-READ] a80f3077bfeb2e0a0bfde94f39c9851917c68682057ef7e24c9ead31af839e20 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Confirm that the agent hand-off from a "Delete all" notice works without a session key; the 200-shortfall refusal has [DESIGN-REVIEWED] bd42c46 Description read[DESCRIPTION-READ] 997852b59ed5aa69be5142269de751886aed6b006a2f7e790cd857091ca999fa 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 |
UX Review (Opus 5.5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS The several-row notice doesn't tell readers which fix applies: it gives one reason for three kept sessions, then says both "repair first" and "just press Delete all again." Watch
Suggestions
[UX-REVIEWED] bd42c46 Description read[DESCRIPTION-READ] 3ec52b1793be8346d3389e20cf69f2f2349e9457f0b478a535f0b51ae78cc517 That sha256 names everything this verdict read: the PR description, plus the 7 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ 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: |
11b3586 to
c638b88
Compare
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
c638b88 to
6af05e8
Compare
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
6af05e8 to
59cbca3
Compare
|
self-added: yes
|
|
self-added: yes
|
|
|
|
|
|
|
eb37384 to
770fa1d
Compare
|
Rebased onto |
|
|
|
|
|
770fa1d to
b86412e
Compare
|
Rebased onto |
|
|
|
|
b86412e to
bd42c46
Compare
|
Rebased onto |
chenmingwei23
left a comment
There was a problem hiding this comment.
Approved: readiness: passed, no conflicts, checks green.
Problem / Motivation
Goal: When the Older Sessions "Delete all" leaves sessions on disk, the dashboard says so instead of looking like it worked.
"Delete all" in the Older Sessions pane always looked like a success. The gateway answers
DELETE /api/sessionswith 200 and puts the outcome in the body (ok,failed,undeletable). The sidebar never read that body. Andokwasfailed == 0, so a row reported inundeletablestill gaveok: true.Why it matters
The reader asked to delete their closed sessions forever, and the confirm dialog says it cannot be undone. When some stay on disk, a silent "success" is worse than a visible failure: they have no way to tell, and no hint of the remedy.
Not a goal
failedrows an id in the response.What changed (motivation → approach → change)
A partial or refused "Delete all" now shows the same notice a refused single delete shows, above the chat.
Root cause: the click handler awaited
api.clearSessions()and moved on, so a 200 shortfall read as success; and the gateway'sokignoredundeletable.The fix has two parts. In
dashboard/handlers/sessions.py,okis nowfailed == 0 and not undeletable. In the dashboard, a newclearHistorySessionsthunk (store/chat/lifecycle.ts) reads the body and rejects with a value on either failure, into the existingundeletableHistorystate.historyDeleteRefusalMessage(utils/historyDeleteRefusal.ts) renders it, so a left-behind row reads like the single delete. Five new strings go to every locale catalog, worded with each locale’s own "Older sessions" and button labels (pluralKeys.jsonlists the two plural ones; the deleted-count variant readsclearedfrom the 200 body). The spec line inlearn-cron-dashboard.mdnames theokrule.Backwards compatibility
Breaking:
DELETE /api/sessionsnow answersok: falsewhenundeletableis not empty (it wastrue). Writer sweep on origin/main @ a790373: the only caller iswebsite/src/api/client/sessions.tsclearSessions, used once byChatSidebar.tsx, which this PR changes to readok. No CLI, MCP tool or app calls it. The tests pinning the old value (test/test_dashboard_sessions_clear.py,test/test_remove_slot_for_history_key_owner_sweep.py) are updated.Removes nothing: no key, row, route or field is removed; one boolean's value narrows.
Tests
test/test_dashboard_sessions_clear.py,test/test_remove_slot_for_history_key_owner_sweep.py: a clear with an undeletable row answersok: false.prove.py: PROVEN (red with the oldok).website/src/test/ChatSliceCoverageSecondPass.test.tsx:clearHistorySessionsrecords nothing on full success; names rows and countsfailedon a 200 shortfall; records a refused request by code; clears the notice on the next attempt.website/src/test/historyDeleteRefusal.test.ts: each bulk sentence, plural forms, the deleted-count opening line, the unreadable remedy on a refused request, the three-row cap, one part per line, and the retry line only for rows not named, and the one-row case equal to the single delete.website/src/test/ChatSidebarCoverage.test.tsx: clicking "Delete all" with a 200 shortfall sets the notice. Red on the old handler, green on the fix.website/src/store/chatSlice.ownership.test.ts,website/src/store/chatSlice.publicSurface.test.ts: pin the newclearHistorySessionsexport and itschat/clearHistorySessionsaction type.src/i18n/style/*Style.test.ts, run withI18N_BASE_REF): the new strings keep each locale’s informal register and the fr U+202F spacing.Determinism: the changed frontend files passed 3 shuffled runs (
--sequence.shuffle, seeds 11/22/33, 170/170 each). The two backend files passed 3 repeats under xdist and one shuffled node-id order (72/72 each). No timers, sleeps or wall clocks in the new tests.Manual verification
Rendered the real built SPA with stubbed
/api/**(no gateway), same technique asscripts/capture-history-delete-refusal.mjs: opened Older sessions, clicked "Delete all", accepted the confirm. Checked three answers: a several-row shortfall, a one-row shortfall, and a refused request. Each rendered the notice text in the table above.Screenshots / video
Several rows left behind (2 deleted, 2 failed, 1 undeletable), one part per line:
One named row left behind while two were deleted:
Whole request refused with no known cause:
Whole request refused because the cron store could not be read:
Related Issues
Closes #13083
Pattern harvest
Rule candidate: review-prompt
Pattern: a client awaits an endpoint that answers 200 with its own
ok: falseoutcome and never reads the body.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)