Skip to content

fix(dashboard): hold a closing session out of the sidebar until the server omits it - #11225

Merged
iamwhatever merged 2 commits into
kirodotdev:mainfrom
Pearcekieser:fix/session-close-flicker-20260916
Sep 16, 2026
Merged

iamwhatever merged 2 commits into
kirodotdev:mainfrom
Pearcekieser:fix/session-close-flicker-20260916

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Closing a session from the Sessions sidebar (hover ✕ or row menu → Close) removes the row, brings it back a moment later, then removes it again. It is most visible with many open sessions and long-context chats, where the server-side close takes longer and slot pushes are frequent.

Why it matters

The sidebar is how you know what exists. A row that vanishes, returns and vanishes again at the exact moment you act on it reads as "did that take?", and the reflex is to click again — on a row that may already be gone, or on the neighbour that has shifted into its place. It also made a refused close and a flickering close look identical.

What changed (motivation → approach → change)

Symptom → cause. deleteSlot removes the row optimistically (removeSlotOptimistic) and then awaits the DELETE. On the server, _close_slot keeps the slot in state._slots across several awaits (auto-nudge retirement under the AutoNudge lock, the app teardown hook, the history save) before popping it, and push_slots_update coalesces on a 200 ms window that re-serializes at delivery time. So a slots frame listing the closing slot as live is ordinary, and an in-flight GET /api/chat/slots reply assembled before the click says the same. Both authoritative writers (sseSlots, fetchSlots.fulfilled → applySlots) took membership at face value and re-inserted the row; the first post-pop frame removed it again.

Approach. Fix it where both writers converge, on the client, with no wire change. #6807 attacks the same symptom with server-side incarnation / epoch / generation stamps across 22 files; that adds a protocol surface for a race that the client can already recognise on its own: it knows which key it is closing, and it knows when the server has stopped listing it.

Change. dashboardSlice gains closingSlots: Record<string, number>, a per-key close tombstone:

  • Armed by a type-string matcher on chat/deleteSlot/pending (same import-cycle-avoiding pattern as the existing createSlot.fulfilled matcher). pending is dispatched before the thunk body's removeSlotOptimistic, so the hold exists by the time the row leaves the list.
  • applySlots filters held keys out of the list it applies. Everything else about the frame still lands — other rows, slotsGeneration, the unread drain — and reconcileSlots still sees the frame's full membership, so a held slot's sub-agent state is not evicted before the close is confirmed (the existing "a failed close leaves the slot live" invariant).
  • A list that omits the key does not release the hold. The two writers are unordered with each other — fetchSlots.fulfilled already documents that a reply can be older than live frames that arrived while it travelled — so a post-pop frame releasing the hold would let a pre-pop reply still in flight re-add the row. The tombstone is retired by the close's own lifecycle instead: by a same-key addSlotOptimistic / createSlot.fulfilled (a resume or fork under the closing key), and on failure by releaseCloseHold, which the thunk dispatches in its catch before the recovery fetchSlots — chat/deleteSlot/rejected also releases, but it fires only after the thunk's trailing await navigation (an unbounded peer transcript load), so the refetch reply could otherwise be filtered by the very hold it exists to undo.
  • Confirmed at the right moment: the thunk dispatches confirmCloseHold as soon as deleteChatSlot resolves, not on fulfilled (which trails the unbounded await navigation), so a successful close whose peer transcript load outlasts the in-flight cap is not expired as if it had stalled.
  • Bounded twice over. deleteChatSlot carries no deadline, so while the request is in flight the hold expires on the wall clock (CLOSE_IN_FLIGHT_MAX_MS, 30 s): a close the server never answers degrades to the pre-fix behaviour (the row visibly comes back), not to a session hidden until reload. After fulfilled it outlives CLOSE_CONFIRMED_GRACE_FRAMES (3) further authoritative lists, listing the key or not (live pushes coalesce on 200 ms, so a frame serialized before the pop is among the first few after the 200), and every fetchSlots request that was already in flight at the 200: fetchSlots.pending/fulfilled/rejected maintain slotFetchesInFlight, the fulfilled matcher snapshots it onto the hold's awaitingFetches, and the hold is not retired until those have settled — a pre-pop HTTP reply can trail the pop by a whole round trip, which no frame budget bounds. The confirmed phase carries its own wall-clock cap (CLOSE_CONFIRMED_MAX_MS, 30 s) for the same reason the in-flight phase does: chatSlots() has no deadline, so a snapshotted fetch that never settles must not pin the tombstone until reload. Unlike the in-flight case the server has confirmed this close, so a reply from one of those fetches is known to be pre-pop: the ids still awaited at expiry go into staleSlotFetches (request → closed keys) and fetchSlots.fulfilled distrusts only those keys in such a reply (once the stream has delivered a snapshot): for each, the row currently on screen — if the key has since been recreated — is kept in place of the reply's pre-pop row, otherwise the key is dropped; the rest of the payload still applies, so an unrelated change it carries is not thrown away. Then it yields to membership, so a server that keeps listing a slot it claimed to close cannot hide a live session indefinitely.
  • Owner-scoped: each hold records the deleteSlot attempt's requestId; fulfilled, rejected and releaseCloseHold act only on the attempt that owns the hold. A same-key retry takes the hold over, so attempt 1's rejected (which trails an unbounded peer navigation) cannot release attempt 2's hold.

