Merge PR #8883: fix(coding-agent): stop pinning worker subprocess cwd to the install dir (@chuzui)
This commit is contained in:
@@ -106,6 +106,7 @@
|
||||
### Fixed
|
||||
|
||||
- Fixed `omp update` leaking Bun's raw `fetch()` error ("pass `verbose: true` in the second argument to fetch()") when a proxy environment variable (`HTTPS_PROXY`, `ALL_PROXY`, …) uses an unsupported scheme such as SOCKS; the update check now reports an actionable message naming the offending variable and the http/https proxy requirement ([#8784](https://github.com/can1357/oh-my-pi/issues/8784)).
|
||||
- Fixed worker subprocesses (memory embeddings, tiny-model titles, TTS/STT, JS eval, browser relay, LSP mux, daemon broker) running with their cwd pinned to the CLI install directory. They share the agent's foreground process group, and terminal cwd heuristics such as kitty's `new_tab_with_cwd` pick the newest process in that group, so new terminal tabs opened in `~/.bun/install/global/node_modules/@oh-my-pi/pi-coding-agent/dist` while any worker was alive. Workers now spawn with the absolute host entry and inherit the agent's cwd.
|
||||
|
||||
## [17.3.5] - 2026-08-16
|
||||
|
||||
|
||||
@@ -108,17 +108,20 @@ export const SMOKE_TEST_TIMEOUT_MS = 30_000;
|
||||
/**
|
||||
* Resolve the command used to relaunch the agent CLI into worker mode. In a
|
||||
* compiled binary the entry point is the binary itself; otherwise re-enter the
|
||||
* declared worker-host entry with a cwd-relative script path (Bun's subprocess
|
||||
* IPC is more reliable that way under `bun test`), falling back to this
|
||||
* package's own `src/cli.ts` when no host entry is declared (bun test, SDK
|
||||
* embedding).
|
||||
* declared worker-host entry by absolute path. Workers deliberately spawn
|
||||
* without a pinned cwd there: they share the parent's foreground process
|
||||
* group, and terminal cwd heuristics (kitty's new_tab_with_cwd) read the
|
||||
* newest process in that group, so anchoring them to the install dir leaks
|
||||
* into newly opened terminal tabs. With no declared host entry (bun test, SDK
|
||||
* embedding) fall back to a cwd-relative `src/cli.ts`, which Bun subprocess
|
||||
* IPC handles more reliably under `bun test`.
|
||||
*/
|
||||
export function resolveWorkerSpawnCmd(workerArg: string): WorkerSpawnCommand {
|
||||
const executable = stripWindowsExtendedLengthPathPrefix(process.execPath);
|
||||
if (isCompiledBinary()) return { cmd: [executable, workerArg] };
|
||||
const hostEntry = workerHostEntry();
|
||||
if (hostEntry) {
|
||||
return { cmd: [executable, path.basename(hostEntry), workerArg], cwd: path.dirname(hostEntry) };
|
||||
return { cmd: [executable, hostEntry, workerArg] };
|
||||
}
|
||||
const packageRoot = path.resolve(import.meta.dir, "..", "..");
|
||||
return { cmd: [executable, "src/cli.ts", workerArg], cwd: packageRoot };
|
||||
|
||||
Reference in New Issue
Block a user