Skip to content

[codex] Make command resolution effectful#2956

Closed
juliusmarminge wants to merge 1 commit into
mainfrom
codex/effectful-command-resolution
Closed

[codex] Make command resolution effectful#2956
juliusmarminge wants to merge 1 commit into
mainfrom
codex/effectful-command-resolution

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented Jun 4, 2026

Summary

  • make @t3tools/shared/shell command resolution Effect-based with a typed CommandResolutionError
  • resolve PATH/PATHEXT executables through Effect FileSystem and Path services instead of sync fs/path calls
  • migrate the server call sites in external launcher, PATH hydration, websocket bootstrap, and provider maintenance

Notes

  • ExternalLauncher.Live captures FileSystem and Path from the layer and injects them with provideService(), so callers do not pass those services through args.
  • This is the foundation for converting the remaining Windows shell spawns; it does not close a GitHub issue by itself.

Validation

  • vp check
  • vp run typecheck
  • vp test run packages/shared/src/shell.test.ts
  • vp test run apps/server/src/process/externalLauncher.test.ts apps/server/src/provider/providerMaintenance.test.ts

Note

Make command resolution effectful using FileSystem and Path services

  • Converts isCommandAvailable, resolveCommandPath, and fixPath in shell.ts from synchronous functions to Effect-based implementations requiring FileSystem and Path services.
  • resolveCommandPath now fails with a typed CommandResolutionError instead of returning null; isCommandAvailable catches that error and returns false.
  • Updates externalLauncher.ts and providerMaintenance.ts to yield effectful command resolution; ExternalLauncher now internally provides FileSystem/Path to its effects.
  • Server startup in server.ts now yields the effectful fixPath before building layers.
  • Risk: On POSIX, executable detection now uses file mode bits instead of accessSync(X_OK), which may differ in cases involving ACLs or setuid binaries.
📊 Macroscope summarized a877253. 6 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

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

Run ID: 6aef3b12-84a3-4253-9833-7a34846a9b97

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/effectful-command-resolution

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jun 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

🚀 Expo continuous deployment is ready!

  • Project → t3-code
  • Platforms → android, ios
  • Scheme → t3code-preview
  🤖 Android 🍎 iOS
Fingerprint 251694208975e82c56bd5289d014d27db782d79c 88f9ec34318a3522ac20299028ec60ca0080a665
Build Details Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 251694208975e82c56bd5289d014d27db782d79c
App version: 0.1.0
Git commit: fff460b4abc01f29f5b2cdb5bf25d955066816ee
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 88f9ec34318a3522ac20299028ec60ca0080a665
App version: 0.1.0
Git commit: fff460b4abc01f29f5b2cdb5bf25d955066816ee
Update Details Update Permalink
DetailsBranch: pr-2956
Runtime version: 251694208975e82c56bd5289d014d27db782d79c
Git commit: a943ee530e2c326877e7604d09860ad0d3746913
Update Permalink
DetailsBranch: pr-2956
Runtime version: 88f9ec34318a3522ac20299028ec60ca0080a665
Git commit: a943ee530e2c326877e7604d09860ad0d3746913
Update QR

Comment thread apps/server/src/server.ts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High

export const makeServerLayer = Layer.unwrap(
Effect.gen(function* () {
const config = yield* ServerConfig;
yield* fixPath();

The fixPath refactoring from synchronous to Effect removed the try/catch wrapper that previously logged PATH hydration failures as warnings and allowed the server to continue starting. Now yield* fixPath() on line 309 propagates any failure from resolveWindowsEnvironment, readPathFromLaunchctl, or mergePathEntries as an unhandled error, causing makeServerLayer to fail and preventing the server from starting entirely when PATH hydration fails.

     yield* fixPath();
+      .pipe(
+        Effect.catch((cause) =>
+          Effect.logWarning("Failed to hydrate PATH from the user environment.", {
+            cause: cause instanceof Error ? cause.message : String(cause),
+          }),
+        ),
+      );
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file apps/server/src/server.ts around lines 305-309:

The `fixPath` refactoring from synchronous to `Effect` removed the `try/catch` wrapper that previously logged PATH hydration failures as warnings and allowed the server to continue starting. Now `yield* fixPath()` on line 309 propagates any failure from `resolveWindowsEnvironment`, `readPathFromLaunchctl`, or `mergePathEntries` as an unhandled error, causing `makeServerLayer` to fail and preventing the server from starting entirely when PATH hydration fails.

Evidence trail:
apps/server/src/os-jank.ts (REVIEWED_COMMIT) lines 48-93: new Effect-based fixPath with no outer catch-all. apps/server/src/os-jank.ts (MERGE_BASE) lines 37-82: old synchronous fixPath with outer try/catch on lines 37 and 78-80 that called logWarning. git_diff MERGE_BASE..REVIEWED_COMMIT apps/server/src/os-jank.ts shows removal of 'catch (error) { logWarning("Failed to hydrate PATH from the user environment.", error); }'. apps/server/src/server.ts line 309 (REVIEWED_COMMIT): yield* fixPath() propagates errors.

@juliusmarminge
Copy link
Copy Markdown
Member Author

Folded this effectful command-resolution work into #2959, which also includes the stricter host-runtime reference enforcement. Closing this PR in favor of #2959 as the successor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant