Repository navigation
Description
Bug
cardState's restore derivation is not transitive: a restore that is itself cancelled by a later restore still cancels its own target. Undoing an undo is a no-op — but only when the first restore was already applied; when it is still new, the store supersedes it and the undo-of-undo works. The same user intent therefore has opposite outcomes depending on consumer timing.
Evidence (main b7cc5356)
pm-stack/aggregator/src/card-state.ts:55-62—cancelledActionIdscollects thesupersedestarget of every restore whose state is notsupersededand notrejected. It never checks whether that restore's own id is cancelled by another restore.pm-stack/aggregator/src/card-state.ts:66-69—effectiveActionsremoves the cancelled restore itself from the effective set, so the second restore demonstrably registered — yet the first restore's cancellation of its target survives in the set computed from the full list.- Contrast the two paths that do work: a
rejectedrestore does not cancel (aggregator: a REJECTED restore still cancels its target in card-state — dismissed/snoozed cards resurface even though the consumer refused the restore #1474, pinned by tests intest/actions.test.ts), and a still-newrestore loses its cancellation when a later action supersedes it, becauseActionsStore.addmarks itsuperseded(pm-stack/aggregator/src/actions.ts:612-614, new-state only) andcancelledActionIdsexcludessuperseded. Anappliedrestore cannot be superseded by the store, so the derivation is the only place its cancellation can be lifted — and it isn't. validateNewAction(actions.ts:405-407) accepts a restore naming any action id insupersedes, including another restore, so this state is reachable through the public boundary.
Verified this run with a laptop probe (~/git/fleet/probe-2026-11-02-laneB-restorechain/probe.ts on the laptop, importing the byte-identical card-state.ts at md5 c8c1372e, run with bun):
- A: dismiss(applied) + restore(new, supersedes=dismiss) → cancelled=[dismiss], suppressed=null — restore works.
- B: dismiss(applied) + restore1(applied, supersedes=dismiss) + restore2(new, supersedes=restore1) → cancelled=[dismiss, restore1], effective=[restore2], suppressed=null — restore2 removed restore1 from the effective set but the dismiss stays cancelled; the card never comes back.
- C: dismiss(applied) + restore(rejected, supersedes=dismiss) → cancelled=[], suppressed=dismissed — the aggregator: a REJECTED restore still cancels its target in card-state — dismissed/snoozed cards resurface even though the consumer refused the restore #1474 behavior.
- D: dismiss(applied) alone → suppressed=dismissed.
Why it matters
cardState is the documented single derivation truth for renderers and consumers ("renderers and tests share one truth", card-state.ts header). A card dismissed, restored by an applied restore, and then un-restored stays restored forever: the suppression the user explicitly reinstated silently never applies, and no later action short of a fresh dismiss/snooze/done re-suppresses it. The same flaw applies to every verb a restore can cancel (ack, answer, snooze, done), not just dismiss.
Acceptance criteria
cancelledActionIds(or its replacement) computes cancellations to a fixpoint: a restore whose own id is cancelled by an effective restore does not cancel its target — mirroring the existingsuperseded/rejectedexclusions.- Regression tests in the aggregator suite cover: applied dismiss + applied restore + new restore-of-restore → card is suppressed again (
dismissed); the chain also works at depth 3 (restore-of-restore-of-restore re-restores); aggregator: a REJECTED restore still cancels its target in card-state — dismissed/snoozed cards resurface even though the consumer refused the restore #1474's rejected-restore tests and the existing restore tests still pass. - No change to store persistence or the action record shape; derivation-only fix in
card-state.ts.
Activity
dezren39 commentedon Nov 2, 2026
🤖 Agent note · filed
68 remaining items
dezren39 commentedon Nov 2, 2026
agent-note:v1
event: picked-up
task: 6185 (repo-health-code-pilot, OpenChamber scheduled lane)
state: claimed
verified: Fresh metadata at 2026-11-02T14:52Z: #4310 OPEN; PR #4321 OPEN, non-draft, authored by Drew, on the task branch queue/6185-4310-restore-chains. No PR contents inspected.
next: park for 30m naming PR #4321 as the ownership stop; resume only after closure, explicit handoff, or ownership change and fresh revalidation.
dezren39 commentedon Nov 2, 2026
agent-note:v1
event: parked
task: 6185 (repo-health-code-pilot, OpenChamber scheduled lane)
state: parked until 2026-11-02T15:23Z (30m)
blocker: PR #4321 is OPEN, non-draft, Drew-authored, and uses queue/6185-4310-restore-chains. This is an ownership stop; PR contents were not inspected and no files were touched in this run.
resume: After PR #4321 closes, Drew explicitly hands off ownership, or ownership otherwise changes; revalidate issue and PR metadata fresh first.
links: #4310 · PR #4321 · task 6185
dezren39 commentedon Nov 2, 2026
agent-note:v1
event: done
task: 6185 (repo-health-code-pilot, repo-worker-code; OpenChamber scheduled lane)
state: done (already_done)
evidence: Fresh gh metadata confirmed #4310 CLOSED and PR #4321 MERGED. Queue task completed with outcome=already_done; prior recorded tests were dashboard-overhaul 29/29 passing and aggregator 1034 passing with one pre-existing web-push load failure verified on clean main. No files or worktree touched.
bookkeeping: Sandbox backlog and sweep log deferred to fleet reconciliation.
dezren39 commentedon Nov 2, 2026
agent-note:v1
event: picked_up
task: 6185 (repo-health-code-pilot, repo-worker-code; OpenChamber scheduled lane)
state: claimed
verified: Fresh metadata after claim: issue #4310 CLOSED; PR #4321 MERGED, non-draft, Drew-authored on queue/6185-4310-restore-chains. PR contents and worktree not inspected or touched.
next: Complete as already_done; no implementation or competing PR needed.