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 — id(chat-presence): separate future clock skew from the presence TTL · Issue #8865 · developing-today/code

id(chat-presence): separate future clock skew from the presence TTL #8865

New issue
Copy link
New issue
Copy link
Closed
#8881
Closed
id(chat-presence): separate future clock skew from the presence TTL#8865
#8881
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/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Description

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

Problem

Presence accepts a heartbeat timestamp up to a full PRESENCE_TTL_SECS into the future, then computes liveness and pruning from that sender-provided timestamp. A node whose clock is ahead can therefore remain reported live for nearly two TTLs after its heartbeat is received, despite the documented TTL describing how long a heartbeat keeps a node live.

Evidence (current main 12b3fb6b29914f9f675558ea3d9e27f13ca31487)

  • pkgs/id/src/chat_presence.rs:61-63 sets the presence TTL to 75 seconds.
  • PresenceTable::update_at (:277-280) accepts a heartbeat as far as 75 seconds in the future.
  • liveness_at and prune_at (:330-335, 440-446) use now.saturating_sub(heartbeat.ts) <= PRESENCE_TTL_SECS. Thus, with receipt now=1000 and accepted ts=1075, the node is live immediately and through now=1150: up to 150 seconds after receipt. roster_at (:384-398) uses the same age calculation for liveness and typing; it also exposes the sender's future timestamp as last_seen (:390-393).
  • The tests reject u64::MAX (:688-690) but do not cover the accepted future-skew boundary or expiry relative to receipt time.
  • The id(chat): presence heartbeat protocol over gossip (ephemeral, TTL-based) #2809 protocol contract specifies a 60–90 second TTL but does not define a future-clock-skew allowance. Reviewed 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 and Design: one guarded door — every gossip claim enters through its table (pkgs/id presence + peers) #4502 as adjacent presence work; neither tracks this timestamp/expiry behavior.

Why it matters

Clock skew—or a self-signed heartbeat with a future timestamp—can make an absent member appear online substantially longer than the advertised TTL. Future last_seen values and typing indicators can also mislead roster consumers.

Suggested fix

Define a future-skew allowance independently of the liveness TTL, and make the expiry contract explicit. Consider tracking local receipt time for presence expiry while retaining the signed sender timestamp only as metadata, or another policy that prevents permitted future skew from extending liveness beyond the documented bound. Apply the same rule consistently to liveness, typing, roster output, and pruning.

Acceptance criteria

  • Document the maximum future-skew allowance separately from PRESENCE_TTL_SECS and define whether expiry is measured from sender timestamp or local receipt.
  • Add boundary tests at the allowed skew and just beyond it.
  • Test that an accepted future-dated heartbeat cannot keep liveness/typing past the documented bound from receipt; ensure last_seen has defined behavior and cannot misleadingly be future-dated unless explicitly intended.
  • Preserve out-of-order and replay protections.

Activity

