Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): save advanced background activity settings #23342

Closedjuliusmarmingewants to merge 3 commits intomain fromfix/issue-17233opened View on GitHub

juliusmarmingecommented

Problem

In Settings > General > Background activity > Advanced, changing Pause when locked fails with “Setting not saved” and disconnects the client. Authorization middleware decoded an already-decoded duration as a numeric wire value, raising a connection-level defect before saving.

Change

Validate the decoded settings payload with the type side of the existing schema. Add one regression test through the RPC authorization layer. Required scopes and settings behavior stay the same.

The regression test credits Bob Fowler’s diagnosis and work in #18129.

Scope and approval

Fixes https://git.cafe/pingdotgg/t3code/issues/17233

Triaged bug via the automated issue flow. This fixes the existing Advanced settings save path.

Verification

  • Reproduced on 49e97d48f9 in the real web dev app and isolated WebSocket server.
  • The new RPC regression test failed before the fix with SchemaError: Expected number at backgroundActivity.overrides.automaticGitFetchInterval.
  • vp test run --maxWorkers=1 --teardownTimeout=120000 apps/server/src/auth/RpcAuthorization.test.ts: 17/17 passed, repeated after merging main at adf0b49ede.
  • Server typecheck passed. Changed-file formatting passed; lint reported only the existing inline asset decoder warning.
  • Two independent code reviews found no confirmed bugs or authorization regressions.
  • The same real WebSocket settings request fails before the fix and succeeds afterward, with persisted readback on the same connection.

Evidence

final-runtime.txt final-tests.txt red-test.txt

Runtime proofBeforeAfter
Same full Advanced patch, numeric wire durations; read/update/read on one real WebSocket49e97d48f9 transcript: SchemaError; profile remains Balancedadf0b49ede transcript: update and subsequent read succeed, lock pause false

Supplementary reproduction captures: Chromium through T3 Browser, 1280×800, light theme, isolated local web dev app. These are baseline captures only.

Before: Advanced dialogBefore: disconnected after toggle
before-advanced-dialog.pngbefore-disconnected.png

Visual verification is incomplete: T3 Browser navigation, snapshots, and status checks repeatedly timed out or disconnected during the after-fix pass. The fixture matrix has 16 still rows and 16 recording rows. All remain unverified: G/A/S/P and T/D/F/H at 1440/390, light/dark. No matched after captures, recordings, pixel diffs, or visual “nothing else changed” claim are supplied.

Unverified surfaces: after-fix web interactions, Electron on Windows/macOS/Linux, native mobile, and remote relay/tunnel deployments. The server was verified on Linux. No client rendering code changed.

Models: Claude Opus 5.5 and GPT-6.1 Sol. Harnesses: Claude Code and Codex through T3 Code.

    1. juliusmarminge removed labelssize:XS

    2. juliusmarminge added labelsvia-triage

    3. Approvability

      Verdict: Needs Human Approval

      Macroscope's review found this PR requires human approval — This is a small server bug fix that makes authorization middleware accept already-decoded duration values, with a focused regression test and no default or schema changes. Because the production change is in the authentication/authorization package, human review is required.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      CodexLive turn WebSocket decoded20.9 KiB20.9 KiB0 B (0.0%)29.3 KiB✅
      CodexLive turn messages220 (0.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB0 B (0.0%)29.3 KiB✅
      ClaudeLive turn messages220 (0.0%)8✅

      Baseline: 3690c86 · PR result: adf0b49 · 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: 108.5 KiB
      • Claude decoded thread snapshot: 108.8 KiB

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

    5. Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Team
      • Run ID: 6c715a4b-f2e1-4b92-951c-128cd7f87e60
      📥 Commits

      Reviewing files that changed from the base of the PR and between 3690c862530c88781b28dce991697e5ea0dc26be and adf0b49ede31d6f29354ae78df7eed90e7a9ee04.

      📒 Files selected for processing: 2
      • apps/server/src/auth/RpcAuthorization.test.ts
      • apps/server/src/auth/RpcAuthorization.ts

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

      📝 Walkthrough

      requiredScopesForSettingsUpdate now reads the middleware-decoded settings payload. A middleware test submits background-activity overrides with settings-write scope.

      Changes: Settings Update Authorization

      Layer / File(s)Summary
      Handle decoded settings update payload
      apps/server/src/auth/RpcAuthorization.ts, apps/server/src/auth/RpcAuthorization.test.ts
      The settings authorization check uses Schema.toType(SettingsUpdate) for the middleware-decoded payload. The test submits decoded background-activity overrides, including a 30-second Git fetch interval and disabled host-lock pause, with settings-write scope.

      Priority: ➖ Normal

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

      Change: Bug fix

      Suggested reviewers: t3dotgg

      Merge Risk: ⚪ Minimal · up to adf0b

      The change targets restoring saves of advanced background-activity settings by accepting the already-decoded duration payload. The supplied regression test covers that authorization path, and no actionable merge risk is evident.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the primary server fix for saving advanced background activity settings.
      Description checkPassedThe description includes the problem, change, scope and approval, focused verification results, known limitations, and tool attribution. It is complete and relevant to the pull request.
      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 docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • 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.
    6. Closing: current main already covers this as of 97e35bcf23. If you still see it on a build that includes that commit, reply and we'll reopen.

    7. juliusmarminge closed this

Sign in to join this conversation.