Merge pull request #33 from M3NT8L-One/codex/mission-stop-completion-20260706

fix(mission): stop command loop on terminal state
This commit is contained in:
pliny authored and GitHub committed 2026-07-06 11:48:23 -04:00
commit 2f20ee5820
2 files changed
+28 -2

No files matched your search

+22
View File
@@ -397,6 +397,28 @@ describe('Wedged-dispatch timeout backstop', () => {
expect(op.getSummary().failedTasks).toBe(1);
});
it('mission completion stops the command loop so status/timer do not stay active', async () => {
const mod = await import('../index.js');
const command = new mod.TempestCommand({
name: 'Lifecycle Op',
llm: { provider: 'mock', model: 'mock-model' },
});
let stopped = false;
command.on('command:stopped', () => { stopped = true; });
command.start();
const mission = command.mission.getActiveMission();
expect(mission).toBeDefined();
expect(command.getStatus().running).toBe(true);
command.mission.completeMission(mission!.id);
expect(command.getStatus().running).toBe(false);
expect(command.mission.getActiveMission()).toBeUndefined();
expect(stopped).toBe(true);
});
it('a wedged mission reaches phase advancement once the per-dispatch backstop fires', async () => {
// Tiny backstop so the test is fast and deterministic.
const prev = process.env.T3MP3ST_TASK_TIMEOUT_MS;