Repository navigation
feat(sdk): skip unchanged syncCode uploads by digest - #666
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
miyaontherelay
force-pushed
the
ms/native-c-content-addressed-sync-code
branch
from
October 16, 2026 08:22
2a81cba to
7f57c0b
Compare
miyaontherelay
marked this pull request as ready for review
October 16, 2026 08:33
[Medium impact] The PR appears safe to merge; no actionable defects were found in the changed code.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Pack the working tree once, hash the deterministic gzip archive, and send
codeSha256to Cloud prepare. On a verified cache hit, submit the prepared run without an archive PUT. On a miss, upload through the existing run-scoped Cloud API credential. A server without the cache receipt keeps the legacy upload path.The 256 MiB uncompressed cap, Git exclusions, symlink rules, and sandbox extraction path are unchanged. Archives above 64 MiB compressed take the legacy upload path, so the cache never asks Cloud to buffer a larger archive. A cache hit receives a 300-second default budget for run submission, where Cloud now performs the R2 copy after admission; an explicit caller timeout remains honored. Prepare keeps the normal 30-second budget. The response digest and digest-coded key must match the local archive before the client trusts a hit.
Dependency: cloud#5216 merged on 2026-10-16. Verify that its Cloud contract is deployed before publishing the SDK. No package publish is included.
Rebase onto main (7f57c0b)
Rebased cleanly after #669 and #670 merged. The separate missing-copy recovery follow-up remains on its own local branch and is not included here.
Without
TMPDIR=/tmp, 44/45 passed; the authored-flow fixture under/Volumes/Paris Drive/...failed because its space was encoded as%20in a loader URL. This failure is independent of the changed files and passes with a space-free temp path.Security and retention
The digest is a content identifier, not an authorization credential. Cloud derives its cache namespace from authenticated workspace and user IDs, verifies the uploaded bytes against the digest, and copies a hit into the run prefix only after admission. The SDK never accepts an inconsistent hit receipt and never receives direct R2 credentials. Cloud's run-prefix copy preserves workspace retention; the shared upload cache has a short lifecycle.
For a 54 MiB transmitted archive, an unchanged run saves 54 MiB of client upload and its full HTTP PUT. At 10–50 MiB/s uplink that removes roughly 1.1–5.4 seconds of transfer time before request overhead; local tar/gzip and the server-side R2 copy still run, so the net latency gain needs measurement after deploy. The research report does not establish whether the observed 54 MiB is compressed or uncompressed.
Verification
npm ciinpackages/sdk: succeeded (194 packages; no node_modules symlink).TMPDIR=/tmp node ./node_modules/vitest/vitest.mjs run tests/cloud-sync.test.ts --minWorkers=1 --maxWorkers=1 --testTimeout=20000: 45/45 passed.node ./node_modules/typescript/bin/tsc --noEmit && node ./node_modules/typescript/bin/tsc -p tsconfig.type-tests.json --noEmit: passed.npm run build: passed.npm run typecheck:tests: passed.git diff --check: passed.npm testprep could not run here becauserustcis unavailable; the focused SDK suite above ran directly with an isolated/tmptest home.Agent Relay sessions
codexsession01a13937· opened viagh pr create· last active 2026-10-16Note
Medium Risk
Changes the cloud run admission path and depends on the new prepare/cache contract; incorrect hit validation or timeout behavior could block or delay runs, though legacy upload remains for large archives and cache misses.
Overview
Adds content-addressed code sync for hosted
syncCoderuns: the SDK packs the working tree, computes a SHA-256 of the deterministic gzip tarball (when the archive is ≤ 64 MiB compressed), and sendscodeSha256on/api/v1/workflows/prepare.On a verified cache hit (matching
codeCachereceipt andcode-sha256-<digest>.tar.gzkey), it skips the archive PUT and submits the run with a default 300s submit timeout so Cloud can copy from R2 after admission. On a miss—or when the archive is too large—it keeps the legacy upload path.Packing now normalizes the gzip OS byte to 255 so identical trees produce stable bytes and digests despite platform/mtime noise (executable bits still affect the digest). Prepare responses with inconsistent cache metadata are rejected before any upload.
Reviewed by Cursor Bugbot for commit 7f57c0b. Bugbot is set up for automated code reviews on this repo. Configure here.