GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(id): PresenceTable capacity eviction defeats the replay watermark — future-stamped heartbeat can be replayed back to life past receipt-based expiry · Issue #9579 · developing-today/code

fix(id): PresenceTable capacity eviction defeats the replay watermark — future-stamped heartbeat can be replayed back to life past receipt-based expiry #9579

New issue
Copy link
New issue
Copy link
Closed
#9584
Closed
fix(id): PresenceTable capacity eviction defeats the replay watermark — future-stamped heartbeat can be replayed back to life past receipt-based expiry#9579
#9584
Copy link
Labels
app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/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/pr-diff-reviewFiled by the pr-diff-review jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Description

@dezren39
dezren39
opened on Nov 13, 2026
Issue body actions

Finding

PR #4160's PresenceTable capacity eviction selects its victim by effective stamp only. That defeats the replay watermark the table's own pruning path maintains: a future-stamped heartbeat that is evicted once its effective stamp ages past the TTL — while its sender stamp still passes the freshness bound — can be replayed and re-inserted with a later effective stamp, resurrecting the node past its receipt-based expiry. prune_at was explicitly written not to do this (#8865); the eviction path added by #4160 was not given the same guard.

Worked timeline (current main, pkgs/id/crates/id-cli/src/chat_presence.rs; PRESENCE_TTL_SECS = 75 at :110, MAX_FUTURE_SKEW_SECS = 10 at :124):

  1. At receipt time T, a heartbeat stamped T+10 (inside the skew allowance) is accepted; its effective stamp is clamped to T (:395).
  2. At T+76, the entry is expired by effective stamp (76 > 75), so at capacity it is the eviction candidate (:406-424, filter at :409). Its sender stamp is only 66s old, so prune_at would have retained it as a replay watermark (:556-571, retain rule at :569).
  3. The evicted entry is gone, so a replay of the same heartbeat at T+76 passes the freshness bound (:356: age 66 ≤ 75), finds no existing entry to pin the effective stamp (:396-400 applies only when an entry exists), and is re-inserted with effective stamp min(T+10, T+76) = T+10.
  4. The node now reads Live until T+85 — 10s (one full skew allowance) past the documented bound: "no claim can outlive effective_ts + PRESENCE_TTL_SECS — at most one TTL from receipt — no matter when copies of it arrive" (:335-337).

Evidence

  • PR: fix(id): bound PresenceTable with stale-only eviction #4160 fix(id): bound PresenceTable with stale-only eviction #4160 (MERGED, head 6b99c3a175d2eb603efd73fdf7bbbeda3e47efbf, merge ccdfacd24537f74b851e6ecef978bb9c945d728c, confirmed ancestor of main, compare behind=0)
  • Verified on main ef16105eebb6d865960cde9f6bc1094b355000ee, pkgs/id/crates/id-cli/src/chat_presence.rs: eviction filter :406-424 (effective stamp only); prune_at watermark rationale :556-571; freshness bound :356-360; effective-stamp pinning for existing entries :395-400; invariant statement :335-337.
  • fix(id): bound PresenceTable with stale-only eviction #4160's own tests (node_count_bound_evicts_oldest_expired_entry_at_capacity, now at :1230) use a past-stamped victim (age 80 at eviction) whose replay would fail the freshness bound anyway — the future-stamped victim case is not covered.
  • Dedupe: all-state searches for PresenceTable eviction, presence eviction replay, and PresenceTable returned only id(chat-presence): PresenceTable has no node-count bound — every distinct self-signed key is stored for a full TTL, so minted keys grow serve's memory without limit #4004 (the bound request, CLOSED by fix(id): bound PresenceTable with stale-only eviction #4160), fix(id): bound PresenceTable with stale-only eviction #4160 itself, and the Design: one guarded door — every gossip claim enters through its table (pkgs/id presence + peers) #4502 design umbrella — none covers eviction-vs-watermark interaction. Source-traced from the three code sites above; no runtime repro (the window needs a full 1,000-entry table plus a replay inside the skew-extended window).

Why it matters

The effective-stamp machinery (#8865) exists precisely so replayed gossip cannot extend a node's claimed liveness past one TTL from receipt. The capacity bound (#4004) exists for the adversarial case — a flood of minted keys filling the table. Combined, an attacker who can fill the table can force eviction of a future-stamped victim and then replay that victim's captured heartbeat to keep it "live" past its receipt-based expiry, in skew-sized increments of table churn. Narrow (≤10s per cycle, needs a full table), but it silently breaks a stated invariant in exactly the adversarial conditions both mechanisms were built for.

Acceptance criteria

  • Capacity eviction never removes an entry whose sender stamp still passes the freshness bound (the prune_at watermark rule), OR a replayed heartbeat can never gain a later effective stamp than its first acceptance earned — one of the two, with the invariant at :335-337 holding under both prune and eviction.
  • A regression test mirrors the timeline above: fill the table, insert a future-stamped (within skew) heartbeat, advance past effective-stamp expiry but not sender-stamp expiry, force a capacity admission, replay the heartbeat, and assert the node does not read Live past its original effective_ts + PRESENCE_TTL_SECS.
  • Existing presence tests still pass, including node_count_bound_* and the id(chat-presence): separate future clock skew from the presence TTL #8865 replay/skew tests.

Filed by pr-diff-review-b (Lane B PR diff review, run 2026-11-13 09:18 CST) from review of PR #4160.

Activity

  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    source/pr-diff-reviewFiled by the pr-diff-review job
    priority/lowNice to have; do when convenient
    queue/queuedHas a queued queue task
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 13, 2026
  2. developing-today commented on Nov 13, 2026

    @developing-today
    developing-todayBot
    on Nov 13, 2026 – with developing.today
    Contributor
    More actions

    CODE-3176

  3. dezren39
    added
    effort/sSmall: expected under 2 hours of work
    on Nov 13, 2026
  4. dezren39 commented on Nov 13, 2026

    @dezren39
    dezren39
    on Nov 13, 2026
    MemberAuthor
    More actions

    agent-note:v1
    Agent: pr-diff-review-b
    State: filed
    Repo: developing-today/code
    Source PR: #4160 (#4160, merged ccdfacd)
    Finding: PresenceTable capacity eviction (chat_presence.rs:406-424 on main) picks its victim by effective_ts only, so a future-stamped heartbeat evicted after effective expiry — while its sender stamp still passes freshness — can be replayed and re-inserted with a later effective stamp, living until original effective+85s instead of +75s, breaking the :335-337 invariant; prune_at (:556-571) explicitly retains such entries as replay watermarks (#8865), eviction does not.
    Verified against main: ef16105 (contents reads of chat_presence.rs; PR merge confirmed ancestor, compare behind=0)
    Evidence: hidden_files/pr-review-b-2026-11-13-0918/issue-presence-eviction-body.md + diff-4160.patch

  5. dezren39 commented on Nov 13, 2026

    @dezren39
    dezren39
    on Nov 13, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up + triaged inline — Agent: queue worker (repo-worker-code), lane code-a — task 16122 (triage) for issue #9579.

    Fresh revalidation (2026-11-13T16:28Z): issue #9579 OPEN, no held / user/owned / do-not-merge / do-not-auto-edit labels; PR #4160 MERGED (merge ccdfacd) and ancestor of main per the packet evidence. No competing PR found in the packet or issue state.

    Triage (inline, per the lane runbook): work kind small-fix (task/small-fix replaces task/triage) — the defect is one guarded branch in the update_at eviction path in pkgs/id/crates/id-cli/src/chat_presence.rs, plus one regression test. Priority low stands (narrow window: ≤10s per cycle, needs a full 1,000-entry table plus a replay inside the skew window — but it breaks a stated #8865 invariant under the adversarial flood conditions #4004's bound addresses). Effort s stands. kind/bug already present.

    First concrete step: mirror prune_at's watermark rule in the capacity-eviction victim filter — never evict an entry whose sender stamp still passes the freshness bound at the eviction instant; fall back to the existing expired-by-effective-stamp victim only among watermark-safe entries, and if none qualifies, keep the current no-eviction behavior for that admission.

    Acceptance check: the issue's regression timeline as a test (full table + future-stamped heartbeat + advance past effective-but-not-sender expiry + capacity admission + replay → node does not read Live past original effective_ts + PRESENCE_TTL_SECS), and all existing chat_presence tests pass, including node_count_bound_* and the #8865 replay/skew tests.

    Continuing to the fix in this same claim.

  6. dezren39
    added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 13, 2026
  7. developing-today
    added
    status:in-review
    on Nov 13, 2026
  8. dezren39
    added a commit that references this issue on Nov 13, 2026

    Merge pull request #9584 from developing-today/queue/16122-9579-prese…

    6d6d7e8
  9. dezren39
    closed this as completedin #9584on Nov 13, 2026
  10. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 13, 2026
  11. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 13, 2026
  12. dezren39 commented on Nov 13, 2026

    @dezren39
    dezren39
    on Nov 13, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done — Agent: queue worker (repo-worker-code), lane code-a — task 16122 (triage → small-fix, fixed in the same claim) for issue #9579.

    PR #9584 MERGED at 2026-11-13T16:36:20Z, merge commit 6d6d7e8; issue #9579 CLOSED by the merge; fix commit 2c0b332 verified as an ancestor of origin/main.

    What changed (pkgs/id/crates/id-cli/src/chat_presence.rs only): the capacity-eviction victim filter now requires the sender stamp to also be past PRESENCE_TTL_SECS — exactly the prune_at replay-watermark rule (#8865) — so an entry whose sender stamp still passes the freshness bound is never evicted, and a capacity admission with no watermark-safe victim is refused. Doc comments at the bound bullet and the eviction site state the rule.

    Tests (laptop, fleet-build-lock): new regression node_count_bound_never_evicts_a_watermark_live_entry_9579 mirrors the issue timeline and passes (it discriminates: on the old filter the admission evicts the victim and the replay reads Live one skew allowance past the receipt-based bound); chat_presence 27/27; full id-cli crate 671 + 7 + 7 passed, 0 failed; cargo fmt --check clean. Codex review on PR #9584 failed to run (Codex usage limits, fleet-wide) and produced no findings; CodeRabbit completed NEUTRAL with no findings.

  13. dezren39 commented on Nov 13, 2026

    @dezren39
    dezren39
    on Nov 13, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done (already_done) — Agent: queue worker (repo-worker-code), lane code-a — task 16137 (small_fix follow-on of triage task 16122) for issue #9579.

    This follow-on packet was created at task 16122's completion, but the fix had already landed inside that same claim: PR #9584 MERGED 2026-11-13T16:36:20Z (merge commit 6d6d7e8) and issue #9579 is CLOSED. Fresh verification this claim: issue state CLOSED; fix commit 2c0b332 is an ancestor of origin/main; the regression test node_count_bound_never_evicts_a_watermark_live_entry_9579 is present in chat_presence.rs on origin/main. No duplicate work performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/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/pr-diff-reviewFiled by the pr-diff-review jobstatus:donetask/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

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.