Skip to content

agents claude-channel: classify first-run live events by feed head, not local clock #255

Open

Description

@bniladridas

Problem. The first-run cutoff is a local timestamp comparison: an event is treated as replayed history when created_at < started_at - 60s. If the local clock is more than 60 seconds ahead of the server, a live event delivered before the first ping can be dropped as history. A skipped message appears in the backlog count, but an unrecognised event can be consumed with no trace.

Chosen fix. An agent feed opened with start=head already sends its opening cursor frame before any event. Use that cursor as the first-run history boundary for that connection:

  • Events with ids above the opening cursor are live and bypass the local clock cutoff.
  • --start beginning, older servers that ignore start=head and send no opening cursor, and replay from a saved resume position keep the existing cutoff.
  • The boundary is per connection: a reconnect resumes from the saved cursor and does not reuse the prior opening head.

Remaining exposure. An older server that ignores start=head cannot prove the head, so a live event in its replay window can still be misclassified by clock skew. --start beginning is an explicit replay and keeps the same limitation. The stronger server guarantees, atomic head capture, ordering, and one sequence across the three endpoints, are tracked in #267.

Done when. On a start=head connection, the cutoff cannot drop a live event solely because of local clock skew, with tests for an event above the opening head whose timestamp is behind the local clock, and for genuine replayed history that remains suppressed. A focused client change is in #268.

Refs #122. Item 4 of 4. Refs #267. The rollback and design note remain in #261.

Activity

  1. bniladridas commented on Nov 15, 2026

    @bniladridas
    ContributorAuthor

    PR #261 is now a rollback and a design note. The HTTP Date header is no longer used for the first-run cutoff: it can come from an intermediary and need not share the clock that stamps created_at, so a correction in either direction has a failure mode. The cutoff stays local, and the remaining exposure is documented in planning/claude-code-channel.md §7.4 and here. The follow-up is a server-provided timestamp generated by the same clock as created_at, or the feed head position on a beginning stream so history can be classified by event id without clocks. The PR is at 335f036 and remains a draft, linked as Refs, so this issue stays open.

  2. changed the title [-]agents claude-channel: tighten first-run cutoff against clock skew[/-] [+]agents claude-channel: classify first-run live events by feed head, not local clock[/+] on Nov 15, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions