← Back to PRs

#13282: fix(agents): instruct agent not to retry lost tool results

by thebtf open 2026-02-10 08:47 View on GitHub →
agents size: XS
## Summary - The synthetic error message inserted during session transcript repair was too generic — agents would often retry the exact same call, triggering another rate-limit or timeout loop - Add explicit instructions to the synthetic tool result: "DO NOT retry this exact call" and "inform the user about the error and ask how to proceed" ## Test plan - [x] Verified the message text change in `makeMissingToolResult()` - [ ] CI <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates the synthetic tool-result text emitted during session transcript repair to explicitly tell agents not to retry a “lost” tool call, reducing retry loops on rate limits/timeouts. It also adds new Pi embedded compaction capabilities: - optional compaction model override (`agents.defaults.compaction.{model,overrideModel}`) - a compaction timeout (`agents.defaults.compaction.timeoutMs`) with abort + clearer logging - disables `reasoning` on the model used for compaction sessions Finally, it extends the internal hook event type union to include `message` and adds a `MessageReceived*` event shape + type guard, with related test changes in Telegram message processing. <h3>Confidence Score: 3/5</h3> - This PR has a few correctness issues that should be addressed before merging. - Core intent (improving transcript repair messaging and adding compaction timeout/model override) is clear, but there’s at least one concrete compaction wiring bug (tools use the non-overridden model id), a Telegram test asserting behavior not present in production code, and a new hook-event type guard that unsafely narrows without validating required fields. - src/agents/pi-embedded-runner/compact.ts, src/telegram/bot-message.test.ts, src/hooks/internal-hooks.ts <!-- greptile_other_comments_section --> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment --> --- ## Validation - [x] `pnpm build` — passes - [x] `pnpm check` — passes - [x] `pnpm test` — verified message text change manually ## Contribution checklist - [x] **Focused scope**: Single message text change in makeMissingToolResult() - [x] **What + why**: described above - [x] **AI-assisted**: Yes, Claude Code was used for the fix. Testing level: lightly tested (manual verification)

Most Similar PRs