Skip to content

fix: recover text tool-calls and keep transient noise out of history#119

Merged
jbj338033 merged 3 commits into
mainfrom
worktree-llm-idiot
Jul 14, 2026
Merged

fix: recover text tool-calls and keep transient noise out of history#119
jbj338033 merged 3 commits into
mainfrom
worktree-llm-idiot

Conversation

@jbj338033

Copy link
Copy Markdown
Collaborator

Summary

Transient model/runtime anomalies — a tool call emitted as plain text, a machine status line, an empty reasoning block — were persisted verbatim into the conversation and re-sent, so a one-off error became a self-reinforcing, cache-amplified failure that even a direct human correction could not overcome. This makes the harness robust to those anomalies:

  • Recover tool-call-as-text: the engine detects a tool call the model emitted as assistant text, recovers it into a real tool call (dedup'd against any structured call), executes it, and strips the leak from persisted/resent history so it cannot snowball. Provider-agnostic policy in the engine; dialects (<invoke>/antml: universal, Hermes/Mistral for local models) in a new tool_recovery module.
  • Round-trip reasoning: preserve thinking blocks that carry only a signature (empty summarized text) so the model's reasoning anchor survives across rounds.
  • Provenance: label background-process output/roster as environment notices rather than synthetic user messages, so the model stops replying to and repeating them.

Verification

  • cargo fmt --all --check — passed
  • cargo clippy --workspace --all-targets -- -D warnings — passed
  • cargo test --workspace — passed (goat-agent 125, incl. 13 tool_recovery unit tests over the real leaked sample and local dialects)

@jbj338033
jbj338033 force-pushed the worktree-llm-idiot branch from 65bd7bb to 2f1ca87 Compare July 14, 2026 00:31
@jbj338033
jbj338033 merged commit 20bccbc into main Jul 14, 2026
4 of 5 checks passed
@jbj338033
jbj338033 deleted the worktree-llm-idiot branch July 14, 2026 00:32
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