fix(coding-agent/commit): force clean exit after omp commit finishes
The agentic commit pipeline (`omp commit`) wrote its commit and then sat spinning on Ctrl+C because nothing in `Commit.run()` drained the lingering event-loop handles: `installH2Fetch()` keeps idle HTTP/2 sockets warm to the provider, the Settings autosave timer can still be armed, and the AgentSession's extension/runner machinery holds onto async-job and OAuth refresh state even after `session.dispose()` releases what it knows how to. Mirror the `runPrintMode` exit path from `main.ts` by calling `postmortem.quit(0)` once `runCommitCommand` resolves so the CLI returns to the shell, runs registered cleanup callbacks, then exits — same model the non-interactive launch flow already uses. Also widens the private bash-tool helpers' `notices` parameter to `readonly string[]` so `bun check:types` keeps passing — the public outer arm already accepted `readonly string[]` and an upstream commit had only partially propagated the change. Fixes #1041
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* Generate and optionally push a commit with changelog updates.
|
||||
*/
|
||||
import { postmortem } from "@oh-my-pi/pi-utils";
|
||||
import { Command, Flags } from "@oh-my-pi/pi-utils/cli";
|
||||
import { runCommitCommand } from "../commit";
|
||||
import type { CommitCommandArgs } from "../commit/types";
|
||||
@@ -31,6 +32,15 @@ export default class Commit extends Command {
|
||||
};
|
||||
|
||||
await initTheme();
|
||||
// The agentic commit flow opens HTTP/2 keep-alive sockets to the model
|
||||
// provider (via `installH2Fetch`) and spins up an AgentSession with
|
||||
// background async-job + extension machinery. `session.dispose()` releases
|
||||
// what it can, but Bun's fetch keeps idle connections warm and a few
|
||||
// timers (Settings autosave, OAuth refresh) stay armed long enough to
|
||||
// pin the event loop after the commit is already written. Mirror the
|
||||
// `runPrintMode` exit pattern from `main.ts` so the CLI returns to the
|
||||
// shell instead of stranding the user on Ctrl+C (issue #1041).
|
||||
await runCommitCommand(cmd);
|
||||
await postmortem.quit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user