multica/packages/core
Jiang Bohan 033ff87861 fix(agent): strip toolCalls from aborted/error assistant messages in transcript repair
When a streaming request is aborted mid-toolCall, the session persists an
assistant message with stopReason "aborted" containing partial toolCall blocks.
Our sanitizeToolUseResultPairing then inserts synthetic toolResults for these
toolCalls. However, pi-ai's transformMessages drops the entire aborted assistant
message downstream, leaving orphaned toolResults that reference non-existent
tool_use_ids — causing persistent 400 errors that block all subsequent
conversations in the session.

Fix: in repairToolCallInputs, strip toolCall blocks from assistant messages
with stopReason "aborted" or "error" before the result-pairing sanitizer runs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 17:33:58 +08:00
..
src fix(agent): strip toolCalls from aborted/error assistant messages in transcript repair 2026-02-26 17:33:58 +08:00
package.json fix(agent): auto-recover from persistent 400 format errors by reloading session 2026-02-24 13:19:39 +08:00
tsconfig.json refactor: restructure to monorepo architecture 2026-02-10 18:00:23 +08:00
tsup.config.ts refactor: restructure to monorepo architecture 2026-02-10 18:00:23 +08:00