fix(omp): wait for terminal event after custom messages (#3258)

Custom messages may precede the prompt user message during an active OMP turn. Treating them as completion terminalized the turn while the provider continued working.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
This commit is contained in:
paseo-bot[bot]
2026-09-23 22:06:53 +02:00
committed by GitHub
parent 829cc5e173
commit ae42b0afb0
2 changed files with 19 additions and 3 deletions
@@ -376,6 +376,25 @@ describe("OMP agent client and session", () => {
expect(omp.completedTurnCount()).toBe(1);
});
test("does not complete a turn when a custom message arrives before its user message", async () => {
const omp = new OmpHarness();
await omp.start();
await omp.requireStartTurn("hello OMP");
const runtime = omp.runtime();
runtime.beginTurn();
runtime.acceptCustomMessage("startup notice");
expect(omp.completedTurnCount()).toBe(0);
runtime.acceptPrompt("hello OMP", "user-1");
runtime.streamAssistantText("model turn completed");
runtime.finishTurn();
await waitForImmediate();
expect(omp.completedTurnCount()).toBe(1);
});
test("omits live custom messages when display is false", async () => {
const omp = new OmpHarness();
await omp.start();
@@ -2033,9 +2033,6 @@ export class OmpAgentSession implements AgentSession {
});
}
}
if (!this.activeTurnHasUserMessage) {
this.completeTurn(turnId, []);
}
return;
}