Skip to content

Runner pull agent - #637

Merged
itssimrank merged 3 commits into
mainfrom
runner-pull-agent
Nov 18, 2026
Merged

itssimrank merged 3 commits into
mainfrom
runner-pull-agent

Conversation

@itssimrank

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #635. Adds the pull-based runner loop to ax-task-runner (runner/pull.go) while preserving legacy AX_TASK_YAML / --task-file mode for existing tests.

Key Changes

  • runner/pull.go, runner/output_buffer.go: Claims assignments on :80/readyz wakeup, persists /var/lib/ax/{runner_token,state.json} keyed by /run/ate/actor-uid, executes SETUP / RUN / RESUME / IDLE, writes /workspace/.ax/{goal.md,config.json} and launcher contract files, drops to UID 1000 when running as root, and reports CommandStarted / CommandExited ($AX_OUTPUT_FILE or 64 KiB stdout/stderr tail).
  • internal/metadata/server.go: Adds OnReadyz wakeup hook, UpdateAssignment, and GET /metadata/v1alpha1/ax/goal.
  • runner/runner.go, cmd/ax-task-runner/main.go: Enables PullMode when AX_TASK_YAML and --task-file are both unset.

Testing

  • go test -count=1 ./internal/metadata/... ./runner/... (including TestPullModeTaskRunAndCompletion and TestPullModeWorkspaceSetup)
  • go build ./cmd/ax-task-runner
  • golangci-lint run ./internal/metadata/... ./runner/... ./cmd/ax-task-runner/... (0 issues)

@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.

Great progress, the privilege drop and event loop look solid. Two things before merge:

  1. Resume lockout: task actors snapshot volumes only, so /var/lib/ax (token + state) is gone after resume. The runner then claims with no token and a new nonce, Claim returns Unauthorized because the token is already confirmed, and it retries forever, so suspend/resume (and any follow-up after completion) never runs again. Needs a decision across #633/#635: re-mint per actor incarnation/resume, or persist somewhere that survives.
  2. /workspace/.ax is owned by uid 1000, so the agent can symlink .ax/output to /var/lib/ax/runner_token (or any root file) and the root runner ships it as CommandExited.output. Open with O_NOFOLLOW + owner check, or read as uid 1000.

Non-blocking: could we drop the /workspace/.ax goal/config copies and keep #621's /run/ax files as the one source?

@itssimrank
itssimrank changed the base branch from runner-http-handler to main November 18, 2026 01:13

@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.

Thanks, the O_NOFOLLOW + owner check and dropping the .ax copies look right, LGTM. The resume lockout is covered by #639's token reset, so these two should land together. Also heads up, #639's E2E shows ax ssh/guest exec 404ing, which looks like pull mode never starting the spec.debug guest services.

@itssimrank
itssimrank merged commit f4a9203 into main Nov 18, 2026
12 checks passed
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