Skip to content

fix(dashboard): arm the close tombstone at confirmed-removal sites - #13902

Merged
chenmingwei23 merged 1 commit into
mainfrom
fix/confirmed-close-hold-11255
Sep 25, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
fix/confirmed-close-hold-11255

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Two places remove a chat row after the server already said the session is gone:

  • switchSlot's 404 eviction in website/src/store/chatSlice.ts.
  • The companion-chat "New chat" archive in website/src/pages/ArtifactDetailPage.tsx.

Neither arms the close tombstone that #11225 added. A slot list built before the server dropped the row can still land after the removal. That list puts the row back for one frame, and the next list removes it again.

Why it matters

The sidebar flickers a dead session back in. #11225 fixed this for deleteSlot. These two sites are the siblings it left open.

What changed (motivation → approach → change)

Symptom: a removed row blinks back for one frame. Cause: only deleteSlot.pending writes a hold into closingSlots, and these two sites have no deleteSlot lifecycle to hang one on.

Approach: the issue's per-site form. A new reducer, armConfirmedCloseHold(key) in website/src/store/dashboardSlice.ts, writes the hold straight into its confirmed phase. It reuses the same budget as a confirmed deleteSlot: CLOSE_CONFIRMED_GRACE_FRAMES lists, the CLOSE_CONFIRMED_MAX_MS wall-clock cap, and the fetchSlots requests in flight at that moment. Both sites dispatch it right before removeSlotOptimistic.

server says gone ─▶ armConfirmedCloseHold(key) ─▶ removeSlotOptimistic(key)
                                  │
     stale list with key ─────────┴─▶ held out (3 lists / in-flight fetches / 30 s cap)

The hold's requestId is a fixed 'confirmed' marker. No deleteSlot lifecycle action ever matches it, so only the budget retires it. addSlotOptimistic for the same key still clears it, as for any hold. The server-generation redesign discussed on the issue is not attempted here. The close-tombstone paragraph in docs/system-specs/modules/learn-cron-dashboard.md now describes these two sites as armed.

Backwards compatibility

Compatible: adds one reducer; no existing action, state shape or API changes.

Tests

  • website/src/test/dashboardSlice.closeTombstone.test.ts: the new hold survives three straggler lists and then yields to membership; it outlives a fetchSlots already in flight; a same-key re-add clears it; prototype keys are refused.
  • website/src/store/chatSlice.switchSlotRejection.test.ts: the announced 404 eviction dispatches armConfirmedCloseHold then removeSlotOptimistic.
  • website/src/test/ArtifactDetailPage.companionChat.test.tsx: after "New chat", a straggler frame listing the archived key does not bring it back.

Red-before: with the two site dispatches removed, both site tests fail; with them in, all 98 tests in the three files pass. tsc -p tsconfig.app.json and eslint --max-warnings 0 on the changed files are clean.

Manual verification

N/A — unit coverage sufficient: the race is between reducer actions, which the tests drive directly.

Screenshots / video

Why no screenshot: the fix removes a one-frame reappearance; no steady-state pixels change.

Related Issues

Closes #11255

Pattern harvest

Not generalizable: the general form (server-stamped list generations) is already tracked on #11255 as the preferred follow-up direction.

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 pepmach September 25, 2026 17:46
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 25, 2026
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ✅ PASS

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

UX-Verdict: PASS

Nothing to check.

[UX-REVIEWED] 3134586

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 31345866ce545450b29d18683c6814c3c7966d53 — 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 issue #11255 actually records the per-site hold as the endorsed interim form — the description claims it, and the issue is the only place that claim lives.

What this change ships

Inventory (5 items) — 5 justified

Intent: stop a server-removed chat row from flickering back for one frame at the two removal sites #11225's tombstone missed — a FIX.

  1. A 404-evicted session no longer blinks back into the sidebar for a frame — justified
  2. Companion-chat "New chat" no longer blinks the archived row back — justified
  3. New exported Redux action armConfirmedCloseHold other code may dispatch (2 consumers counted: chatSlice.ts:2565, ArtifactDetailPage.tsx:1327) — justified
  4. Spec paragraph now describes both sites as armed, replacing the documented-gap sentence — justified
  5. Three test files gain straggler-frame coverage for the confirmed hold — justified

Grep dispatch(removeSlotOptimistic counts 3 production sites; the third is deleteSlot itself, already held via pending, so no sibling is left unfixed. The deferred cause (server-stamped list generations) is declared in the description and tracked on #11255.

[FIRST-PRINCIPLES-REVIEWED] 3134586

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

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

Design-Verdict: PASS

Verify a real deleteSlot arming over an existing 'confirmed' hold on the same key overwrites it cleanly — no test pins that overlap.

[DESIGN-REVIEWED] 3134586

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 31345866ce545450b29d18683c6814c3c7966d53 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 3134586

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

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 31345866ce545450b29d18683c6814c3c7966d53 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 3134586

Verdict parsed from the review's SHA-scoped output markers for commit 31345866ce545450b29d18683c6814c3c7966d53.

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

switchSlot's 404 eviction and the artifact companion close remove a slot the server already confirmed gone, but armed no close hold, so a pre-pop straggler list could re-add the row for a frame. Add armConfirmedCloseHold, which writes the hold straight in its confirmed phase, and dispatch it at both sites.

Closes #11255
@iamwhatever
iamwhatever force-pushed the fix/confirmed-close-hold-11255 branch from a26bbb8 to 3134586 Compare September 25, 2026 18:07
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 25, 2026
@chenmingwei23
chenmingwei23 merged commit d83895d into main Sep 25, 2026
94 checks passed
@chenmingwei23
chenmingwei23 deleted the fix/confirmed-close-hold-11255 branch September 25, 2026 23:08
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 25, 2026
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.

Arm the close tombstone at the two post-confirmation removeSlotOptimistic sites

2 participants