Repository navigation
Description
Problem
Every refused/rejected tool result resets the host progress deadline, including the same invalid call under a fresh call ID. The local brain has a 24-turn ceiling, but the host does not recognize repeated unsuccessful actions. A model can spend turns retrying a missing argument, denied command, or unavailable operation without getting closer to the goal.
Evidence: src/commands/code.ts / src/commands/code.ts and src/core/brain_ollama.ts / src/core/brain_ollama.ts. This is a source-observed gap, not a measured production incidence.
Proposed outcome
Classify tool failures sufficiently to offer bounded recovery: invalid arguments, permission refusal, unavailable capability, stale file precondition, and execution failure. Track repeated failures for the same canonical operation and unchanged relevant state. After a documented small retry budget, stop that cycle with a useful checkpoint and next action.
Constraints and alternatives
Start in the host-executed coding/local-chat paths; hosted server-tool enforcement requires its own contract. Do not deduplicate successful calls or treat all nonzero shell exits as permanent errors. Re-running tests after an edit and a deliberate fresh retry must remain valid.
Preserve call IDs, result delivery, approval boundaries, and existing turn/time/output caps. A denied action cannot trigger a more privileged alternative. Reset the failure fingerprint when the relevant file/shell/tool state actually changes.
Acceptance
- A fake brain repeatedly requesting the same invalid or denied action reaches a bounded stop without repeated execution/approval prompts.
- The checkpoint states the operation, reason, attempted count, preserved work, and one useful recovery choice.
- A corrected argument, refreshed capability, changed file revision, or edited repository allows genuine progress.
- Transient failures receive bounded, classified retries; unknown mutation outcomes are not automatically replayed.
- Local and coding-loop tests cover invalid args, permission denial, stale patches, failed tests after edits, and cancellation.
Priority: P1. Useful groundwork for bounded goal phase execution. Source reviewed at ca4180d (0.4.0 candidate). This ticket is an implementation spec; live service qualification remains separate.
Activity
feat(agent): bound repeated failed tool calls with a recovery checkpo…
AetherAI3 commentedon Oct 6, 2026
Landed in #295 (squash 8751117), merged at the CI-verified head c965b43. Evidence:
hostLoop,runLocalTurn,OllamaBrainandToolExecutor. The table in feat(agent): bound repeated failed tool calls with a recovery checkpoint (#285) #295 maps each criterion to its tests.docs/CONTRACTS.mdunder "Repeated tool-failure budget ([feature] Stop repeated failed tool calls and explain how to recover #285)".Out of scope, as the issue anticipated: hosted server-side tool enforcement and the headless
aether execloop, which need their own contract.