Skip to content

fix(aionrs): handle malformed tool-call failures#486

Merged
TCP404 merged 4 commits into
mainfrom
boii/fix/malformed-tool-call-sanitize
Jun 18, 2026
Merged

fix(aionrs): handle malformed tool-call failures#486
TCP404 merged 4 commits into
mainfrom
boii/fix/malformed-tool-call-sanitize

Conversation

@TCP404

@TCP404 TCP404 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Consume aionrs v0.1.30, which contains provider-side malformed tool-call sanitization and the repeated malformed tool-call loop breaker.
  • Thread max_malformed_tool_call_turns through AionCore's aionrs build-extra/resolved-config path so callers can configure the breaker alongside max_turns; provider health checks set it to 1 to fail fast.
  • Keep invalid empty-name tool-call stream events out of AionCore/UI emission paths, and sanitize resumed aionrs provider history by removing orphaned tool calls plus empty-name tool uses and their paired results before replay.
  • Classify exhausted malformed tool-call loops as a user LLM provider problem instead of an AionUI internal error: USER_LLM_PROVIDER_INVALID_REQUEST, ownership user_llm_provider, non-retryable, resolution change_model / provider settings.

Behavior

  • Aionrs still owns the actual malformed tool-call recovery loop: it writes the malformed call and synthetic error result to session history, gives the model a bounded chance to correct itself, then stops when the configured limit is exhausted.
  • AionCore now passes that limit into aionrs instead of silently relying on only max_turns.
  • When a weak or incompatible provider keeps returning the same malformed tool call, the UI receives a provider-owned error card rather than AIONUI_INTERNAL_ERROR.
  • Strict providers no longer receive invalid replay history containing orphaned tool-use messages or empty tool names from resumed sessions.

Tests

  • cargo fmt --all --check
  • cargo check -p aionui-ai-agent
  • cargo test -p aionui-ai-agent aionrs_build_extra_serde --lib
  • cargo test -p aionui-ai-agent empty_name
  • cargo test -p aionui-ai-agent history_sanitize
  • cargo test -p aionui-ai-agent provider_health
  • cargo test -p aionui-ai-agent classifies_provider_request_model_and_context_errors --lib
  • cargo test -p aionui-ai-agent aionrs_repeated_malformed_tool_call_is_user_llm_provider_error --lib
  • just push
    • migration immutability check passed
    • cargo fix --allow-dirty --allow-staged passed
    • cargo clippy --fix --workspace --allow-dirty --allow-staged -- -D warnings passed
    • cargo nextest run --workspace: 6316 passed, 18 skipped

TCP404 added 4 commits June 18, 2026 14:38
- Ignore aionrs tool-call events with empty names before they reach the UI stream
- Strip malformed tool uses and paired results from resumed session history
- Separate malformed tool-call history note from the numbered doc list
- Keep CI clippy strict mode passing with warnings denied
- Thread max_malformed_tool_call_turns through AionCore into aionrs config resolution
- Classify repeated malformed tool-call loops as user LLM provider errors instead of AionUI internal failures
- Cover build extra defaults, provider health config, and aionrs error mapping
- Update AionCore to consume the aionrs release with malformed tool-call loop handling
- Refresh Cargo.lock entries for the aionrs workspace crates
@TCP404 TCP404 enabled auto-merge (squash) June 18, 2026 17:39
@TCP404 TCP404 changed the title fix(aionrs): drop malformed tool-call events fix(aionrs): handle malformed tool-call failures Jun 18, 2026
@TCP404 TCP404 merged commit 67ffbd0 into main Jun 18, 2026
6 checks passed
@TCP404 TCP404 deleted the boii/fix/malformed-tool-call-sanitize branch June 18, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant