Repository navigation
Commit 3c81fea
authored
feat: agent quality, caching, retry, and tooling upgrades (#506)
* feat: agent quality, caching, retry, and tooling upgrades
Ten self-contained improvements to the core agent engine and tools:
- edit_file: fuzzy fallback matching (7-strategy cascade with uniqueness
protection and a disproportion guard) when old_string does not match
byte-for-byte; exact match remains the fast path
- edit_file/write_file: inline error-severity LSP diagnostics in tool
output so the model sees a break it introduced in the same turn
- lsp: expand server registry from 4 to 28 languages; doctor grades only
tier-1 servers and lists the long tail informationally
- agent: consecutive read-only tool calls execute concurrently (bounded
at 8), consumed in original order, never spanning a mutating call
- anthropic: cache_control breakpoints on the last two conversation
messages so the transcript prefix stays a prompt-cache hit
- providerio: retry schedule raised to 6 attempts with exponential
2s-30s backoff when the server sends no Retry-After
- tools: truncated exec/bash output spills to a redacted temp file
referenced in the truncation notice; bash output (previously
unbounded) now shares exec_command's token budget
- web_fetch: dependency-free HTML-to-markdown conversion (format:
auto|raw|markdown) and larger limits (256KiB default, 2MiB max, 30s)
- modelregistry: live models.dev overlay refreshes context limits and
base pricing from a TTL-cached fetch; opt-in at the CLI entrypoint
- tools: opt-in format-on-write (ZERO_FORMAT_ON_WRITE=1) runs standard
formatters across 27 extensions, ordered before the file-tracker
re-baseline so conflict detection is preserved
* fix: address PR review feedback on fuzzy edits, diagnostics, spill
- edit_file: adapt the replacement to the fuzzy-resolved span — when the
span is a uniformly deeper-indented copy of old_string (line-trimmed /
indentation-flexible matches), the same indentation delta is applied to
new_string, and a span ending in a bare CR keeps its CR so CRLF files
never gain a mixed line ending; block-anchor matches with drifted
interiors are deliberately left untouched
- diagnostics: render workspace-relative paths in inline post-edit
diagnostics (base name outside the workspace) so absolute paths never
leak the local username or directory layout into the model prompt or
session transcript
- spill: harden the spill directory for shared temp dirs — per-uid name,
reject symlinked or non-directory paths (MkdirAll follows symlinks),
and on Unix require current-user ownership
- bash: the branch's output cap and truncation-flag threading are
superseded by main's capture-time bounding (boundedBuffer +
budgetBashCapture), which already sets Result.Truncated; this rebase
adopts that design and keeps spill-to-disk on exec_command, where the
full output is still buffered and a spill is genuinely complete
* fix: address review round 2 — permission-event race, fuzzy ambiguity, spill reachability
- agent: serialize OnPermission behind the same mutex as
OnPermissionRequest in the parallel read batch. buildPermissionEvent
fires for batched reads with a non-trivial sandbox decision (e.g. a
grant-matched extra root), and front-end handlers append to shared
session-recording state without their own locking — two batched reads
emitting concurrently was a data race the pre-batch serial loop never
allowed.
- edit_file: reject two or more DISTINCT candidate spans from one fuzzy
strategy as ambiguous instead of silently editing the first. Duplicate
blocks at different indentation each resolve to a unique literal, so
the previous occurrence-uniqueness check passed and wrote the wrong
span. A single candidate occurring at multiple positions still
cascades to stricter strategies as before.
- tools: make spill files actually reachable by the recovery path the
truncation notice advertises — resolveScopedReadPath now recognizes
files inside the per-uid spill dir (containment verified after symlink
resolution, so a planted link cannot smuggle an out-of-scope file
through the gate); read_file/grep can follow the notice instead of
re-running the command.
* fix: surface competing block-anchor spans; make write-barrier test observe cross-probe order
- edit_file: blockAnchorReplacer now returns every span clearing the
similarity threshold (best first) instead of silently picking the
single most-similar block. Hiding competitors from the cascade's
distinct-candidate check could edit the wrong block when two blocks
share anchors and both interiors are plausible; one clear winner still
resolves, two plausible blocks now report ambiguity (covered by a
two-block test that asserts the file is untouched).
- agent tests: the parallel write-barrier test now records both probes
into one mutex-guarded shared log and asserts the cross-probe ordering
it always claimed to (write starts after the first read batch ends;
second read batch starts after the write ends). The previous version
only compared indices within the read probe's own log, which a
regression letting the write overlap a batch could still pass; the
stray no-op mutex assignment is gone.1 parent f6c0606 commit 3c81fea
37 files changed
Lines changed: 3155 additions & 59 deletions
File tree
- internal
- agent
- cli
- doctor
- lsp
- modelregistry
- providers
- anthropic
- providerio
- tools
- tui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
498 | 502 | | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
499 | 517 | | |
500 | 518 | | |
501 | 519 | | |
502 | | - | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
503 | 527 | | |
504 | 528 | | |
505 | 529 | | |
| |||
1071 | 1095 | | |
1072 | 1096 | | |
1073 | 1097 | | |
| 1098 | + | |
| 1099 | + | |
1074 | 1100 | | |
1075 | 1101 | | |
1076 | 1102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
0 commit comments