Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(auth): explain DPoP clock-skew failures #8383

Closedjuliusmarmingewants to merge 1 commit intomain fromt3code/improve-clock-skew-errorsopened View on GitHub

juliusmarmingecommented

What Changed

Propagate detected DPoP clock skew through environment and relay authentication errors, while preserving existing wire-compatible error reasons. Clients now show actionable guidance to enable automatic date and time on the affected devices. Added focused coverage across shared DPoP verification, server and relay auth boundaries, client runtimes, web, mobile, and contracts, plus remote-access documentation.

Why

DPoP proofs are rejected when device clocks differ from the verifier clock, but the previous generic credential errors made the cause difficult to diagnose. Exposing the measured offset lets clients distinguish clock synchronization problems from other authentication failures and recover without relinking environments or regenerating credentials.

UI Changes

No layout or visual UI changes. Existing connection and environment-link error messages now provide clock-synchronization guidance when the server identifies DPoP clock skew.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Medium Risk Changes authentication error shapes and messaging across server, relay, and clients, but preserves existing error reasons and only adds optional fields; incorrect skew propagation could mislead users or leak timing detail.

Overview When DPoP proof verification fails because the proof is outside the allowed time window, verifyDpopProof now returns a measured clockSkewSeconds offset (proof iat minus verifier time) alongside the existing failure reason.

That offset is carried through environment server and relay auth layers into EnvironmentAuthInvalidError and RelayAuthInvalidError as an optional field, while keeping the same wire reason values (invalid_credential / invalid_dpop) for compatibility. Web, mobile, and client-runtime connection error mapping now show clock-sync guidance when clockSkewSeconds is present, instead of generic DPoP or credential failures.

Docs add a Clock Sync Errors section for remote access; tests cover shared verification, server/relay boundaries, contracts, and client decoding.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 8e686c7d890af9f1f57e950e1957a30bee065f11. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add clockSkewSeconds to DPoP verification failures across stack

  • verifyDpopProof in dpop.ts now computes clockSkewSeconds as iat - nowEpochSeconds and includes it in the failure result when the proof falls outside the allowed time window.
  • The value propagates end-to-end: relay raises DpopProofClockSkewError, server includes clockSkewSeconds in ServerAuthInvalidCredentialError and 401 EnvironmentAuthInvalidError responses, and client-runtime/UI layers surface a clock-sync guidance message instead of the generic DPoP rejection text.
  • Added a "Clock Sync Errors" section to remote-access.md instructing users to enable automatic date and time.
  • Behavioral Change: DpopProofReplay.verifyAndConsume in DpopProofs.ts now fails with DpopProofClockSkewError instead of Unauthorized when a time-window violation carries clockSkewSeconds; callers relying on the Unauthorized error type for clock-skew cases should check for the new tagged error.
Macroscope summarized 8e686c7.
    1. 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 Plus

      Run ID: c59d8fb5-c974-4164-9c2c-8a6a416bd6a6

      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

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

    3. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.3 KiB13.3 KiB+19 B (+0.1%)15.1 KiB✅
      CodexThread snapshot wire6.9 KiB6.9 KiB+10 B (+0.1%)7.3 KiB✅
      CodexLive turn WebSocket wire6.4 KiB6.4 KiB+9 B (+0.1%)7.8 KiB✅
      CodexLive turn WebSocket decoded55.6 KiB55.6 KiB0 B (0.0%)66.4 KiB✅
      CodexLive turn messages11110 (0.0%)21✅
      ClaudeTotal thread wire13.4 KiB13.3 KiB−2 B (−0.0%)15.1 KiB✅
      ClaudeThread snapshot wire6.9 KiB6.9 KiB−6 B (−0.1%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.5 KiB6.5 KiB+4 B (+0.1%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded56.4 KiB56.4 KiB0 B (0.0%)66.4 KiB✅
      ClaudeLive turn messages11110 (0.0%)21✅

      Baseline: a6797b3 · PR result: 8e686c7 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 109.4 KiB
      • Claude decoded thread snapshot: 110.1 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    4. Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR changes production DPoP authentication handling across the shared verifier, relay, server HTTP/WebSocket boundaries, wire contracts, and client messaging. Although the change is additive and focused on clearer clock-skew diagnostics, authentication-sensitive changes require human review.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. Superseded by #8351, which now carries the typed DPoP failure categories, cautious legacy fallback, focused clock-skew integration coverage, and the shared web/mobile error presentation.

    6. juliusmarminge closed this

Sign in to join this conversation.