fix(httpapi): support complete github tarball fetch imports

KH
2d ago
+1178-120

Summary

  • add complete-v1 sourceProfile handling to async GitHub tarball fetch imports
  • preserve dotfiles, non-.git ignored paths, executable modes, safe symlinks, and 64MiB complete-v1 file limit
  • return strict sourceProfile/filesExpected accounting and expire stale active fetch jobs so retries are not deduped forever
  • update OpenAPI and focused regression tests

Verification

  • GOCACHE=$PWD/.gocache GOMODCACHE=$PWD/.gomodcache go test ./internal/httpapi -run 'TestGithubTarball'\n- scripts/check-contract-surface.sh\n- veto_diff_review pass\n\nAgent37 zero-config proof blocker: Cloud complete-v1 sandbox materialization requires Relayfile async import; stale active import jobs caused 840s Cloud timeouts, and direct import rejects complete-v1.

[!NOTE]
Medium Risk
Changes tarball extraction, import limits, and async job lifecycle for workspace filesystem writes; complete-v1 fails strictly on unsupported tar entries rather than silently skipping.

Overview
Adds a sourceProfile (filtered-v1 default, complete-v1) to GitHub tarball import so Cloud can materialize a fuller working tree via the async fetch path only; direct gzip upload rejects complete-v1.

For complete-v1, extraction keeps paths that filtered-v1 would skip (e.g. dotfiles, node_modules), preserves tar file modes, imports safe symlinks, and raises the per-file cap to 64MiB—with hard errors when the archive cannot be represented faithfully. Responses and pollable jobs now include sourceProfile and filesExpected for strict accounting.

Active fetch jobs are deduped per workspace/repo/SHA/profile, and jobs stuck in queued/fetching/importing past a TTL are marked failed so retries are not blocked indefinitely. OpenAPI and httpapi tests cover complete imports and stale-job expiry.

Reviewed by Cursor Bugbot for commit 8e2aad0b74f05416907868284f7725938a0f28cf. Bugbot is set up for automated code reviews on this repo. Configure here.