Skip to content

runner: hand the task to the image's launcher as files - #621

Merged
aprajitaarora13 merged 1 commit into
mainfrom
aprajitaarora/prebuilt-3-launcher-files
Nov 17, 2026
Merged

aprajitaarora13 merged 1 commit into
mainfrom
aprajitaarora/prebuilt-3-launcher-files

Conversation

@aprajitaarora13

@aprajitaarora13 aprajitaarora13 commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

This adds the runner side of the prebuilt image contract. On every start the runner writes the task as files and points the task's command at them. Nothing per-task has to go into the container environment or the ActorTemplate.

Env var Path Content
AX_GOAL_FILE /run/ax/goal.md spec.goal.text
AX_CONFIG_FILE /run/ax/config.json spec.config
AX_MCP_CONFIG_FILE /run/ax/mcp.json The Workspace's MCP servers, as {"mcpServers": ...}
AX_SESSION_FILE /run/ax/session-id spec.session_id
AX_OUTPUT_FILE <workspace>/.ax/output Written by the launcher; the path TaskOutcome.output already documents
  • The files under /run/ax are rewritten on every start, so a sandbox restored from a snapshot never sees a stale goal. The output file is on the workspace volume, so it survives suspend.
  • Launcher. When spec.commands is empty and the task has a goal, the runner starts the image's launcher at /usr/local/bin/ax-harness. That's the path the images in agentexecutor/images already use.
  • No goal, or no launcher in the image. The runner keeps today's behavior and serves until stopped, so users can attach with ax ssh.
  • Tasks with spec.commands get the same variables, so any command can write $AX_OUTPUT_FILE. The launcher isn't started for them. If the files can't be written for such a task, the runner logs a warning and runs the command anyway.
  • Completion marker. After the launcher exits, the runner records a digest of its input in <workspace>/.ax/launcher-done. A resumed sandbox then doesn't re-run a finished one-shot task, but a new goal, config or session does run. This should line up with the task state machine work; happy to adjust.
  • MCPServers moves from claude-code-runner into package runner, so both use the same conversion.

Copying the output into status.outcome.output belongs to the runner's event reporting and isn't part of this PR.

Tests: the launcher gets every file; a goal-less task doesn't start the launcher; a finished launcher isn't restarted for the same goal but is for a new one; commands get the variables; a missing launcher serves; MCPServers.

Part of #493.

Stack (review in order):

  1. Runner volume image (build: add the runner volume image #619)
  2. Mount the runner from the volume (controller, substrate: mount the runner from a read-only image volume #620)
  3. This PR: hand the task to the image's launcher as files
  4. E2E: a pure image with a launcher on the mounted runner

@aprajitaarora13
aprajitaarora13 force-pushed the aprajitaarora/prebuilt-3-launcher-files branch from 504bf69 to 07a99eb Compare November 17, 2026 00:24
@aprajitaarora13
aprajitaarora13 marked this pull request as ready for review November 17, 2026 00:33

@mayawang mayawang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is the file contract the images should target: goal from spec.goal.text, answer in $AX_OUTPUT_FILE. I'll flag on the images PRs that they don't match yet. Non-blocking: a goal with no launcher serves forever with only a log line (a condition would help); the done marker is written even when the launcher fails, so a failure isn't retried on resume; and if an image sets a non-root USER, creating /run/ax may fail, worth checking.

@aprajitaarora13
aprajitaarora13 force-pushed the aprajitaarora/prebuilt-3-launcher-files branch from 07a99eb to 4d28328 Compare November 17, 2026 02:13
@aprajitaarora13
aprajitaarora13 force-pushed the aprajitaarora/prebuilt-3-launcher-files branch from 4d28328 to b2cc9a8 Compare November 17, 2026 02:18
Base automatically changed from aprajitaarora/prebuilt-2-mount-runner to main November 17, 2026 02:20
Add the runner side of the prebuilt image contract. On every start the
runner writes the task as files and points the task's command at them,
so nothing per-task has to go into the container environment or the
ActorTemplate:

  AX_GOAL_FILE        /run/ax/goal.md      spec.goal.text
  AX_CONFIG_FILE      /run/ax/config.json  spec.config
  AX_MCP_CONFIG_FILE  /run/ax/mcp.json     the Workspace's MCP servers,
                                           in the {"mcpServers": ...} format
  AX_SESSION_FILE     /run/ax/session-id   spec.session_id
  AX_OUTPUT_FILE      <workspace>/.ax/output, written by the launcher

The files under /run/ax are rewritten on every start, so a sandbox
restored from a snapshot never sees a stale goal. The output file is on
the workspace volume so it survives suspend; it is the path
TaskOutcome.output already documents.

When spec.commands is empty and the task has a goal, the runner starts
the image's launcher at /usr/local/bin/ax-harness, the path the images
in agentexecutor/images already use. Without a goal (or without a
launcher in the image) it keeps today's behavior and serves until
stopped, so users can attach with `ax ssh`. Tasks with spec.commands
get the same variables, and the launcher is not started for them.

After the launcher exits, the runner records a digest of its input in
<workspace>/.ax/launcher-done, so a resumed sandbox does not run a
finished one-shot task again; a new goal, config or session runs it.

MCPServers moves from claude-code-runner into package runner so both
use the same conversion.

Copying the output into status.outcome.output belongs to the Task
Runtime event reporting and is not part of this change.

Part of #493 (prebuilt agent images).
@aprajitaarora13
aprajitaarora13 force-pushed the aprajitaarora/prebuilt-3-launcher-files branch from b2cc9a8 to 019bbcf Compare November 17, 2026 02:20
@aprajitaarora13
aprajitaarora13 merged commit bd4a683 into main Nov 17, 2026
10 checks passed
@aprajitaarora13
aprajitaarora13 deleted the aprajitaarora/prebuilt-3-launcher-files branch November 17, 2026 02:31
Lukeluds added a commit to Lukeluds/ax-images that referenced this pull request Nov 17, 2026
…_CONFIG_FILE servers

Aligns ax-harness with the launcher contract in google/ax#621: the goal
comes from spec.goal.text, the answer is written to AX_OUTPUT_FILE (and
still printed to stdout), and the Workspace's MCP servers are registered
with agy mcp add before the task runs.
@mayawang mayawang mentioned this pull request Nov 17, 2026
aprajitaarora13 added a commit that referenced this pull request Nov 18, 2026
Follow up on the non-blocking review comments from #620, #621 and #622:

- Only record `<workspace>/.ax/launcher-done` when the launcher exits
  with status 0, so a failed launcher run is retried when the sandbox
  is resumed.
- Fall back to `<os.TempDir>/ax-run` when `Config.RunDir` is empty and
  `/run/ax` cannot be created (for example when a container image sets
  a non-root `USER`).
- Start the task command or launcher (or skip it via `launcher-done`)
  before marking `/readyz?check=workspace` ready, so callers waiting on
  `ax resume` never race the start of a launcher run.
- Reuse `${REGISTRY_ADDR}/ax-task-runner:base` (with
  `/usr/local/bin/ax-task-runner` removed) for `ax-e2e-launcher:e2e` so
  `hack/setup-e2e-kind.sh` avoids an extra Docker Hub pull.
- Document on `substrate.MountRunnerVolume` that enabling
  `--runner-volume-image` sets the container command on all AX-managed
  templates, leaves user-managed `ate_actor_template` references
  untouched, and still expects `/bin/sh` and `git` in pure images when
  workspace setup (`spec.setup`) runs.

Part of #493.
@rakyll rakyll mentioned this pull request Nov 21, 2026
4 of 6 tasks
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