fix(coding-agent): exit after package commands

closes #5687
This commit is contained in:
Armin Ronacher
2026-06-14 10:52:31 +02:00
Unverified
parent f0989800cb
commit 11b5403fad
3 changed files with 11 additions and 0 deletions
+1
View File
@@ -8,6 +8,7 @@
### Fixed
- Fixed package commands such as `pi list`, `pi install`, and `pi update` to terminate after completing even if an extension leaves background handles open ([#5687](https://github.com/earendil-works/pi/issues/5687)).
- Fixed `pi update` for pnpm global installs whose configured `global-bin-dir` no longer matches the active pnpm home ([#5689](https://github.com/earendil-works/pi/issues/5689)).
- Fixed npm package specs that use ranges or tags (for example `@^1.2.7`) so installed package resources still load instead of being treated as mismatched exact pins ([#5695](https://github.com/earendil-works/pi/issues/5695)).
- Fixed inherited OpenCode/OpenCode Go completion model metadata to omit long-retention cache fields for routes that reject `prompt_cache_retention` ([#5702](https://github.com/earendil-works/pi/issues/5702)).
+1
View File
@@ -467,6 +467,7 @@ export async function main(args: string[], options?: MainOptions) {
}
if (await handlePackageCommand(args, { extensionFactories: options?.extensionFactories })) {
process.exit(process.exitCode ?? 0);
return;
}
@@ -37,12 +37,21 @@ describe("package commands", () => {
originalExitCode = process.exitCode;
originalExecPath = process.execPath;
process.exitCode = undefined;
vi.spyOn(process, "exit").mockImplementation(((code?: string | number | null) => {
if (code === undefined || code === null || Number(code) === 0) {
process.exitCode = undefined;
} else {
process.exitCode = code;
}
return undefined as never;
}) as typeof process.exit);
process.env[ENV_AGENT_DIR] = agentDir;
process.chdir(projectDir);
});
afterEach(() => {
vi.unstubAllGlobals();
vi.restoreAllMocks();
process.chdir(originalCwd);
process.exitCode = originalExitCode;
if (originalAgentDir === undefined) {