Skip to content

Expose live Substrate actor UIDs in task status and describe output - #556

Merged
erain merged 1 commit into
google:mainfrom
erain:task-residency-outcome
Nov 14, 2026
Merged

erain merged 1 commit into
google:mainfrom
erain:task-residency-outcome

Conversation

@erain

@erain erain commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Task status identifies the Substrate actor by name, but does not expose its UID. Names can be reused when an actor is recreated, so operators cannot reliably match a task to the actor identity in Substrate logs and events (ate.actor.uid).

This adds status.actorUid to task responses and an Actor UID line to ax describe task <name>.

Design and scope

The UID follows the live-read design established in #515: gets and lists read it from the current Substrate actor, and every task store write strips it. A recreated actor's new UID appears on the next read. If the actor is missing or Substrate cannot be reached, the UID is empty and describe shows <none> rather than a stale identity.

actor_uid uses protobuf field 23 to avoid the field numbers in #563's current status schema sketch. Residency and outcome remain with #563. This contributes the actor identity needed for #13; it does not add telemetry events or command-exit detection.

Tests

  • Regression tests fail against the original server implementation and pass with this change. They cover live get/list results, actor recreation, clearing stale UIDs for missing or unreadable actors, and excluding both client-supplied and read-derived UIDs from stored status.
  • CLI tests check the current UID, a recreated actor's UID, and the <none> display.
  • Local make verify, builds of the CLI/server/task runner, go test -count=1 ./..., and race tests for ./internal/server and ./cmd/ax pass. The ordinary local test run skips the opt-in Postgres and E2E tiers.

Live validation

Setup: A separate disposable Kind cluster with Agent Substrate v1.0.0 from its release images, four gVisor workers, PostgreSQL, and AX binaries/images built from this change.

Actions: TestE2E_TaskLifecycleAndSubstrateSync creates a suspended task, compares its reported UID with the real Substrate actor's nonempty UID, and checks that ax describe task prints the same value. It then resumes the task, checks readiness and the worker address, and deletes the task and its Substrate resources.

Result: The focused live test passed, and the disposable cluster was removed. The missing/unreachable actor and recreation cases use in-process fixtures in the regression tests. GitHub's build-and-test job, including the Postgres tests, and full Kind E2E suite also passed on 7a146fb.

To repeat the focused live test, follow the E2E setup instructions and run:

make test-e2e E2E_ARGS='-test.run TestE2E_TaskLifecycleAndSubstrateSync'

This change was written with help from an AI coding assistant.

@mayawang

Copy link
Copy Markdown
Collaborator

Really thorough work, and the crashed-worker demo is great. Two design questions before approving: this stores residency and the actor UID again, which #515 moved away from (and the stored copy can drift on router wakes, same as #502). And #563 is about to reshape task status, so it'd be good to land these fields as part of that. @rakyll @yongruilin how do you want to sequence it? The actor UID for joining with Substrate logs seems useful on its own either way.

@erain

erain commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @mayawang , that makes sense. Reads still use live Substrate state, but the stored copy can drift, so your concern is valid.

To get this into a mergeable shape, I can narrow it to exposing the actor UID from live reads, without storing another copy, and leave residency and outcome to #563. We can align the UID field with that schema too. Would that smaller scope work?

@mayawang

Copy link
Copy Markdown
Collaborator

Yes, that works great, thanks! UID from live reads now, residency and outcome with #563

@erain erain self-assigned this Nov 13, 2026
Read actor identity alongside the existing live actor status and show it in task descriptions so operators can correlate Substrate telemetry. Strip the UID from stored status and clear it when the actor cannot be read.
@erain
erain force-pushed the task-residency-outcome branch from 6d1eafc to 7a146fb Compare November 13, 2026 20:11
@erain erain changed the title api,cli: report task residency, actor UID, and outcome Expose live Substrate actor UIDs in task status and describe output Nov 13, 2026

@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 for narrowing it, LGTM

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