Repository navigation
Commit fd04b5d
committed
fix(cursor): keep a collapsed root's run note through a rebuild
An adversarial counter-read of the restoration pass found the real defect one
layer down. pushDeduped builds the collapsed root's wire payload from the marked
text but stored the UNMARKED text in the candidate's `text` field, so every
consumer that rebuilds a root from `text` silently deleted the "produced N times
in a row" note: truncateToolResultBlob already did, and the new invocation
restoration did too. That note is the repetition breaker's per-entry half, so
losing it re-primes the self-reinforcing loop the breaker exists to end.
Store the marked text, which makes `text` a true mirror of the stored payload
for the first time, and fixes the truncation path by the same change.
Also anchor the restoration's search on the preceding newline. toolResultToText
always emits the invocation after the [tool_result], call_id: and name: lines, so
the real line is never first; name: renders the result's tool name, which nothing
sanitizes, so an unanchored search could be satisfied by a crafted tool name and
rewrite that header instead of the invocation.
The regression test fails with the pushDeduped change reverted and passes with it.1 parent 4ca2979 commit fd04b5d
2 files changed
Lines changed: 40 additions & 3 deletions
File tree
- src/adapters/cursor
- tests/providers/cursor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
329 | 334 | | |
330 | 335 | | |
331 | 336 | | |
| |||
1034 | 1039 | | |
1035 | 1040 | | |
1036 | 1041 | | |
1037 | | - | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
1038 | 1047 | | |
1039 | 1048 | | |
1040 | 1049 | | |
1041 | 1050 | | |
1042 | 1051 | | |
1043 | | - | |
| 1052 | + | |
1044 | 1053 | | |
1045 | 1054 | | |
1046 | 1055 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
655 | 655 | | |
656 | 656 | | |
657 | 657 | | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
658 | 686 | | |
0 commit comments