Next
  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
    on Nov 12, 2026
  2. developing-today commented on Nov 12, 2026

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

    CODE-2677

  3. dezren39
    added
    status/needs-triageNot yet triaged; needs a first look
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    on Nov 12, 2026
  4. dezren39 commented on Nov 12, 2026

    @dezren39
    dezren39
    on Nov 12, 2026
    MemberAuthor
    More actions

    🤖 Agent note · triaged

    • Agent: triage-step
    • State: triaged — fix-ready, fix packet enqueued (queue task 15092, repo-health-code-pilot)

    Verdict: task/small-fix — a bounded fix in pkgs/id/src/chat_presence.rs. Presence accepts a heartbeat up to a full PRESENCE_TTL_SECS (75s) into the future and computes liveness/pruning from that sender timestamp, so permitted future skew stretches liveness to ~150s after receipt and roster_at can expose a future-dated last_seen.

    Priority: priority/normal (stands) — per Drew's priorities brief line 5 (everything else by usefulness): this is a real correctness bug, but it does not stall the fleet (line 1 reserves the top band for fleet-stalling breakage) and it is not part of the ID design-track expedite set (line 2). Effort: effort/s (stands). Kind: kind/bug (already present).

    First concrete step: add a failing boundary test in the chat_presence tests — a heartbeat received at now=1000 with ts=1075 currently stays live through now=1150 — then define a future-skew allowance independent of PRESENCE_TTL_SECS.

    Acceptance check for the fix: the skew allowance is documented separately from the TTL with an explicit expiry basis (sender timestamp vs local receipt); boundary tests pass at the allowed skew and just beyond it; an accepted future-dated heartbeat cannot keep liveness/typing past the documented bound from receipt and last_seen is not misleadingly future-dated unless explicitly intended; out-of-order and replay protections preserved and existing chat_presence tests pass.

    Duplicate check: the issue records #4004/#4502 reviewed as adjacent presence work — neither tracks this timestamp/expiry behavior; no canonical duplicate. Queue check at triage: no live task for this issue in repo-health-code-pilot under any segment.

  5. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    on Nov 12, 2026
  6. 2 remaining items

  7. dezren39
    added a commit that references this issue on Nov 12, 2026

    fix(id): retain presence entries as replay watermarks until the sende…

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

    @dezren39
    dezren39
    on Nov 12, 2026
    MemberAuthor
    More actions

    🤖 Agent note · parked (CI wait)

    • Agent: repo-worker-code-d (task 15092)
    • State: parked — PR fix(id): separate future clock skew from the presence TTL (#8865) #8881 opened and CI pending; task 15092 parked with a CI ready-condition on PR fix(id): separate future clock skew from the presence TTL (#8865) #8881 (broker wait, resumes from ~2026-11-12T08:59:53Z or on wake when checks complete)

    Done so far: PR #8881 (head d7619c5) implements the fix in pkgs/id/src/chat_presence.rs: MAX_FUTURE_SKEW_SECS = 10 documented separately from PRESENCE_TTL_SECS, expiry from a receipt-clamped effective stamp, last_seen never future-dated, and prune_at retaining entries as replay watermarks until the sender stamp expires. Targeted tests: cargo test -p id --lib chat_presence — 23 passed (incl. 4 new #8865 tests). Codex review: first round P2 (replay-after-prune resurrection) fixed in d7619c5 and replied on the thread; re-review of the new head completed with no findings.

    Resume: read PR #8881 check state fresh; if green, merge (squash per repo practice) and complete task 15092 as fixed_merged; if a check fails, fix forward on branch queue/15092-8865-presence-skew. Known unrelated blocker for a full-suite run: tests/probe_attestation_sign.rs does not compile at the base commit (untouched files) — noted on the PR.

  10. dezren39 commented on Nov 12, 2026

    @dezren39
    dezren39
    on Nov 12, 2026
    MemberAuthor
    More actions

    state: parked (CI wait)
    lane: code-d (task 15092, resumed from prior CI park)
    pr: #8881 head d7619c5 — MERGEABLE, diff in scope (pkgs/id/src/chat_presence.rs only)
    codex: re-review of head d7619c5 completed, has_unresolved_findings=false; round-1 P2 fixed and thread replied last shift
    tests: cargo test -p id --lib chat_presence 23/23 (prior shift, laptop)
    ci: original check set was CANCELLED en masse at 2026-11-12T08:06Z/08:48Z (fleet-wide cancellation event, tracked on #8866); the one FAILURE was the mcpx-test ci-ok aggregator over cancelled jobs. This shift re-ran the id workflow (run 43179052880); after a 5-minute poll it is still in_progress with no failures.
    next: when PR #8881 checks complete green, merge PR #8881 and complete task 15092 as fixed_merged; issue #8865 closes via the PR.

  11. dezren39
    added a commit that references this issue on Nov 12, 2026

    fix(id): separate future clock skew from the presence TTL (#8865) (#8881

    5f31d7a
  12. dezren39
    closed this as completedin #8881on Nov 12, 2026
  13. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 12, 2026
  14. dezren39 commented on Nov 12, 2026

    @dezren39
    dezren39
    on Nov 12, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: repo-worker-code / code-b
    • State: done — PR fix(id): separate future clock skew from the presence TTL (#8865) #8881 merged
    • Artifact: PR fix(id): separate future clock skew from the presence TTL (#8865) #8881 (fix(id): separate future clock skew from the presence TTL (#8865) #8881), merge commit 5f31d7a. MAX_FUTURE_SKEW_SECS=10 documented separately from PRESENCE_TTL_SECS; expiry receipt-bounded via effective stamp min(sender ts, receipt); last_seen never future-dated.
    • Verification: cargo test -p id --lib chat_presence 22 passed (per PR body, lane code-d); CI id builds without world feature SUCCESS; Codex review: no findings on head d7619c5. Remaining CI failures were the mass-cancellation pattern (ci: PR workflow runs cancelled en masse before finishing (PR #8858 runs, 2026-11-12); one mcpx run stuck queued #8866) and pre-existing main defects, including the boards.rs line-limit failure since fixed by PR refactor(id): split boards.rs below production line limit #8902.
    • Next: none — issue closed by merge.
  15. dezren39
    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 12, 2026
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/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator 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.