Skip to content
Source
Sign inSign up
pingdotgg/t3code

[codex] Fix visited timestamp under clock skew #2408

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/2408/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Summary

Fixes #2087.

This updates the settled-turn visited marker to use the server-provided turn completion timestamp instead of falling back to the client wall clock. That prevents the active thread from repeatedly trying to mark itself visited when the client clock is slightly behind the server completion time.

A focused regression test now covers preserving provided visited timestamps and refusing to move visit state backwards under skew.

Validation

  • bun run --filter @t3tools/web test -- uiStateStore.test.ts
  • bun fmt
  • bun lint (passes with existing warnings)
  • bun typecheck

Note

Fix visited timestamp in markThreadVisited under clock skew

  • Updates ChatView.tsx to pass activeLatestTurn.completedAt as a second argument to markThreadVisited, so the stored timestamp reflects the server's completion time rather than the local clock.
  • Updates markThreadVisited in the UI state store to avoid overwriting a stored timestamp with an earlier one, preventing regressions under clock skew.
  • Adds two unit tests in uiStateStore.test.ts covering the new timestamp storage and the clock skew guard.
Macroscope summarized ccafe71.

Note

Medium Risk Changes the read/unread visit timestamp logic, which could affect badge/visited state across threads if timestamps are malformed or comparisons are incorrect, but the scope is small and covered by new tests.

Overview Fixes thread visit tracking so the UI records the server-provided latestTurn.completedAt timestamp when a settled turn completes, instead of implicitly using the client wall clock.

Updates markThreadVisited to accept an explicit visitedAt and to no-op when the incoming timestamp is older than the stored one (guarding against clock skew), with new unit tests covering both behaviors.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ccafe71b7efa83f1ed3da3403558c63be29c6db9. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: 1bab22bc-8649-4f5c-b243-9b2812958741

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `codex/fix-clock-skew-visited`

      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. gameroman(GitHub profile, opens in a new tab) approved these changes

    4. Approvability

      Verdict: Approved

      Straightforward bug fix that passes a server-provided timestamp to avoid client clock skew issues. The change is minimal and well-tested, with no impact beyond the specific edge case being addressed.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. juliusmarminge merged this22b7d8c

    6. juliusmarminge closed this

Sign in to join this conversation.