Skip to content

feat(substrate): refuse memory-tier turns, suspend, resume and fork on a lost or replaced actor - #153

Merged
Anish Ramasekar (aramase) merged 11 commits into
agent-primitives:mainfrom
aramase:aramase/f/substrate_actor_identity_guards
Oct 17, 2026
Merged

Anish Ramasekar (aramase) merged 11 commits into
agent-primitives:mainfrom
aramase:aramase/f/substrate_actor_identity_guards

Conversation

@aramase

Copy link
Copy Markdown
Collaborator

A REQUIRES_MEMORY_SNAPSHOT session's state lives in one actor's RAM, and nothing stopped the host from continuing the journal on a fresh or replaced actor. Split from #134, after #137.

  • No cold-create for a memory session that has started turns but no actor: Exec and Resume are FAILED_PRECONDITION (ErrMemoryStateLost).
  • Each memory turn records its actor UID in EXECUTION_START.compute_instance. Exec, Resume, Suspend and stateful Fork refuse another UID with the same error and journal, suspend or clone nothing.
  • Restore reports lost state when the actor is gone, or when a failed resume finds a replaced one. A replacement is told apart by the held snapshot when the resume reported the actor missing, otherwise by the UID the journal last recorded.
  • An actor another operation holds is ABORTED (ErrComputeBusy) where it used to be INTERNAL.
  • An ExecRequest.harness override involving a memory-tier harness is refused (ErrStatefulOverride), also on Resume, and before a missing approval request is repaired onto an interrupted override turn, so a refused turn gets no new record or fence.
  • A fork child's FORK marker records its clone's UID (Lifecycle.compute_instance, design):
    • A fork whose clone is replaced before its resume is ABORTED and records no child; a clone that reports no UID is torn down.
    • The child's first turn is compared against that UID. Old journals record none and are not compared.
    • The field is hashed when set and omitted when empty. v0.1.x refuse the journal at open; builds from main before this change fail Verify on such a child.

How it was tested:

  • go test -race -count=1 ./... in the root module and in integrations/substrate, run on Linux: both pass.
  • Per commit: gofmt, build, vet, go mod tidy, and buf generate / API reference drift checks pass on all 8 commits.

@gambtho Tom Gamble (gambtho) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Site build fails on the two TODO(spike) lines in docs/substrate-conformance.md.

Comment thread runtime/substrate/substrate.go Resolved
@aramase
Anish Ramasekar (aramase) force-pushed the aramase/f/substrate_actor_identity_guards branch from 8528e12 to 279b547 Compare October 16, 2026 17:33
@aramase
Anish Ramasekar (aramase) marked this pull request as ready for review October 16, 2026 21:46
@aramase
Anish Ramasekar (aramase) requested a review from a team as a code owner October 16, 2026 21:46
@aramase
Anish Ramasekar (aramase) force-pushed the aramase/f/substrate_actor_identity_guards branch from 279b547 to 6dc59c0 Compare October 16, 2026 23:17

@gambtho Tom Gamble (gambtho) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm. The recorded-UID check covers the stale-ref case, and the site build is green.

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