Skip to content

Parallelize archive build and size-aware retry hint - #91

Merged
wasimxyz merged 4 commits into
stagingfrom
cursor/parallelize-archive-build-retry-hint
Jun 9, 2026
Merged

Parallelize archive build and size-aware retry hint#91
wasimxyz merged 4 commits into
stagingfrom
cursor/parallelize-archive-build-retry-hint

Conversation

@wasimxyz

@wasimxyz wasimxyz commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Parallelize the run-archive Lambda builder: small source objects are now prefetched concurrently (bounded by _PREFETCH_CONCURRENCY=16 and a _PREFETCH_MAX_INFLIGHT_BYTES=256 MB budget) a window ahead of the single-threaded zip writer. This collapses the serial per-object GetObject latency that dominated runs with thousands of tiny files. Large/unknown-size files still stream inline so the memory-bounded design (e.g. a 200 GB run in a 10 GB Lambda) is preserved, and zip entry ordering is unchanged.
  • Replace the flat 5s MCP get_run_archive retry hint with estimateRetryAfterSeconds({ fileCount, totalBytes })base + fileCount*perFile + bytes/throughput, clamped to [5s, 30s]. This better reflects build time for both many-small-files and few-large-files runs.
  • Thread per-file sizeBytes from the web layer (loadDownloadableFiles -> InvokeBuildArchiveInput) into the Lambda invoke payload as size_bytes, used both for the retry estimate and for the builder's prefetch-eligibility decision. Parsing is lenient/backward-compatible (missing or malformed -> unknown -> inline stream).

Driveby changes

  • Ran npm audit fix to address security vulnerabilities in Next.js project.

Test plan

  • Lambda pytest suite (248 passed), including new tests: many-small-files order/contents, deterministic concurrency (barrier), inline-streaming routing for large/unknown sizes (asserted via thread identity), mixed ordering, worker-fetch-failure abort, and size_bytes parsing.
  • Web MCP/unit suites (64 passed), including the new estimateRetryAfterSeconds unit tests.
  • Integration tests: download-archive (7) and mcp (15).
  • make check-all (format, lint, typecheck) clean across Python and frontend.

Made with Cursor

wasimxyz and others added 2 commits June 9, 2026 13:55
Prefetch small source objects concurrently (bounded by count + in-flight
bytes) a window ahead of the single-threaded zip writer, collapsing the
serial per-object GetObject latency that dominates runs with thousands of
tiny files. Large/unknown-size files still stream inline to keep memory
bounded.

Replace the flat 5s MCP retry hint with an estimate derived from file
count and total run size (clamped to [5s, 30s]), threading per-file
sizeBytes from the web layer into the Lambda invoke payload.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
data-hub Ready Ready Preview, Comment Jun 9, 2026 11:05pm

Request Review

wasimxyz and others added 2 commits June 9, 2026 16:04
Trim over-length comments, reference constants by name instead of
restating values, backtick symbols, and drop an inaccurate note about
boto3's connection pool. Comments only; no behavior change.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@wasimxyz
wasimxyz marked this pull request as ready for review June 9, 2026 23:15
@wasimxyz
wasimxyz merged commit f357f2e into staging Jun 9, 2026
6 checks passed
@wasimxyz
wasimxyz deleted the cursor/parallelize-archive-build-retry-hint branch June 9, 2026 23:16
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.

1 participant