[codex] Fix visited timestamp under clock skew#2408
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: 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. |
Co-authored-by: codex <codex@users.noreply.github.com>
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.tsbun fmtbun lint(passes with existing warnings)bun typecheckNote
Fix visited timestamp in
markThreadVisitedunder clock skewactiveLatestTurn.completedAtas a second argument tomarkThreadVisited, so the stored timestamp reflects the server's completion time rather than the local clock.markThreadVisitedin the UI state store to avoid overwriting a stored timestamp with an earlier one, preventing regressions under clock skew.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.completedAttimestamp when a settled turn completes, instead of implicitly using the client wall clock.Updates
markThreadVisitedto accept an explicitvisitedAtand 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 for commit ccafe71. Bugbot is set up for automated code reviews on this repo. Configure here.