fix(connect): reboots no longer strand the relay link, 403s now say why - #4988
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.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 Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Reviewed the Effect service conventions for this PR. The retry schedule in apps/server/src/server.ts uses proper effect/Duration and effect/Schedule subpath namespace imports, and the new contract error derives its message from structural attributes. One minor migration nit noted inline.
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5ce17a2. Configure here.
ApprovabilityVerdict: Approved 2b9b2ea This bug fix improves retry resilience for server reboots (exponential backoff instead of immediate retries) and threads error reasons through to clients for better debugging. Changes are self-contained with clear intent, backward-compatible schema updates, and no security implications. You can customize Macroscope's approvability policy. Learn more. |
…ason alias Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
## What's Changed * docs: split user and maintainer docs, fix 100+ stale claims by @t3dotgg in pingdotgg/t3code#4807 * fix(web): server updates no longer look like warnings by @t3dotgg in pingdotgg/t3code#4992 * fix(connect): reboots no longer strand the relay link, 403s now say why by @t3dotgg in pingdotgg/t3code#4988 * Add project file picker (⌘P) and project content search (⇧⌘F) by @jakeleventhal in pingdotgg/t3code#4855 * Check for mobile app updates on launch by @juliusmarminge in pingdotgg/t3code#4958 **Full Changelog**: pingdotgg/t3code@v0.0.32-nightly.20260730.956...v0.0.32-nightly.20260730.957 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.32-nightly.20260730.957

Problem
Two independent bugs made a reboot look like "T3 Connect is broken" with no useful signal:
Effect.retry({ times: 4 })and no delay, so all retries burned in ~1 second while the NIC was still coming up, then gave up permanently. The server ran fine locally but no environment link existed at the relay.environment_link_not_found), but dropped the reason before it reached the client, so "your server never linked" read as a credential problem.Solution
RelayEnvironmentConnectNotAuthorizedErrorcarries an optionalreasonfield threaded from the relay's internal reason set. Optional keeps old-relay responses decoding, and old clients ignore the extra field, so it deploys compatibly in either order. Web and mobile now renderenvironment_link_not_foundas "Relay has no active link for this environment" instead of an auth-sounding 403, and show the raw reason for the rest.Typecheck, lint, build, and the relay/contracts/client-runtime/server test suites all pass.
🤖 Generated with Claude Code using Claude Fable 5
Note
Medium Risk
Touches startup cloud link reconciliation and relay/client error contracts; backward-compatible optional
reason, but wrong retry bounds could delay or hide permanent link failures.Overview
Fixes two reboot/connect failure modes: the environment server giving up on relay link reconciliation too quickly after boot, and clients seeing a generic auth-style 403 when the relay knows a specific cause.
Startup link reconcile (
server.ts): Replaces four immediate retries with exponential backoff (1s base, 30s cap per delay) over up to ~10 minutes. Retries stop on deterministic local errors (EnvironmentHttpBadRequestError,EnvironmentHttpUnauthorizedError,EnvironmentHttpConflictError) so malformed origins or “not linked yet” don’t spin forever.403 semantics: Adds shared
RelayEnvironmentConnectNotAuthorizedReasonin contracts and an optionalreasononRelayEnvironmentConnectNotAuthorizedError. The relay API forwards the connector’s reason; relay code uses the shared schema instead of a duplicate list. Web and mobile mapenvironment_link_not_foundto a clear “no active link / server may not have re-established yet” message and include other reasons in the error text when present.Reviewed by Cursor Bugbot for commit 2b9b2ea. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix relay link stranding on reboot and include 403 reason in connect errors
BadRequest,Unauthorized,Conflict) to avoid pointless loops.RelayEnvironmentConnectNotAuthorizedReasonto relay.ts contracts and threads the reason through the relay API and both clientrelayProtectedErrorMessagefunctions, so 403 responses now surface the specific reason in user-visible messages.environment_link_not_foundin error messages to clarify it is not a credential issue.Macroscope summarized 2b9b2ea.