Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): surface a missing workspace folder instead of a spawn error #5040

Mergedkakismash(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/5040/headmerged by juliusmarminge View on GitHub

Moving or deleting a project's directory leaves its threads pointing at the old path. Starting a provider then reports a binary spawn failure instead of identifying the missing folder.

Check the final requested or saved working directory in the shared provider service before starting an adapter. A missing directory, or a path replaced by a file, produces a plain error naming that path. The reactor preserves the message in the thread error and failed-start activity. Other filesystem errors continue through the existing adapter path.

This addresses the diagnostic portion of #4940. It does not add project relinking, recreate a worktree, move files, or merge duplicate projects. The message asks the user to restore the directory; it does not direct a missing-worktree user to change the valid project root.

Verification:

  • The audit reproduced the original error using the actual Codex adapter and Node process spawner after renaming a disposable directory. The outer error omitted the missing path while the nested cause contained it. No provider credentials or live state were used.
  • The new service regressions fail with the unchanged main implementation. With the fix, Codex, Claude, and Cursor routing rejects requested and saved missing paths and file-at-path cases before calling the adapter. Restoring the folder allows the same thread to resume.
  • The reactor regression fails against unchanged main with a stack dump in lastError. With the fix, the thread error and provider.turn.start.failed contain the plain message, no session or turn starts, and the pending start is cleared. This is a separate reactor error-handling test; it does not substitute a live provider or browser test.
  • vp test run apps/server/src/provider/Layers/ProviderService.test.ts apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts apps/server/integration/providerService.integration.test.ts --maxWorkers=2: 139 tests pass.
  • Targeted lint, formatting, and the server typecheck pass. All current-head CI jobs pass or skip; Macroscope approves, Bugbot passes, and no review threads remain unresolved.

Rebased onto a5bbad910. Nonvisual server diagnostic change; the before/after proof is the filesystem and reactor regression, not a screenshot.

Original implementation by Joaquin Navarro. The diagnostic cases recorded from Tai Nguyen's #7087 and #9305 informed the updated coverage. Their closed PRs were not reopened.

Prepared by GPT 6 Astra via Codex in T3 Code.

    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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: 33f6851a-7dff-4edf-8b5a-353f49b5b322

      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

      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.

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

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at f2931a7

      Macroscope's review found this PR approvable — This is a focused server diagnostic fix that validates missing workspace paths before provider startup and preserves normal behavior for valid workspaces. Its limited runtime impact is covered by targeted service and reactor tests, with no product-default, schema, security, or deployment changes.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Addressed the Macroscope finding: the preflight now stats the path and requires a directory — a workspace root replaced by a regular file fails with the same ProviderWorkspaceMissingError instead of falling through to the opaque spawn error. Other stat failures still defer to the adapter. Added a test for the file-at-path case (33/33 passing, typecheck clean).

    5. Note

      🤖 GPT-6 Astra (preview) responding on behalf of Theo

      This note is part of an automated cleanup pass.

      Preserving these details from items reviewed in the cleanup pass.

      Carryover from #9305 at 3333b9a: preserve the observable behavior in ProviderCommandReactor.test.ts, reports a missing workspace before starting the provider. After dispatching a turn for a removed project or worktree directory, no provider session or turn should launch. The thread should show an error naming the path, and provider.turn.start.failed should contain that path. Drive the current reactor with receipts and worker drains instead of copying its polling wait. This note records test coverage to carry forward. It does not claim it is ported, and it does not solve project relinking in #4940.

      Preserve the diagnostic cases from #7087 at head f49bdd15 while keeping the guard in ProviderService after final cwd resolution. A missing T3 worktree needs recreate-worktree or new-thread guidance, not a change to the valid project root. For stat failures other than NotFound, keep the original access-error reason instead of reporting a missing directory. Retain real temporary-directory and file-at-path cases, and verify that no provider starts. This diagnostic fix does not supply the project-relink control tracked by #4940.

    6. juliusmarminge merged thisfce8508

    7. juliusmarminge closed this

Sign in to join this conversation.