Skip to content

Canonical /ax/STATUS file (JSON) for a task to report COMPLETED, FAILED, or REQUIRES_ACTION #690

Not planned

Description

@rakyll

A task's command has no way to tell AX how it ended. TaskState has COMPLETED, FAILED and REQUIRES_ACTION, and TaskStatus.outcome has result, exit_code and output, but nothing inside the sandbox sets them. A task that finished reads Working/Ready=True until someone deletes it (#346). With #688 the runner no longer reports exit codes to ax-server either, so today the state is never set.

We should define one canonical status file, /ax/STATUS, with structured JSON content. The command (or the image's launcher) writes it, the runner surfaces it, and ax-server turns it into the task's state.

Proposal

File. /ax/STATUS holds one JSON object:

{
  "state": "FAILED",
  "message": "tests failed: 3 of 120",
  "details": {"failedTests": ["test_login", "test_logout", "test_refresh"]}
}
Field Required Meaning
state yes COMPLETED, FAILED, or REQUIRES_ACTION
message no A short human-readable summary, shown by ax describe task and stored as the outcome's status message
details no Any JSON object, passed through to the task's status for tools and UIs; size-capped like spec.config

How each state maps to the task:

state Sets
COMPLETED status.state: COMPLETED, outcome.result: SUCCEEDED
FAILED status.state: FAILED, outcome.result: FAILED
REQUIRES_ACTION status.state: REQUIRES_ACTION; message says what the agent needs from a human

The agent's answer stays in $AX_OUTPUT_FILE and is still reported as outcome.output. /ax/STATUS only says how the task ended.

Location and durability. /ax/STATUS must survive suspend and resume, but only the workspace volume is snapshotted. The runner therefore backs /ax with the workspace volume, for example as a symlink to <workspace>/.ax, so the path stays fixed while the data persists. /run/ax (DefaultRunDir, the launcher's input files) stays separate because it is rewritten on every start. The runner also exports the path as AX_STATUS_FILE, like the other launcher-contract variables (runner/launcher.go).

Writing rules.

  • Write atomically: write a temp file in /ax, then rename it to STATUS.
  • COMPLETED and FAILED are terminal: once the runner has seen one, later writes are ignored.
  • REQUIRES_ACTION is not terminal. The command can overwrite it with a terminal state, and resuming the task with new input clears it so the agent can continue.
  • A file that is not valid JSON, or has an unknown state, is reported as FAILED with a message naming the parse error. A malformed report shouldn't look like success.

Defaults when the command writes nothing. The runner falls back to the exit status and writes /ax/STATUS itself: exit 0 gives {"state": "COMPLETED"}, and a non-zero exit or a signal gives {"state": "FAILED", "message": "exit status 3", "exitCode": 3}. A long-lived command that never exits (an interactive or ax ssh sandbox) stays Working.

Getting the state to ax-server. With #688 the runner never calls ax-server, so ax-server has to read the state from the runner:

  • The runner serves the parsed file on port 80, for example GET /runner/v1alpha1/status, along with the exit code and $AX_OUTPUT_FILE capped at 64 KiB, as outcome.output documents.
  • ax-server records COMPLETED and FAILED in the store once it sees them. store.StoredStatus already persists these AX-owned states and the outcome, so a later read doesn't need the sandbox, which may be suspended or gone.

Related: #346 (finished task reports Working forever), #420 (suspend on completion), #687 (redundant status fields), #688 (push model, which removed exit-code reporting).

Activity

  1. changed the title [-]Canonical status files for a task to report COMPLETED, FAILED, or REQUIRES_ACTION[/-] [+]Canonical /ax/STATUS file (JSON) for a task to report COMPLETED, FAILED, or REQUIRES_ACTION[/+] on Nov 21, 2026
  2. self-assigned this
    on Nov 21, 2026
  3. added this to the v0.4.0 milestone on Nov 21, 2026
  4. rakyll commented on Nov 24, 2026

    @rakyll
    MemberAuthor

    Draft PR #743 has AX record a task as Completed or Failed from a status file its agent writes, and it shows how complicated collecting that signal is. AX has to poll every running task's runner through atenet-router, keep a working queue of the tasks whose end is not recorded yet, avoid resuming suspended actors, and run a separate single-replica observer to do it. Most sophisticated tasks will bring their own communication protocol for these events, such as a task API that reports progress, results and failures to their own systems. Those protocols carry far more than COMPLETED or FAILED, and AX's copy of the outcome would be a second, coarser source of truth. Should AX stay out of judging how a task ended, and leave it to the task's own protocol?

    cc @mayawang @yongruilin Shall we remove state collection completely and leave it up to the callers?

  5. yongruilin commented on Nov 24, 2026

    @yongruilin
    Collaborator

    TBH, I prefer not to have this 5s observer; it seems brittle.
    For 0.4.0, staying as-is (leaving task completion to callers) doesn't seem too bad.
    Later on with Substrate self-suspend(agent-substrate/substrate#483), we can keep treating Substrate's Actor as the source of truth for execution/suspended state rather than polling runners from ax-server.

  6. rakyll commented on Nov 24, 2026

    @rakyll
    MemberAuthor

    Closing in favor of #756. Task status will not contain anything from the data plane of the actor (how its command ended, its output, or retry context); an external orchestrator will manage task status and suspension/resumption. See also #747.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions