promote: test → main (org base-snapshot lookup + prebuilt fix)#530
promote: test → main (org base-snapshot lookup + prebuilt fix)#530sweetmantech merged 1 commit intomainfrom
Conversation
* feat(sandbox): port org base-snapshot lookup from open-agents Closes the largest user-visible regression in the cutover gap analysis: ~75s slower cold start per session because api wasn't reading the per-org base snapshots open-agents builds. After this, api warm-boots recoupable org sessions from the most recent created snapshot when one exists, falling through to default provisioning otherwise. Scope: lookup only. - `extractOrgRepoName(repoUrl)` matches `https://github.com/recoupable/X` and returns X (or null for non-recoupable repos) - `findOrgSnapshot(name)` calls `Snapshot.list({ name, sortOrder: "desc", limit: 5 })` from `@vercel/sandbox` and returns the first `created` snapshot's id, null on miss / error - `createSandboxHandler` runs the lookup only when extractOrgRepoName returns non-null (skips for non-recoupable repos so the latency cost only applies where it can pay off), then plumbs the resolved id into `connectSandbox` options as `baseSnapshotId` Out of scope (will need its own PR): - `kickBuildOrgSnapshotWorkflow` — builds new snapshots when none exist yet. Open-agents currently does this via Vercel Workflow. Skipped here because (a) api doesn't have Vercel Workflow infra yet, and (b) open-agents' workflow keeps building snapshots today, so api can immediately benefit by reading what open-agents writes. Once open-agents is fully cut over to api, the build piece needs to land too — at that point new orgs would never get a snapshot. TDD red -> green: - 7 unit tests for extractOrgRepoName (recoupable URL, .git suffix, trailing slash, non-recoupable orgs, nested paths, non-GitHub, org-root-no-repo) - 5 unit tests for findOrgSnapshot (most-recent-created, list call shape, no-created-state, empty list, throw) - 3 new createSandboxHandler tests (recoupable repo + lookup hit plumbs baseSnapshotId, non-recoupable repo skips lookup entirely, recoupable repo + lookup miss does not pass baseSnapshotId) - Suite: 2559 -> 2574 (+15 tests). pnpm lint:check + tsc --noEmit clean for new files. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(sandbox): log findOrgSnapshot outcomes for production observability Adds a single structured log line on the success path: [findOrgSnapshot] '<name>' → <hit snap_id | miss> (N total returned) Useful both for the cutover verification (proves the lookup ran for specific request URLs without needing to redeploy with debug instrumentation) and for ongoing prod observability — when an org's snapshot pipeline breaks, this is the line that surfaces it. Error path log was already present. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(sandbox): set source.prebuilt:true when restoring from org snapshot Caught during the hit-case smoke test against a real recoupable org repo: with a snapshot found and `baseSnapshotId` plumbed in, the sandbox boot still fell through to a fresh `git clone`, which then failed with exit 128. Reason: I'd dropped the `prebuilt` source flag from the port, calling it "informational." It is not. Reading lib/sandbox/vercel/sandbox/VercelSandbox.ts, the flag switches between two distinct boot paths: - `source && baseSnapshotId && !source.prebuilt` → fresh clone on top of snapshot (often fails for private repos and defeats the warm-boot benefit) - `source?.prebuilt && baseSnapshotId` → `git fetch` + `git reset --hard` against the repo that's already inside the snapshot (the fast path) Setting `prebuilt: !!orgSnapshotId` matches open-agents' behavior and unlocks the actual ~75s warm-boot win this PR exists to enable. Tests updated: existing assertions for hit-case extended to also verify `source.prebuilt === true` when a snapshot is found, and `source.prebuilt === false` when the lookup misses. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Promotes the org base-snapshot lookup port from
testtomain.What lands on main
feat(sandbox): port org base-snapshot lookup from open-agents(feat(sandbox): port org base-snapshot lookup from open-agents #529, squash-merged into test as13d074f7)extractOrgRepoName+findOrgSnapshot— recoupable repos warm-boot from per-org base snapshots when one existssource.prebuilt: !!orgSnapshotIdflag plumbed correctly sogit fetch + resetruns against the snapshot's repo instead of fresh clone (real bug caught during smoke testing — see PR comments)[findOrgSnapshot]log line per requestVerification
https://github.com/recoupable/org-rostrum-pacific-cebcc866-...:snap_MxxRCI8WAPjZgVVyZOf26lgMWIK4[findOrgSnapshot] '...' → hit snap_MxxRCI8WAPjZgVVyZOf26lgMWIK4Out of scope (still missing from cutover)
🤖 Generated with Claude Code
Summary by cubic
Warm-boots recoupable org sandboxes by looking up per-org base snapshots and enabling the prebuilt restore path, cutting cold starts by ~75s. Adds lightweight production logs to verify snapshot hits.
New Features
recoupablerepos viaextractOrgRepoName+findOrgSnapshot(uses@vercel/sandbox) and passbaseSnapshotIdto the sandbox.[findOrgSnapshot]log per request for observability.Bug Fixes
source.prebuilt: truewhen usingbaseSnapshotIdto trigger the fastgit fetch + resetpath instead of a fresh clone.Written for commit 13d074f. Summary will update on new commits.