Commit 257ea70
fix(webAgent): refresh snapshot after a stale-ref tool error
On a recoverable "Invalid element reference" error the loop returned
needsPageSnapshot:false, so no fresh snapshot was ever added — the model was
stranded on a known-bad snapshot. The recovery prompt tells the model to "wait
for the next page snapshot (it will arrive automatically)"; it never did, so the
model confabulated refs off a frozen view until the consecutive-error budget
killed the run. Observed on Magento (Zoo onestopshop) guest checkout, but the
deadlock is general to any recoverable ref error on a client-rendered page.
Force a snapshot refresh on the retry only for stale/invalid-ref errors (the one
case where the model's view is known-bad and the prompt promised a refresh);
other recoverable errors keep prior behavior. The existing consecutive-error
budget bounds any refresh loop. Scoped via shouldRefreshSnapshotAfterError,
which keys on the same phrase prompts.ts uses.
Validated: with this refresh, checkout reps that threw 7-15 invalid-ref errors
recover and pass instead of deadlocking at 5 consecutive.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 9b13ad6 commit 257ea70
2 files changed
Lines changed: 73 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
279 | 297 | | |
280 | 298 | | |
281 | 299 | | |
| |||
799 | 817 | | |
800 | 818 | | |
801 | 819 | | |
802 | | - | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
803 | 827 | | |
804 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
805 | 832 | | |
806 | 833 | | |
807 | 834 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
3 | 8 | | |
4 | 9 | | |
5 | 10 | | |
| |||
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
15 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
16 | 26 | | |
17 | 27 | | |
18 | 28 | | |
| |||
5128 | 5138 | | |
5129 | 5139 | | |
5130 | 5140 | | |
| 5141 | + | |
| 5142 | + | |
| 5143 | + | |
| 5144 | + | |
| 5145 | + | |
| 5146 | + | |
| 5147 | + | |
| 5148 | + | |
| 5149 | + | |
| 5150 | + | |
| 5151 | + | |
| 5152 | + | |
| 5153 | + | |
| 5154 | + | |
| 5155 | + | |
| 5156 | + | |
| 5157 | + | |
| 5158 | + | |
| 5159 | + | |
| 5160 | + | |
| 5161 | + | |
| 5162 | + | |
| 5163 | + | |
| 5164 | + | |
| 5165 | + | |
| 5166 | + | |
| 5167 | + | |
| 5168 | + | |
| 5169 | + | |
| 5170 | + | |
| 5171 | + | |
| 5172 | + | |
0 commit comments