Skip to content

Package a local directory code_source_path for AI Runtime tasks - #5971

Draft
ben-hansen-db wants to merge 1 commit into
mainfrom
air-code-source-dir
Draft

Package a local directory code_source_path for AI Runtime tasks#5971
ben-hansen-db wants to merge 1 commit into
mainfrom
air-code-source-dir

Conversation

@ben-hansen-db

Copy link
Copy Markdown
Contributor

Let ai_runtime_task.code_source_path point at a local directory, not just a pre-built tarball. A new aicode mutator (run in the build phase, before libraries.ExpandGlobReferences/ReplaceWithRemotePath) detects a local-directory value, packages it into a reproducible, content-addressed tarball — honoring .gitignore and the top-level sync.include/exclude globs — uploads it to the user's ~/.air/repo_snapshots directory, and rewrites code_source_path to the uploaded (de-/Workspace-prefixed) path. Because it runs first, PR #5922's artifact-style collection then sees an already-remote path and skips it, so the two compose: a directory is packaged by the CLI, a pre-built .tgz still flows through the artifact path.

Also synthesizes a requirements.yaml next to the task's command_path from the job's serverless environments[] spec, so the AI Runtime harness sets up the workload environment. command_path translation itself is provided by #5922.

Verified end-to-end on a live workspace: a plain bundle deploy of a directory code_source_path yields a job whose run terminates SUCCESS; sync.exclude and .gitignore entries are absent from the uploaded snapshot; unchanged code skips re-upload.

Co-authored-by: Isaac

Changes

Why

Tests

Let ai_runtime_task.code_source_path point at a local directory, not just a
pre-built tarball. A new aicode mutator (run in the build phase, before
libraries.ExpandGlobReferences/ReplaceWithRemotePath) detects a local-directory
value, packages it into a reproducible, content-addressed tarball — honoring
.gitignore and the top-level sync.include/exclude globs — uploads it to the
user's ~/.air/repo_snapshots directory, and rewrites code_source_path to the
uploaded (de-/Workspace-prefixed) path. Because it runs first, PR #5922's
artifact-style collection then sees an already-remote path and skips it, so the
two compose: a directory is packaged by the CLI, a pre-built .tgz still flows
through the artifact path.
Also synthesizes a requirements.yaml next to the task's command_path from the
job's serverless environments[] spec, so the AI Runtime harness sets up the
workload environment. command_path translation itself is provided by #5922.
Verified end-to-end on a live workspace: a plain bundle deploy of a directory
code_source_path yields a job whose run terminates SUCCESS; sync.exclude and
.gitignore entries are absent from the uploaded snapshot; unchanged code skips
re-upload.
Co-authored-by: Isaac
@ben-hansen-db
ben-hansen-db marked this pull request as draft July 17, 2026 22:01
@github-actions

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

8 files changed
Suggested: @janniklasrose
Also eligible: @shreyas-goenka, @denik, @andrewnester, @anton-107, @lennartkats-db, @pietern

/bundle/ - needs approval

10 files changed
Suggested: @janniklasrose
Also eligible: @shreyas-goenka, @denik, @andrewnester, @anton-107, @lennartkats-db, @pietern

General files (require maintainer)

Files: .nextchanges/bundles/ai-runtime-code-source-dir.md
Based on git history:

  • @janniklasrose -- recent work in .nextchanges/bundles/, bundle/phases/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: ff0f4c8

Run: 29616637965

Env💚​RECOVERED🙈​SKIP✅​pass🙈​skipTime
💚​aws linux4422711224:44
💚​aws windows4422911206:49
💚​aws-ucws linux4431410395:30
💚​aws-ucws windows4431610377:43
💚​azure linux4422711215:03
💚​azure windows4422911197:17
💚​azure-ucws linux4431610365:54
💚​azure-ucws windows4431810347:27
💚​gcp linux4422611235:12
💚​gcp windows4422811218:56
8 interesting tests: 4 RECOVERED, 4 SKIP
Test Nameaws linuxaws windowsaws-ucws linuxaws-ucws windowsazure linuxazure windowsazure-ucws linuxazure-ucws windowsgcp linuxgcp windows
💚​TestAccept💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R
🙈​TestAccept/bundle/invariant/no_drift🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/ssh/connection🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestFetchRepositoryInfoAPI_FromRepo💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R
💚​TestFetchRepositoryInfoAPI_FromRepo/root💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R
💚​TestFetchRepositoryInfoAPI_FromRepo/subdir💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R
Top 10 slowest tests (at least 2 minutes):
durationenvtestname
8:29gcp windowsTestAccept
6:49azure windowsTestAccept
6:35aws-ucws windowsTestAccept
6:25aws windowsTestAccept
6:20azure-ucws windowsTestAccept
3:05gcp linuxTestAccept
3:03azure linuxTestAccept
2:59azure-ucws linuxTestAccept
2:57aws-ucws linuxTestAccept
2:56aws linuxTestAccept

vinchenzo-db added a commit that referenced this pull request Jul 20, 2026
AI Runtime tasks can point code_source_path at a local directory. The
aicode mutator packages that directory into a reproducible, content-
addressed tarball (.git + gitignored files excluded, sync globs honored),
uploads it to the user's ~/.air/repo_snapshots, and rewrites the field to
the remote path. The content-addressed name lets an unchanged directory
skip re-upload across deploys.
Adapted from Ben Hansen's #5971. codeSourceFiles uses the existing
libs/sync.GetFileList (scoping Paths to the code dir) rather than adding a
new NewFileList helper. SynthesizeRequirements writes requirements.yaml
next to command_path from the job's serverless environment; Validate
surfaces local-dir misconfigurations at validate time.
Co-authored-by: Isaac
vinchenzo-db added a commit that referenced this pull request Jul 20, 2026
AI Runtime tasks can point code_source_path at a local directory. The
aicode mutator packages that directory into a reproducible, content-
addressed tarball (.git + gitignored files excluded, sync globs honored),
uploads it to the user's ~/.air/repo_snapshots, and rewrites the field to
the remote path. The content-addressed name lets an unchanged directory
skip re-upload across deploys.
Adapted from Ben Hansen's #5971. codeSourceFiles uses the existing
libs/sync.GetFileList (scoping Paths to the code dir) rather than adding a
new NewFileList helper. SynthesizeRequirements writes requirements.yaml
next to command_path from the job's serverless environment; Validate
surfaces local-dir misconfigurations at validate time.
Co-authored-by: Isaac
Sign up for freeto 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.

2 participants

@ben-hansen-db@eng-dev-ecosystem-bot