Skip to content

=== LAST HANDOFF === inflates its own delivery counter on every compaction #341

Closed

Description

@fdaviddpt

Found while implementing #339, left untouched there because narrowing it inside that change would have been a silent scope extension.

What the user sees

A handoff note that was delivered once announces itself as already delivered 5 times. The number climbs through a session without anyone opening a new one.

Mechanism

At source=compact (and clear, and fork) the handoff fingerprint is unchanged from the previous fire, so scripts/session-start-hook.sh:878 takes the "already delivered" branch and increments DELIVERIES. SessionStart fires on all five sources; the counter is written as though it fired only on new sessions.

The counter's own wording — "already delivered N times" — is a claim about how many sessions have seen the note. A compaction is not a new session, and #206 already established exactly this rule for the capture-alive store: "SessionStart firing does not mean a new session id exists." This is that rule being violated one feature over.

Why it matters beyond the wrong digit

The count is what a reader uses to decide whether a handoff is stale and can be ignored. Four auto-compactions in one long session turn a note delivered once into one that reads as thoroughly seen — so the number does not merely drift, it argues for dismissing content that has in fact been read once.

Fix direction, not a prescription

#339 adds SESSION_START_SOURCE to this file, whitelisted and defaulting to empty. Gating the increment on it is now a one-line change. Whether clear and fork should also be excluded is the judgment call: clear genuinely replaces the context, so arguably it is a fresh delivery, while compact plainly is not.

Worth pinning with a test either way — the current behaviour has no coverage that distinguishes a second session from a second fire.

Activity

  1. added
    priority:medium
    on Aug 10, 2026
  2. added
    cohort-1
    on Aug 27, 2026
  3. self-assigned this
    on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cohort-1priority:medium

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions