Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(client-runtime): a slow host no longer shows settings as read-only #25526

Mergedyordis(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/25526/headmerged by juliusmarminge View on GitHub

A slow session response should not leave permission-gated Settings read-only. The client retries only session timeouts with increasing deadlines, then returns the final timeout; other failures keep their existing behavior.

Capture interactions also exercise existing provider toggles, which can reset the provider-status probe; the resulting status differences are disclosed below.

Original description by @yordis

Problem

When a host takes longer than 6 seconds to answer the session request (busy machine, slow relay or tunnel), the request times out and the client treats the missing session as missing grants. Settings and other permission-gated controls then show as read-only even though the user has full access, and they stay that way until the session atom revalidates.

Change

fetchEnvironmentSessionState now treats a session timeout as "no answer yet" rather than a failure. It retries with a doubled timeout each time, and if the 60 second attempt also times out, the timeout error surfaces so a dead host is not waited on forever. Every other error, including a rejected credential, still fails immediately as before. The error type is pinned to RemoteEnvironmentRequestError so the exported web session atoms keep a type TypeScript can name.

Scope and approval

This is a small, focused fix for an obvious bug in an existing path: a timeout tells us nothing about grants, so it should not be reported as if the user lacked them. It changes only the session fetch in packages/client-runtime and adds no settings or UI.

Verification

  • Added waits longer for session permissions each time the environment is too slow to answer in environmentHttpAuth.test.ts. It fails on main (the request is never retried, so the test times out) and passes with this change.
  • Added gives up on session permissions once the longest wait also times out, covering the bounded retries.
  • vp test run src/state/environmentHttpAuth.test.ts src/state/commandPermissions.test.ts in packages/client-runtime: 48 passed.
  • vp run typecheck in packages/client-runtime and apps/web: no errors. vp lint on the changed files: clean.

Takeover

Credit to @yordis for the report and original fix; their commit remains in this branch. The two regression tests now fail by assertion on main. A request with increasing timeouts replaces the counter/logarithmic retry count, and main is merged without rebasing. Default attempts are 6, 12, 24, 48 and 60 seconds. Credential rejection, renewal, grants and server authorization retain their existing behavior.

Evidence

Fixture matrix · Runtime fixture clarification · Capture index · Final proof audit

Chromium 156 on Linux, DPR 1, no device emulation, 1440×900 or 390×844; light/dark and reduced motion. Two real isolated environments; only the secondary session endpoint is delayed. Cold loads have no cached grants; warm rows use genuine cached grants and explicit runtime revalidation after 31 seconds.

R1: cold, 8-second answers. R2: warm, 8-second answers. R3: cold, held requests. R4: warm, held requests. Recordings retain real time: baseline fails at 6 seconds; head retries at 6/18/42/90 seconds and finally fails at 150 seconds. Each recording and checkpoint has request/state timestamps in the capture index. R1/R2 after recordings include saving and restoring a setting.

Diff0: absolute channel delta ×8. Diff8: maximum channel delta >8/255, ×8. The table embeds the pending checkpoint; each row links its written steps and video timestamps above the paired recordings on its full evidence page; the index includes all retry/terminal frames, diffs, recordings, request ownership and executable capture scripts.

Fixture / viewport / theme / pageBefore dd5b540After 8fbfc33Diff0Diff8
R1 / 1440 / light / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R1 / 1440 / light / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R1 / 1440 / dark / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R1 / 1440 / dark / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R1 / 390 / light / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R1 / 390 / light / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R1 / 390 / dark / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R1 / 390 / dark / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R2 / 1440 / light / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R2 / 1440 / light / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R2 / 1440 / dark / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R2 / 1440 / dark / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R2 / 390 / light / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R2 / 390 / light / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R2 / 390 / dark / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R2 / 390 / dark / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R3 / 1440 / light / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R3 / 1440 / light / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R3 / 1440 / dark / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R3 / 1440 / dark / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R3 / 390 / light / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R3 / 390 / light / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R3 / 390 / dark / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R3 / 390 / dark / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R4 / 1440 / light / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R4 / 1440 / light / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R4 / 1440 / dark / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R4 / 1440 / dark / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R4 / 390 / light / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R4 / 390 / light / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R4 / 390 / dark / general
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8
R4 / 390 / dark / providers
Written video steps + timestamps
Before recordingAfter recordingDiff0Diff8

What else changed: cold controls remain disabled/loading while awaiting real grants, then become editable after a late response. Warm controls retain cached permissions during the wait, then lose them after final failure. The existing provider toggle invalidates its normal status probe; post-interaction status may show “Not found/not checked.” The recorded R3 driver continuation keeps the same live browser session and native recording; its exact continuation is documented in the index. No component, style or layout changed. Incidental age text and animations are masked identically and disclosed in the scripts.

Verification log

Credit: @yordis. Original commit retained, main merged by merge commit, takeover pushed to the original contributor branch.

  • Tests: original two additions → two rewritten regression tests in existing environmentHttpAuth.test.ts (32 → 34 total). Both fail by assertion on main and pass on the head; scoped HTTP/permission suites 48/48, HTTP/supervisor 69/69.
  • Regression driver / before-after log. Default schedule driver / log. Scripts are public artifacts, not committed scratch.
  • Final-head check:changed log: format, lint, knip, affected typechecks and 34 changed-file tests pass.
  • Code review round 1: GPT-6.1 Sol and Claude Opus 5.5 independently returned MERGE; no confirmed blocking findings. Reviewed tree equals final tree byte for byte. No regex/parser/dependency patch added.
  • External merge: 024e593a63 at 22:27 UTC; both changed files exactly match the pushed head. No further branch push.
  • CI: 38 successful, 0 pending, 0 failing (including post-merge cleanup contexts) on final head; CodeRabbit no actionable finding. Macroscope timing-policy note disclosed: default maximum wait is 150 seconds; existing independent command authorization deadline remains six seconds.
  • Unverified: native mobile UI. Shared-runtime tests cover logic, not native rendering. No other changed surface is omitted.
  • Source ownership: repaired captures retain launch/switch process records; older retained captures use checkout chronology and cleanup corroboration, with that historical qualification disclosed in the index.
  • Proof audit: SUFFICIENT, all 32 scoped web rows; independent live rebuild exact zero-pixel delta. Full verification and collected friction.
  • Models/harness: tests and implementation Claude Opus 5.5 via claudeAgent; reviewers GPT-6.1 Sol via Codex and Claude Opus 5.5 via claudeAgent; evidence and proof audit GPT-6.1 Sol via Codex. Lead GPT-6.1 Sol via Codex.
    1. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs Human Approval

      Macroscope's review found this PR requires human approval — This focused fix changes the default authenticated session path from a single 6-second request to multiple retries, with cumulative waiting potentially reaching roughly 150 seconds before failure. Because it changes default permission-state behavior in an authentication-related path, the runtime policy should receive human review.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review.

      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between 03ab5cd0d70a40932a37892d1e3d49ed9f584dae and 8fbfc33c1ac503048ca2983564318bc29143086a.

      Files selected for processing: 2
      • packages/client-runtime/src/state/environmentHttpAuth.test.ts
      • packages/client-runtime/src/state/session.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

      Walkthrough

      Session-state fetching now retries remote authentication timeout errors with increasing timeouts, starting at the configured timeout or 6,000 ms and capped at 60,000 ms. Tests cover success after a retry and failure after the retry limit.

      Changes: Session authentication retries

      Layer / File(s)Summary
      Retry session-state timeouts
      packages/client-runtime/src/state/session.ts, packages/client-runtime/src/state/environmentHttpAuth.test.ts
      The loader retries remote authentication timeout errors with increasing timeouts, up to 60,000 ms. Tests verify success after a retry and failure with a timeout error after retries are exhausted.
      Priority: Normal

      Estimated code review effort: 2 (Simple) | ~12 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Possibly related issues

      • pingdotgg/t3code#24221: The issue reports session permission checks timing out and making permission-gated controls unavailable. This PR retries session timeout errors.

      Possibly related PRs

      • pingdotgg/t3code#18594: It adds the primary-environment session reader and its six-second authenticated request, which this PR changes to retry on timeout.
      • pingdotgg/t3code#24445: It changes permission handling after session-check timeouts. This PR retries those timeouts before returning a result.

      Suggested reviewers: juliusmarminge

      Merge Risk: Minimal · up to 8fbfc

      No actionable issue remains with session timeout retries; the change is mergeable after normal checks.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Description checkPassedThe description includes all required sections. It explains the problem, the retry-based fix, the focused scope, the exemption from prior approval, and specific verification results.
      Title checkPassedThe title clearly and concisely describes the primary user-visible fix: slow hosts no longer cause settings to appear read-only.
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    3. juliusmarminge added labelstakeover

    4. juliusmarminge added labelspr:in-progress

    5. juliusmarminge assignedjuliusmarminge

    6. Taking over this one

    7. juliusmarminge merged this024e593

    8. juliusmarminge closed this

    9. juliusmarminge removed labelspr:in-progress

Sign in to join this conversation.