refactor: improve error handling in embedded run payloads by clarifying conditions for user-facing error messages and updating test descriptions for typing behavior

This commit is contained in:
Tyler Yust
2026-01-20 02:13:56 -08:00
committed by Peter Steinberger
parent 95f82154f7
commit 1e8b291374
2 changed files with 8 additions and 5 deletions

View File

@@ -179,7 +179,7 @@ describe("runReplyAgent typing (heartbeat)", () => {
expect(typing.startTypingOnText).not.toHaveBeenCalled();
expect(typing.startTypingLoop).not.toHaveBeenCalled();
});
it("starts typing on assistant message start in message mode", async () => {
it("does not start typing on assistant message start without prior text in message mode", async () => {
runEmbeddedPiAgentMock.mockImplementationOnce(async (params: EmbeddedPiAgentParams) => {
await params.onAssistantMessageStart?.();
return { payloads: [{ text: "final" }], meta: {} };
@@ -190,7 +190,8 @@ describe("runReplyAgent typing (heartbeat)", () => {
});
await run();
expect(typing.startTypingLoop).toHaveBeenCalled();
// Typing only starts when there's actual renderable text, not on message start alone
expect(typing.startTypingLoop).not.toHaveBeenCalled();
expect(typing.startTypingOnText).not.toHaveBeenCalled();
});
it("starts typing from reasoning stream in thinking mode", async () => {