Skip to content

aggregator(card-state): a restore cancelled by a later restore still cancels its target — undo-of-undo is a no-op when the first restore was applied #4310

Closed

Description

@dezren39

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 — cancelledActionIds collects the supersedes target of every restore whose state is not superseded and not rejected. It never checks whether that restore's own id is cancelled by another restore.
  • pm-stack/aggregator/src/card-state.ts:66-69 — effectiveActions removes 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 rejected restore 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 in test/actions.test.ts), and a still-new restore loses its cancellation when a later action supersedes it, because ActionsStore.add marks it superseded (pm-stack/aggregator/src/actions.ts:612-614, new-state only) and cancelledActionIds excludes superseded. An applied restore 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 in supersedes, 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):

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

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/lowNice to have; do when convenient
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    effort/sSmall: expected under 2 hours of work
    on Nov 2, 2026
  2. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 2, 2026
  4. 68 remaining items

  5. added and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 2, 2026
  6. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    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.

  7. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 2, 2026
  8. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    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

  9. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    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.

  10. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    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.

  11. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/aggregatorPackage/app: aggregator (pm-stack in this repo)app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions