fix(node): fallback auto backend mode in headless runs#293
fix(node): fallback auto backend mode in headless runs#293RtlZeroMemory merged 1 commit intomainfrom
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughThe PR enhances the Node backend's auto execution mode to implement a fallback mechanism: when worker mode would be selected but environment prerequisites (TTY availability or nativeShimModule presence) are unmet, it falls back to inline mode. A new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/node/src/backend/nodeBackend/executionMode.ts (1)
40-45: Treat whitespace-onlynativeShimModulevalues as unsupported.Right now
" "is considered supported and can bypass inline fallback in auto mode even though it is effectively unusable.♻️ Proposed hardening
export function hasWorkerEnvironmentSupport( nativeShimModule: string | undefined, hasAnyTty: boolean, ): boolean { - return hasAnyTty || (typeof nativeShimModule === "string" && nativeShimModule.length > 0); + return hasAnyTty || (typeof nativeShimModule === "string" && nativeShimModule.trim().length > 0); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/node/src/backend/nodeBackend/executionMode.ts` around lines 40 - 45, The helper hasWorkerEnvironmentSupport currently treats whitespace-only nativeShimModule values like " " as valid; update the check in hasWorkerEnvironmentSupport to treat a string of only whitespace as unsupported by verifying trimmed length (e.g., typeof nativeShimModule === "string" && nativeShimModule.trim().length > 0) so only non-empty, non-whitespace module names enable worker environment support while preserving the hasAnyTty branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/node/src/backend/nodeBackend/executionMode.ts`:
- Around line 40-45: The helper hasWorkerEnvironmentSupport currently treats
whitespace-only nativeShimModule values like " " as valid; update the check in
hasWorkerEnvironmentSupport to treat a string of only whitespace as unsupported
by verifying trimmed length (e.g., typeof nativeShimModule === "string" &&
nativeShimModule.trim().length > 0) so only non-empty, non-whitespace module
names enable worker environment support while preserving the hasAnyTty branch.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0d069eab-d3b6-44a5-9384-1f5be3f8fdba
📒 Files selected for processing (8)
CHANGELOG.mddocs/architecture/index.mddocs/backend/node.mddocs/backend/worker-model.mddocs/packages/node.mdpackages/node/src/__tests__/config_guards.test.tspackages/node/src/backend/nodeBackend/executionMode.tspackages/node/src/backend/nodeBackend/shared.ts
Summary
executionMode: "auto"fall back to inline when worker mode is unavailable in headless runsnativeShimModulestrings are rejectedTesting
Evidence
selectNodeBackendExecutionMode({ requestedExecutionMode: "auto", fpsCap: 60, hasAnyTty: false })now resolves toworkerbut selectsinlinewith a fallback reasonexecutionMode: "worker"still stays on worker and does not silently downgradenativeShimModule: ""as unsupportedSummary by CodeRabbit
Bug Fixes
Tests