diff --git a/src/resources/extensions/sf/auto/phases.ts b/src/resources/extensions/sf/auto/phases.ts index b6ad360ca..b0be859de 100644 --- a/src/resources/extensions/sf/auto/phases.ts +++ b/src/resources/extensions/sf/auto/phases.ts @@ -596,7 +596,7 @@ export async function runPreDispatch( // Derive state let state = await deps.deriveState(s.basePath); - if (uokFlags.planningFlow && shouldRunPlanningFlowGate(state.phase)) { + if (uokFlags.planningFlow && isDbAvailable() && shouldRunPlanningFlowGate(state.phase)) { let compiled = ensurePlanningFlowGraph(s.basePath, state); // Empty-graph recovery: stale DB caches can yield 0 nodes right after a // task-complete write. Invalidate caches, re-derive state, and retry once. diff --git a/src/resources/extensions/sf/auto/run-unit.ts b/src/resources/extensions/sf/auto/run-unit.ts index ca3541754..fb46dfa6c 100644 --- a/src/resources/extensions/sf/auto/run-unit.ts +++ b/src/resources/extensions/sf/auto/run-unit.ts @@ -52,7 +52,7 @@ export async function runUnit( // wrong directory. Must be synchronous — no awaits between chdir and // newSession (#1389, #4762 follow-up). try { - if (process.cwd() !== s.basePath) { + if (s.basePath && process.cwd() !== s.basePath) { process.chdir(s.basePath); } } catch (e) {