Skip to content

feat: record sandbox usage on eval results - #303

Merged
mattrossman merged 11 commits into
mainfrom
mattrossman/ai-1222-record-sandbox-usage-metrics-on-eval-results
Sep 21, 2026
Merged

mattrossman merged 11 commits into
mainfrom
mattrossman/ai-1222-record-sandbox-usage-metrics-on-eval-results

Conversation

@mattrossman

@mattrossman mattrossman commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Records Vercel Sandbox's metered usage on eval results so we can estimate total sandbox cost per experiment. See fields mirrored from sandbox.stop() return type.

/* eval-results.json */
{
    // ...
    "agentRunDurationMs": 12345,
    "sandboxUsage": {
      "activeCpuDurationMs": 490837,
      "duration": 308496,
      "memory": 8192,
      "networkTransfer": {
        "ingress": 2728707529,
        "egress": 4804954
      }
    },
    // ...
}

I renamed our durationMs -> agentRunDurationMs to disambiguate from the new sandbox duration fields.

Notes

In the previous PR #302 I kept all the files from the Sandbox tarred together to keep the agent-authored ones contained in case of corrupt filenames. This PR moves result.json out from that so we can inject the Sandbox usage stats w/o needing to untar / retar the results file.

The runner tests also cover archived agent-authored filenames and incomplete .partial results.

How to review

I sanity checked one benchmark eval via the refresh workflow. Take a look at the sandbox usage snapshot to vet the new fields.

Closes AI-1222

@vercel

vercel Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
evals Ready Ready Preview Sep 21, 2026 2:12pm UTC

Request Review

@mattrossman
mattrossman force-pushed the mattrossman/ai-1222-record-sandbox-usage-metrics-on-eval-results branch from f39014c to 0f22936 Compare September 16, 2026 21:23
@mattrossman
mattrossman marked this pull request as ready for review September 17, 2026 20:40
@mattrossman
mattrossman requested a review from a team as a code owner September 17, 2026 20:40
@mattrossman
mattrossman merged commit 3de184d into main Sep 21, 2026
7 checks passed
@mattrossman

Copy link
Copy Markdown
Collaborator Author

Hex has been updated with the renamed durationMs -> agentRunDurationMs field

mattrossman added a commit that referenced this pull request Sep 21, 2026
Fixes a regression that slipped into
[#303](#303) where runs without a
`workspace/` (non local-stack ones) fail to upload artifacts. My
verification dispatch on that PR ran a [single CLI
eval](https://github.com/supabase/evals/actions/runs/35152800137), one
of the few that does produce a workspace, so nothing caught it. Packing
now writes an empty archive when the dir is absent, which keeps the
missing-archive check in `downloadResults` strict.

Verified with a more comprehensive [full regression refresh on this
branch](https://github.com/supabase/evals/actions/runs/35657023299),
78/78 runs packed and exported (compare with [the same dispatch on
`main`](https://github.com/supabase/evals/actions/runs/35634801354)
which dropped 54 of 78)
mattrossman added a commit that referenced this pull request Sep 24, 2026
Follow-up on edge case from #303.

When VM shutdown is slow, `sandbox.stop()` resolves after ~15s with
`status: "stopping"` and no duration, CPU, or network, so our results
have primarily recorded `sandboxUsage` as `memory` only. This was missed
in #303 because it didn't occur on my test run, it's possibly an
upstream bug since Vercel
[docs](https://vercel.com/docs/sandbox/sdk-reference#sandbox.stop) claim
"`sandbox.stop()` resolves once the VM is fully stopped". Filed upstream
as [vercel/sandbox#350](vercel/sandbox#350).

Sandbox cleanup now polls `stop()` while the session is still `stopping`
(up to 60s) and warns if usage is still incomplete.

Compare regression results
[before](https://github.com/supabase/evals/blob/dacee2b9ef76eba40db88f6d3f8a9c9b4e1a3ff3/apps/web/src/data/regression-eval-results.json#L159-L161)
recording `memory` only, and [after a single-run regression
refresh](https://github.com/supabase/evals/blob/eb2adfd6/apps/web/src/data/regression-eval-results.json#L154-L162)
they record full usage.

| Before | After |
|--------|--------|
| <img width="570" height="170" alt="CleanShot 2026-09-24 at 2 08 46
PM@2x"
src="https://github.com/user-attachments/assets/f2b9913c-a349-4346-9fdc-ff7a58db451e"
/> | <img width="514" height="418" alt="CleanShot 2026-09-24 at 2 08 50
PM@2x"
src="https://github.com/user-attachments/assets/9ecb6f8d-321d-4673-bbda-b1afd4b8f892"
/> |

Closes AI-1247

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Preview — a51fd580 Deployed Sep 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants