mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 04:02:21 +00:00
Fix: Capture error from turn_end event in agent state
Previously, errors in turn_end events (e.g., from OpenRouter Auto Router) were not captured in agent.state.error, making failed requests appear as successful completions. Fixes #6
This commit is contained in:
parent
ed9786e5d6
commit
0ef3370085
3 changed files with 20 additions and 0 deletions
|
|
@ -144,6 +144,8 @@ async function abortExecution(model: Model<any>) {
|
|||
if (lastMessage.role !== "assistant") throw new Error("Expected assistant message");
|
||||
expect(lastMessage.stopReason).toBe("aborted");
|
||||
expect(lastMessage.errorMessage).toBeDefined();
|
||||
expect(agent.state.error).toBeDefined();
|
||||
expect(agent.state.error).toBe(lastMessage.errorMessage);
|
||||
}
|
||||
|
||||
async function stateUpdates(model: Model<any>) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue