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

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 🙈​skip Time
💚​ aws linux 4 4 227 1122 4:44
💚​ aws windows 4 4 229 1120 6:49
💚​ aws-ucws linux 4 4 314 1039 5:30
💚​ aws-ucws windows 4 4 316 1037 7:43
💚​ azure linux 4 4 227 1121 5:03
💚​ azure windows 4 4 229 1119 7:17
💚​ azure-ucws linux 4 4 316 1036 5:54
💚​ azure-ucws windows 4 4 318 1034 7:27
💚​ gcp linux 4 4 226 1123 5:12
💚​ gcp windows 4 4 228 1121 8:56
8 interesting tests: 4 RECOVERED, 4 SKIP
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp 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):
duration env testname
8:29 gcp windows TestAccept
6:49 azure windows TestAccept
6:35 aws-ucws windows TestAccept
6:25 aws windows TestAccept
6:20 azure-ucws windows TestAccept
3:05 gcp linux TestAccept
3:03 azure linux TestAccept
2:59 azure-ucws linux TestAccept
2:57 aws-ucws linux TestAccept
2:56 aws linux TestAccept

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.

2 participants