air run: package code_source tarball via DABs artifact upload - #6015
Conversation
21edbbe to
cc10318
Compare
Integration test reportCommit: dff7538
11 interesting tests: 4 SKIP, 3 FAIL, 3 RECOVERED, 1 KNOWN
|
ben-hansen-db
left a comment
There was a problem hiding this comment.
Few comments for me to understand
| } | ||
| cleanup := func() { _ = os.RemoveAll(tmp) } | ||
|
|
||
| tarball := filepath.Join(tmp, filepath.Base(repoPath)+".tar.gz") |
There was a problem hiding this comment.
in cli we use timestamp to make unique, this should be added here as well to prevent conflicts
There was a problem hiding this comment.
plain-tar is now timestamped (<dir>_<UTC>.tar.gz), git-archive stays content-addressed.
| // uploadSidecars builds and uploads the git_state.json and optional git_diff.patch | ||
| // provenance sidecars into the run's funcDir. It is best-effort: any failure logs a | ||
| // warning and returns whatever paths did upload (possibly none), never an error. | ||
| func uploadSidecars(ctx context.Context, up snapshotUploader, git gitRepo, plan snapshotPlan) (statePath, diffPath string) { |
There was a problem hiding this comment.
why are these not added in the new area? this would affect cli as well, right?
There was a problem hiding this comment.
Intentionally dropped: the typed AiRuntimeTask has no git_state_path/git_diff_path field and the backend never consumed them, so the DABs upload model carries only the tarball. Can re-add if the proto grows the fields.
There was a problem hiding this comment.
we want this for CLI though, I care less about this for DABs
There was a problem hiding this comment.
Can you document this as a TODO if we don't add it? It's superhelpful to know the git state and diff
There was a problem hiding this comment.
let me try to add it here, if not ill add a todo
| // snapshotUploader splits the snapshot's two destinations: the tarball goes to a | ||
| // cache location (the user's repo_snapshots dir or a Volume), sidecars to the run's | ||
| // funcDir. tarBase/sidecarBase are the absolute roots, for reporting final paths. | ||
| type snapshotUploader struct { |
There was a problem hiding this comment.
does the cli still have ability to use the cache?
There was a problem hiding this comment.
Restored — git-archive checks the remote path and skips re-upload on a cache hit.
a22f86f to
24e8d0c
Compare
ben-hansen-db
left a comment
There was a problem hiding this comment.
LGTM, assuming resolving new comments
04bed20 to
e07a6fc
Compare
e07a6fc to
8df15ca
Compare
8df15ca to
4bf7cc4
Compare
Package the code_source snapshot and upload it through DABs' artifact-upload plumbing (libraries.ReplaceWithRemotePath + libraries.Upload over a minimal in-memory bundle), rewriting ai_runtime_task.code_source_path to the uploaded remote path. The packaging + upload orchestration is CLI-owned (experimental/air/cmd, OWNERS = us); it only reuses DABs' uploader so we don't reimplement workspace/volume upload. snapshot_dabs.go: - plain-tar the working tree, or `git archive` the resolved commit when code_source.snapshot.git pins a commit/branch (git resolution stays CLI-side — a train.yaml construct with no DABs config surface). - remote_volume uploads to a UC Volume natively: GetFilerForLibraries routes /Volumes destinations to filerForVolume, so no special-casing is needed. Replaces the retired raw-filer upload path. Tests cover working-tree, git-pinned, and remote_volume submits via testserver. Co-authored-by: Isaac
…ache Addresses review feedback on the DABs-upload snapshot path: - Unique tarball names: plain-tar (working-tree) snapshots are now timestamped (<dir>_<UTC>.tar.gz) instead of a fixed <dir>.tar.gz, so two concurrent submissions of the same root_path no longer clobber each other in the shared .internal artifact dir. - Restore git-archive caching: git_archive snapshots are content-addressed by (commit, include_paths); if the identical tarball is already uploaded we skip packaging and upload and reuse the remote path, checked via the same filer the uploader routes to (GetFilerForLibraries). Provenance sidecars (git_state.json / git_diff.patch) remain intentionally dropped: the typed jobs.AiRuntimeTask has no field for them and the backend never consumed them, so the DABs upload model carries only the tarball. Tests: assert plain-tar names are unique/timestamped, and that a repeated git.commit submit is a cache hit (single upload, identical remote path). Acceptance golden regenerated for the content-addressed name. Co-authored-by: Isaac
Per review, restore the git_state.json / git_diff.patch provenance sidecars for the CLI code_source path. They are files uploaded next to the run launch dir (command.sh), independent of the ai_runtime_task proto, so no proto field is needed — the earlier "no proto field" rationale for dropping them was wrong. - snapshotViaDABsUpload now writes the sidecars via the run funcDir filer after the tarball upload, git repos only, best-effort: buildGitStateSidecar + captureDirtyDiff already existed; only the uploadSidecars orchestration was gone. git_state.json records packaging_mode / tip_commit / branch / dirty / diff_status; git_diff.patch carries the working-tree diff when dirty. - snapshotResult regains GitStatePath / GitDiffPath; the gitStateName / gitDiffName constants return to snapshot_git.go. Test: a dirty git submit uploads both sidecars to the launch dir and git_state.json records dirty=true / diff_status=captured. Verified live on staging (git_state.json + git_diff.patch land next to command.sh with correct content). Co-authored-by: Isaac
4bf7cc4 to
dff7538
Compare

Package the code_source working tree into a tarball and upload it through DABs' artifact-upload plumbing (libraries.ReplaceWithRemotePath + libraries.Upload over a minimal in-memory bundle), rewriting ai_runtime_task.code_source_path to the uploaded remote path. The packaging + upload orchestration is CLI-owned (experimental/air/cmd, OWNERS = us); it only reuses DABs' uploader so we don't reimplement workspace/volume upload.
snapshot_dabs.go: build the plain-tar tarball (createPlainTarball), carry it as a file-valued code_source_path on a minimal bundle, and drive the DABs upload. runsubmit.go swaps the old raw-filer snapshot upload for this. Removes the retired raw-filer upload path (snapshot.go uploader, snapshot_test.go).
Tar snapshotting only; git pinning follows in the next PR (its git helpers are removed here and reintroduced there).
Co-authored-by: Isaac
Changes
Why
Testing
Unit + acceptance
experimental/air/cmd/...andacceptance/experimental/air/run-submit— working-tree,git-pinned, and remote-Volume submits each assert the tarball lands under
.internal/and the rewritten
code_source_pathrides the submittedai_runtime_task; plus the tarbuilders (
.gitignore,.gitexclusion,include_paths) and the no-code_sourcenil-guard. All green.
Live E2E — staging
dbc-04ac0685-8857(GPU_1xA10)5/5 runs SUCCESS, one per packaging mode. All runs are
CAN_VIEWfor the workspaceusersgroup, so every link below is openable by anyone in the workspace.Setup — a tiny project with a gitignored file (
debug.log) to prove exclusion:1. Working-tree tarball — plain tar of the working tree, honoring
.gitignore.Run: 994765091508414
2. Git-pinned commit —
git archiveof a pinned SHA. An uncommitted file is createdafter the commit to prove the archive captures the commit, not the dirty working tree.
Run: 304463075281818
3. UC Volume destination —
remote_volumeroutes the upload to a UC Volume via theFiles API (
/api/2.0/fs/files/...), natively, with no special-casing in the CLI.Run: 438683652713410
4.
include_pathssubset — only the listed paths are packaged.Run: 261250771126835
5. No
code_source— nothing is uploaded;code_source_pathis left empty (nil-guard).Run: 138286541552104