feat: add structured tool failure reasons#446
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a structured tool failure classification system to provide better recovery hints to models when tool executions fail. It adds a new tool-failure.ts module for classifying errors into categories like permission_denied, invalid_arguments, and environment, and integrates this metadata into session diagnostics, exports, and model message formatting. Feedback was provided to improve type safety by replacing any with unknown in the object helper and adding defensive type checks when extracting errorKind from untrusted metadata.
2664b6e to
d609e43
Compare
Summary
Add structured tool failure diagnostics for ordinary errored tool calls.
This PR introduces a small failure classifier, persists
metadata.diagnostics.failureon tool-error state, appends a concise model-facing recovery hint during message replay, and preserves only safe failure fields in raw/sanitized exports.Why
Fixes #439.
Today ordinary tool failures are mostly flattened to an error string. That makes it hard for the agent to decide whether to fix arguments, stop after a user abort, ask for permission, check local setup, or report a provider problem. This keeps the original error text but adds a stable local reason and generic recovery hint.
Related Issue
Fixes #439.
Human Review Status
Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.
Review Focus
metadata.diagnostics.failureis merged without disturbing existing loop diagnostics.Risk Notes
output-error.errorTextnow includes a short recovery hint.unknown.How To Verify
Screenshots or Recordings
Not applicable. No visible UI change.
Checklist
dev, and my PR title and commit messages use Conventional Commits in English