Commit 01b3b77
fix(billing): keep the charge on completed runs that fail after execution
Three paths dropped cost the sandbox had already earned.
A harvest that cannot return what the run produced — more files than the
export limit, nesting past the listing depth, or an output directory the
code deleted — was excluded from the billable-error set. All three arrive
only after the sandbox has executed and all three are the caller's to fix,
so they belong with the post-completion export failures the policy already
bills rather than the provider failures it absorbs. A completed run whose
code wrote one file too many went free.
That also left the route with nothing to read: it already consults
readTrustedSandboxOutputCost for these errors, so attaching the cost at the
sandbox layer is what carries it into the response.
Separately, a Function block whose handler succeeded could still fail in
the steps that follow it — base64 hydration, and large-value redaction that
throws rather than emit unredacted data. Those errors carry no cost of
their own, so the completed sandbox went unbilled. The handler's cost is
now held across that window, in the same way streamingPartialOutput already
is, and used only when the error has none.
The new conformance case was confirmed to fail against the narrower catch.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 1065097 commit 01b3b77
3 files changed
Lines changed: 74 additions & 5 deletions
File tree
- apps/sim
- executor/execution
- lib/execution/remote-sandbox
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
252 | 263 | | |
253 | 264 | | |
254 | 265 | | |
| |||
261 | 272 | | |
262 | 273 | | |
263 | 274 | | |
| 275 | + | |
| 276 | + | |
264 | 277 | | |
265 | 278 | | |
266 | 279 | | |
| |||
436 | 449 | | |
437 | 450 | | |
438 | 451 | | |
439 | | - | |
| 452 | + | |
| 453 | + | |
440 | 454 | | |
441 | 455 | | |
442 | 456 | | |
| |||
596 | 610 | | |
597 | 611 | | |
598 | 612 | | |
599 | | - | |
| 613 | + | |
| 614 | + | |
600 | 615 | | |
601 | 616 | | |
602 | 617 | | |
| |||
668 | 683 | | |
669 | 684 | | |
670 | 685 | | |
671 | | - | |
| 686 | + | |
672 | 687 | | |
673 | 688 | | |
674 | 689 | | |
| |||
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| |||
713 | 714 | | |
714 | 715 | | |
715 | 716 | | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
716 | 745 | | |
717 | 746 | | |
718 | 747 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
919 | 920 | | |
920 | 921 | | |
921 | 922 | | |
922 | | - | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
923 | 936 | | |
924 | 937 | | |
925 | 938 | | |
| |||
1050 | 1063 | | |
1051 | 1064 | | |
1052 | 1065 | | |
1053 | | - | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
1054 | 1079 | | |
1055 | 1080 | | |
1056 | 1081 | | |
| |||
0 commit comments