Add telemetry for local-agent search-replace operations (#2371)
## Summary
- Add `local_agent:search_replace:success` and
`local_agent:search_replace:failure` telemetry events to track
search-replace outcomes in local-agent mode
- Add `local_agent:file_edit_retry` telemetry to detect when multiple
edit tool types (write_file, edit_file, search_replace) are used on the
same file, indicating retry/fallback behavior
- Add `FileEditTracker` to `AgentContext` to track tool usage per file
during an agent session
## Test plan
- [x] TypeScript type checks pass
- [x] Linter passes
- [x] All 654 unit tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
#skip-bugbot
<!-- devin-review-badge-begin -->
---
<a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2371">
<picture>
<source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
<img
src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
alt="Open with Devin">
</picture>
</a>
<!-- devin-review-badge-end -->
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds telemetry to local-agent to track search-replace success/failure
and when multiple edit tools touch the same file. Introduces a
FileEditTracker in AgentContext to record write_file, edit_file, and
search_replace usage per file.
- **New Features**
- Emit local_agent:search_replace:success and
local_agent:search_replace:failure (includes filePath and error on
failure).
- Emit local_agent:file_edit_retry when a file uses 2+ different edit
tools; includes per-tool counts.
- Track usage via FileEditTracker on AgentContext with a helper that
records tool calls.
- **Migration**
- Update any AgentContext mocks/constructors to include fileEditTracker:
{}.
<sup>Written for commit f8345128b1d29b555c4c787df7103a6cae98373b.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
---------
Co-authored-by:
Claude Opus 4.5 <noreply@anthropic.com>
正在显示
请
注册
或者
登录
后发表评论