fix(commit): created commits before agent teardown
- Ran commit host completion before commit-agent session disposal so mnemopi/autolearn teardown cannot preempt a valid proposal. - Converted missing commit-agent host outputs and split-plan gaps into thrown errors so omp commit cannot resolve into exit 0 without creating a commit. - Preserved caller GPG_TTY state instead of forcing a bogus signing TTY in git and non-interactive subprocess environments. Fixes #4794
This commit is contained in:
@@ -32,4 +32,24 @@ describe("omp commit command lifecycle (issue #1041)", () => {
|
||||
expect(runCommitSpy.mock.invocationCallOrder[0]).toBeLessThan(quitSpy.mock.invocationCallOrder[0]);
|
||||
expect(quitSpy).toHaveBeenCalledWith(0);
|
||||
});
|
||||
|
||||
it("does not convert commit pipeline failures into exit 0", async () => {
|
||||
const initThemeSpy = vi.spyOn(themeModule, "initTheme").mockResolvedValue(undefined);
|
||||
const runCommitSpy = vi
|
||||
.spyOn(commitModule, "runCommitCommand")
|
||||
.mockRejectedValue(new Error("commit was not created"));
|
||||
const quitSpy = vi.spyOn(postmortem, "quit").mockResolvedValue(undefined);
|
||||
|
||||
const command = new CommitCommand([], {
|
||||
bin: "omp",
|
||||
version: "0.0.0-test",
|
||||
commands: new Map(),
|
||||
});
|
||||
|
||||
await expect(command.run()).rejects.toThrow("commit was not created");
|
||||
|
||||
expect(initThemeSpy).toHaveBeenCalledTimes(1);
|
||||
expect(runCommitSpy).toHaveBeenCalledTimes(1);
|
||||
expect(quitSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user