Scope. Only deleteSlot gets a hold. The other two removeSlotOptimistic sites — switchSlot's 404 eviction and the artifact companion-chat close — remove the row only after the server has already answered, so they have no in-flight window and are exposed to the post-confirmation straggler window alone; the general form needs the DELETE lifecycle that only deleteSlot has. Tracked separately in #11255.

Every dynamic access to closingSlots sits behind the slice's existing isUnsafeKey guard (prototype keys are refused at the pending writer rather than letting Immer throw and leave the DELETE undispatched), the same convention as the other per-slot maps in the slice.

Row identity for untouched rows is preserved through the filter (the applySlots identity contract chatSlice's 404 eviction leans on is unchanged).

Tests

website/src/test/dashboardSlice.closeTombstone.test.ts (23 tests) drives the reducer with the exact action sequence deleteSlot emits, interleaved with sseSlots / fetchSlots.fulfilled frames:

  • a live frame and a stale HTTP reply that still list the closing key do not re-insert it (the flicker) — mutation-checked: removing the in-flight hold fails this test
  • the rest of the frame still applies (other rows, generation bump)
  • an omitting frame does NOT release an in-flight hold, so a stale reply landing after it is still filtered
  • after the 200, a post-pop omission followed by a stale reply and a coalesced straggler are all held; the hold retires after the frame budget and a later same-key session is ordinary membership again
  • hold through any number of frames while the request is in flight; expires past the 30 s wall-clock cap (fake timers)
  • release on rejected, so the refetch restores the row; and via releaseCloseHold when the refetch reply lands before rejected
  • superseded by same-key addSlotOptimistic and createSlot.fulfilled
  • a fetchSlots in flight at confirmation keeps the hold alive through six omitting frames until its stale reply lands, which is still filtered; a fetch started after confirmation is not waited for; a snapshotted fetch that never settles releases on the 30 s confirmed-phase cap, and when its reply finally lands — including when that reply is itself the first list after the cap — only the closed key is filtered out while an unrelated rename in the same reply still applies; a same-key session recreated before the stale reply lands keeps its on-screen row; a later fetch applies normally (fake timers, all mutation-checked)
  • a same-key retry owns the hold: attempt 1's late rejected and fulfilled are ignored
  • concurrent closes tracked independently
  • a held slot's sub-agent state is not evicted before an omitting frame
  • untouched row identity is kept through a filtered frame
  • prototype keys (__proto__ / constructor / prototype) are refused without throwing in any tombstone reducer — mutation-checked: without the guard Immer throws Object.setPrototypeOf() cannot be used on an Immer draft

website/src/test/ChatSliceCoverage.test.tsx adds two thunk-level tests running the real deleteSlot: one with a slow-but-successful DELETE and the peer navigation parked past the in-flight cap (the hold is confirmed at the 200, and a straggler frame at 40 s does not resurrect the row — mutation-checked by removing the thunk's confirmCloseHold), and one against a rejecting DELETE with the peer navigation parked: the recovery refetch restores the row and the tombstone is empty before rejected fires — mutation-checked: removing the catch-side releaseCloseHold fails it.

Neighbouring suites (156 files touching dashboardSlice / sseSlots / deleteSlot, 3,220 tests), tsc and eslint pass.

Manual verification

N/A — the defect is a reducer-level race between two action streams and the unit tests replay exactly that interleaving. No new UI element, layout or copy; the only observable difference is that the closed row no longer comes back for one frame.

Related Issues

Fixes #11224
Related: #6807 (server-side approach to the same symptom), #10024 (close latency on the same gesture)

Pattern harvest

Rule candidate: review-prompt
Pattern: "optimistic removal followed by an authoritative full-list writer that treats membership as truth; the removed key needs a tombstone until the authority omits it"

Checklist

  • At most two commits (one is the norm) — two here: the fix, then the review hardening (bounded in-flight hold, catch-side release, prototype-key guard), with a Conventional Commits title (feat|fix|docs|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

…erver omits it

Closing a session removed its row, then a slots frame serialized before the
server-side pop put it back, then the post-pop frame removed it again.
dashboardSlice now keeps a per-key close tombstone, armed on
chat/deleteSlot/pending and released by the first authoritative list that
omits the key, by rejection, by a same-key recreate, or after a bounded
number of post-confirmation straggler frames.

Fixes kirodotdev#11224
@Pearcekieser
Pearcekieser requested review from a team and CrysisDeu September 16, 2026 06:38
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 16, 2026
@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5, fork) — ✅ PASS

UX-level review of 72058342e74d1400b7818ffae9e9b768d2805b33 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Verify a slow, refused close reads acceptably: the row now stays hidden up to 30 s before the recovery refetch silently restores it.

[UX-REVIEWED] 7205834

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — 🟡 CONCERNS

Premise-level review of 72058342e74d1400b7818ffae9e9b768d2805b33 via the fork AI-review pipeline — 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: CONCERNS

staleSlotFetches guards a >30 s-stalled fetch reply — a failure the change's own two wall-clock caps already accept as a brief reappearance — with a third state map.

Not justified as shipped

  • Item 5 — oversized: the diff's own comment calls a stalled snapshotted fetch "the same failure the in-flight cap exists for", and at both CLOSE_IN_FLIGHT_MAX_MS and the omitting-frame case the design deliberately degrades to "the row visibly comes back" — yet this one interleaving (fetch in flight at confirmation, stalled past 30 s, then delivering) gets staleSlotFetches, markStaleSlotFetches, staleKeysForSlotFetch, the recreated-key on-screen-row preservation, and a fetchSlots.fulfilled filter block.
    Subtraction: delete staleSlotFetches and its three helpers plus the fetchSlots.fulfilled filter; on confirmedUntil expiry drop the hold outright, accepting the same ≤200 ms reappearance the other two caps accept.
    Clears when: the deletion is made, or a reproduction shows a >30 s-stalled chatSlots() reply resurrecting a closed row in practice.

Sibling count for the record: removeSlotOptimistic has 3 non-test dispatch sites (grepped removeSlotOptimistic, website/src); the 2 unheld ones are declared and tracked in #11255 — accepted-and-deferred, not a finding.

What this change ships

Inventory (10 items) — 9 justified

Intent: FIX — stop a closed session's sidebar row from vanishing, reappearing, and vanishing again (#11224).

  1. A closing session's row stays gone instead of flickering back (per-key close tombstone) — justified
  2. A close the server never answers shows its row again after 30 s, not hidden until reload — justified
  3. After a confirmed close the row stays gone through 3 straggler lists, then yields to membership — justified
  4. A confirmed close also outwaits slot refetches that were in flight at confirmation — justified
  5. A refetch stalled past 30 s has the closed key filtered from its late reply, keeping a recreated same-key row — oversized (guards a failure both wall-clock caps already accept as a brief reappearance)
  6. A failed close's row is restored by the recovery refetch even when it beats rejected — justified
  7. Resuming or recreating a closing key shows it again immediately — justified
  8. A same-key close retry cannot be undone by the first attempt's late lifecycle actions — justified
  9. Two exported store actions and three new state keys back the tombstone — justified
  10. The dashboard spec paragraph documents the tombstone in the same commit — justified

[FIRST-PRINCIPLES-REVIEWED] 7205834

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed 72058342e74d1400b7818ffae9e9b768d2805b33 via the fork AI-review pipeline; updated in place on each push.

Review details

FINDING -- website/src/store/dashboardSlice.ts:990 -- after reconnect clears slotsLoaded, the state.slotsLoaded gate lets a delayed pre-close fetch resurrect the closed row -> Fix: run staleKeysForSlotFetch whenever requestId exists.
[GPT-REVIEWED] 7205834

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 72058342e74d1400b7818ffae9e9b768d2805b33 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify the close gesture once on a live many-session dashboard — the race was only replayed in reducer tests, never rendered.

[DESIGN-REVIEWED] 7205834

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review (fork) — ✅ no blocking findings

Reviewed 72058342e74d1400b7818ffae9e9b768d2805b33 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 7205834

@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 16, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Both Design watch items at ff4e3d9 are addressed in 9ec22ff10:

Deadline-less DELETE. The in-flight hold now expires on the wall clock: chat/deleteSlot/pending stamps inFlightUntil = now + CLOSE_IN_FLIGHT_MAX_MS (30 s) and applySlots drops the hold on the first frame past it, so a stalled _close_slot degrades to the pre-fix visible reappearance rather than a session hidden until reload. Pinned by stops hiding a session whose DELETE has stalled past the wall-clock cap (fake timers, 29 s held / 31 s shown).

Refetch landing before rejected. deleteSlot's catch now dispatches releaseCloseHold(key) before fetchSlots(); rejected still releases as belt-and-braces. Pinned at the thunk level by restores a failed close's row from the recovery refetch that beats rejected in ChatSliceCoverage.test.tsx (real deleteSlot, rejecting DELETE, peer navigation parked on an unresolved transcript load) — removing the catch-side release fails it — and at the reducer level by lets the failure-path refetch restore the row even when it lands before rejected.

@Pearcekieser
Pearcekieser force-pushed the fix/session-close-flicker-20260916 branch from 9ec22ff to 518c08a Compare September 16, 2026 07:43
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

GPT F1 at 9ec22ff10 (prototype key in the pending matcher) is fixed in 518c08a5c. The finding was real in mechanism — without the guard, reducer(state, pending('__proto__')) throws [Immer] Object.setPrototypeOf() cannot be used on an Immer draft, so the thunk's pending dispatch would fail and the DELETE never run — even though no key writer emits that string.

Fix: the chat/deleteSlot/pending matcher returns early on isUnsafeKey(action.meta.arg) (the slice's existing guard, as used by sseSubagentStatus / sseSubagentText), the fulfilled read is guarded the same way, and all four release sites go through one releaseHold helper that refuses prototype keys. Pinned by refuses prototype keys instead of throwing inside the pending reducer in dashboardSlice.closeTombstone.test.ts, which drives pending / fulfilled / rejected / releaseCloseHold with each of the three keys and asserts no throw, an empty record, and an unchanged prototype — mutation-checked by removing the guard.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Both findings at 518c08a5c addressed in bbc2eb8cd.

GPT F1 (omission releases the hold; stale HTTP reply re-adds the row). Confirmed real — the reorder is exactly the one fetchSlots.fulfilled already documents — and fixed without adding transport provenance: an omitting list no longer releases the hold at all. The tombstone is retired by the close's own lifecycle: unconditional while the DELETE is in flight (wall-clock capped), then after fulfilled it outlives CLOSE_CONFIRMED_GRACE_FRAMES further authoritative lists of either transport, listing the key or not, then yields. Counting omissions against the budget is what keeps a stale reply that lands after an omitting frame filtered. Pinned by does not let an omitting frame release an in-flight hold and keeps holding after the 200 through a post-pop omission followed by a stale reply in dashboardSlice.closeTombstone.test.ts; mutation-checked by restoring the omission-release branch, which fails both. Retirement after the budget is pinned by retires a confirmed hold after the frame budget so a later same-key session shows.

First Principles (two sibling removeSlotOptimistic sites without a hold). Accepted and recorded as #11255. Both switchSlot's 404 eviction and the artifact companion-chat close remove only after the server has already answered, so they have no in-flight window and are exposed to the post-confirmation straggler window alone; the general form needs the DELETE lifecycle only deleteSlot has. The PR body's Scope paragraph and the spec section now say so and link the issue.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 16, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/session-close-flicker-20260916 branch from bbc2eb8 to f7e70f6 Compare September 16, 2026 09:17
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Both GPT findings at bbc2eb8cd addressed in f7e70f603, structurally rather than by widening the frame budget.

F1 (a pre-close fetchSlots reply trailing the pop by 3+ frames). The frame budget now bounds only live stragglers. HTTP replies are tracked by request: fetchSlots.pending/fulfilled/rejected maintain slotFetchesInFlight, the deleteSlot/fulfilled matcher snapshots it onto the hold's awaitingFetches, and applySlots keeps holding while any of those is unsettled — however many frames arrive first. A fetch started after the 200 is answered from the post-pop registry and is not waited for. settleSlotFetch runs after that reply's own applySlots, so the stale reply itself is still filtered. Tests: outlives a fetch that was in flight at confirmation, however many frames arrive first (six omitting frames, then the stale reply — filtered, hold retired) and does not wait for a fetch that started after confirmation; mutation-checked by dropping the awaitingFetches condition.

F2 (attempt 1's late rejected releases attempt 2's hold). Each hold now records the owning deleteSlot requestId; fulfilled, rejected and releaseCloseHold act only on a hold they own, and a same-key pending takes the hold over. Test: lets a same-key retry own the hold; the earlier attempt's late rejected is ignored (also asserts attempt 1's stale fulfilled cannot move attempt 2 off the clock); mutation-checked by making releaseHold owner-agnostic.

The two Windows backend shard failures at bbc2eb8cd (test_ledger_edge_concurrency flush timeout, gw2 worker crashes in test_ledger_edge_fanout / test_session_ledger_emit) are in Python ledger-emitter tests; this PR touches no file under src/kiro_crew.

@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 16, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 16, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/session-close-flicker-20260916 branch from 8e8a1da to 1a7d8cf Compare September 16, 2026 15:15
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

GPT F1 at 8e8a1da3f (a successful close whose peer navigation outlasts the in-flight cap expires its hold before fulfilled confirms it) fixed in 1a7d8cfa0, exactly as suggested: the thunk now dispatches confirmCloseHold({ key, requestId }) the moment deleteChatSlot resolves, before await navigation; fulfilled still confirms as belt-and-braces (idempotent). Pinned at the thunk level by confirms the close hold when the DELETE resolves, before the peer navigation settles in ChatSliceCoverage.test.tsx (fake timers: DELETE resolves at 25 s with navigation parked; a straggler frame at 40 s — past where the in-flight cap would have expired — does not resurrect the row); mutation-checked by removing the thunk-side dispatch. 161 files / 3,219 tests, tsc, eslint green.

Design's advisory (server-stamped monotonic list generation as the durable resolution of this staleness class) is recorded on #11255 as the preferred direction for that follow-up.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 16, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/session-close-flicker-20260916 branch from 1a7d8cf to 83b22b4 Compare September 16, 2026 16:10
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

GPT F1 at 1a7d8cfa0 (whole-payload drop of a stale reply discards unrelated updates) changed in 83b22b4b0 as suggested: staleSlotFetches is now request → closed keys, and fetchSlots.fulfilled filters only those keys out of the reply while the rest of the payload applies (applySlots + reconcileSlots run on the filtered rows). Pinned by filters only the closed key out of a stalled pre-confirmation reply that lands after the cap and the first-list-after-cap variant, both asserting an unrelated rename carried by the same stale reply still lands; mutation-checked by removing the filter. 161 files / 3,219 tests, tsc, eslint green.

Backend Tests (Windows) (8) at 1a7d8cfa0 failed on test_workflows_run_identity::test_simultaneous_services_never_share_run_identity (10 s wall-clock workflow timeout, Python) — unrelated to this frontend-only diff.

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

Review hardening on the tombstone from the first commit:
- deleteChatSlot has no deadline, so the in-flight hold expires on the wall
  clock (30s) and degrades to the pre-fix visible reappearance.
- The failure path's fetchSlots reply can land before deleteSlot/rejected,
  so the thunk releases the tombstone in its catch before refetching.
- Prototype keys are refused at every dynamic closingSlots access.
- An omitting list no longer releases the hold: the HTTP and live writers
  are unordered, so a post-pop frame could release it and a pre-pop reply
  then re-add the row. The hold is retired by the close lifecycle instead:
  unconditional in flight, then a fixed budget of further lists plus every
  fetchSlots request that was in flight at the 200.
- Holds are owned by the deleteSlot requestId, so a stale attempt's
  rejected cannot release a same-key retry's hold.

Sibling removal sites without a hold are tracked in kirodotdev#11255.
@Pearcekieser
Pearcekieser force-pushed the fix/session-close-flicker-20260916 branch from 83b22b4 to 7205834 Compare September 16, 2026 16:52
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

72058342e fixes two things at 83b22b4b0:

Frontend Lint & Type Check — TS7006 on the stale-key filter ((s) => ... needed (s: ChatSlot)), which also cascaded into Build Wheel / Build Desktop / E2E. Verified with npm run typecheck (tsc -p tsconfig.app.json) and eslint src; my earlier local check was against the solution tsconfig.json, which checks nothing — that mistake is mine and is now fixed in my workflow.

GPT F1 (a stale reply's filter drops a same-key session recreated meanwhile) — fixed as suggested: for a distrusted key, fetchSlots.fulfilled keeps the row currently on screen in place of the reply's pre-pop row (and drops the key only when nothing is on screen for it), so a live recreated session and its unread state survive. Pinned by keeps a same-key session recreated meanwhile when the stale reply lands (asserts the on-screen row identity is preserved); mutation-checked by reverting to the drop. 161 files / 3,220 tests green.

@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 16, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

On the First Principles item 5 at 72058342e (staleSlotFetches + helpers oversized for a >30 s stall): agreed on the size, and the subtraction it proposes — drop the hold outright at confirmedUntil expiry and accept the brief reappearance — is exactly what 37ee331ca shipped. The GPT lane then fenced that as a blocking security-class finding ("expired hold applies the stale reply it was waiting for", 37ee331ca), and fenced each narrower shape after it (90ab4ae5d, 1a7d8cfa0, 83b22b4b0); a fenced finding blocks readiness regardless of adjudication and clears only by maintainer override. The stale-fetch handling is the minimal code that satisfies that lane rather than something the fix needs on its own merits. Leaving it in, since FP is advisory and GPT is blocking; a maintainer who prefers the subtraction can record the override and I will make it in the same push. The durable resolution for the whole class (server-stamped list generation) is recorded on #11255.

@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 16, 2026
@iamwhatever
iamwhatever enabled auto-merge (squash) September 16, 2026 18:06

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tier 1 auto-approve: fix (5 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: holds a closing session's sidebar row out of the list until an authoritative list omits it, fixing the row that reappeared mid-close (#11224); tests cover the tombstone lifecycle. Spec files changed as a ride-along (a minority of the diff on both file count and changed lines), not reviewed as a design decision: docs/system-specs/modules/learn-cron-dashboard.md. CodeQL is not applicable on this fork PR (default-setup emits no check-run); SAST coverage is Semgrep only, latest run success with 0 annotations.

@iamwhatever
iamwhatever merged commit ab1cd29 into kirodotdev:main Sep 16, 2026
86 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 16, 2026
amadsalmon pushed a commit to amadsalmon/KiroCrew that referenced this pull request Sep 22, 2026
…erver omits it (kirodotdev#11225)

* fix(dashboard): hold a closing session out of the sidebar until the server omits it

Closing a session removed its row, then a slots frame serialized before the
server-side pop put it back, then the post-pop frame removed it again.
dashboardSlice now keeps a per-key close tombstone, armed on
chat/deleteSlot/pending and released by the first authoritative list that
omits the key, by rejection, by a same-key recreate, or after a bounded
number of post-confirmation straggler frames.

Fixes kirodotdev#11224

* fix(dashboard): retire the close hold by the close's own lifecycle, bounded and prototype-safe

Review hardening on the tombstone from the first commit:
- deleteChatSlot has no deadline, so the in-flight hold expires on the wall
  clock (30s) and degrades to the pre-fix visible reappearance.
- The failure path's fetchSlots reply can land before deleteSlot/rejected,
  so the thunk releases the tombstone in its catch before refetching.
- Prototype keys are refused at every dynamic closingSlots access.
- An omitting list no longer releases the hold: the HTTP and live writers
  are unordered, so a post-pop frame could release it and a pre-pop reply
  then re-add the row. The hold is retired by the close lifecycle instead:
  unconditional in flight, then a fixed budget of further lists plus every
  fetchSlots request that was in flight at the 200.
- Holds are owned by the deleteSlot requestId, so a stale attempt's
  rejected cannot release a same-key retry's hold.

Sibling removal sites without a hold are tracked in kirodotdev#11255.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Closing a session from the sidebar makes the row reappear, then disappear again

2 participants