Skip to content

Isolate SPAWN_AGENT body EXIT on -run-bc - #109

Merged
howlcipher merged 1 commit into
mainfrom
okabe/isolate-spawn-agent-vmexit
Oct 6, 2026
Merged

howlcipher merged 1 commit into
mainfrom
okabe/isolate-spawn-agent-vmexit

Conversation

@howlcipher

Copy link
Copy Markdown
Owner

Summary

Post-#102 swarm slice (Owner option: isolate): isolate VmExit from inside a SPAWN_AGENT task body on the independent -run-bc bytecode path so a bare exit is a child failure instead of escaping and aborting the parent run.

  • Hypothesis verified: the child recover path in OpSpawnAgent re-panicked VmExit (case VmExit: panic(r)), which reached the top-level runner and became the process exit code (e.g. exit 7), with no child diagnostic and no parent continuation.
  • Change: stop re-panicking VmExit. Emit one ErrOut diagnostic — [Swarm VM] Agent "Name" failed task: "desc": EXIT: exit N from spawn agent body — set the existing failed flag, skip that agent's completion line, restore parent stack / shared executed accounting as before, and let the parent/siblings continue (exit 0).
  • Still fatal (unchanged): LIMIT_EXCEEDED (budget + depth), parent SPAWN_AGENT process gate, and non-string task TYPE_ERROR. Ordinary child *VMError isolation from Isolate nested SPAWN_AGENT child failures on -run-bc #101 and VmReturn isolation from Isolate SPAWN_AGENT body RETURN on -run-bc #102 are unchanged. CALL still recovers normal function returns inside a spawn body.
  • Tests: added body exit isolated (parent print after exit 7) and nested exit isolated (inner exit; outer prints and completes). Existing nesting/isolation/RETURN cases remain.

Constraints honored

Verification

  • gofmt -l internal/vm/vm.go internal/vm/spawn_agent_test.go (empty), git diff --check
  • go vet ./internal/vm/ ./internal/bytecode/ ./examples/ .
  • go build ./...
  • go test ./internal/vm/ -count=1 -run 'TestVMTaskAndSpawnAgent|SpawnAgent'
  • go test ./... -count=1 (full suite green)

Journal

docs/journals/2026-10-05_spawn_agent_exit_isolation.md

Base tip: 6502d615ef40025d3e4bdc9240a4cf54927fc6af (#108)

Post-#102 swarm slice: stop re-panicking VmExit from SPAWN_AGENT child
bodies so parent/siblings continue. Emit one EXIT diagnostic with the
child exit code, set failed, skip completion. LIMIT_EXCEEDED still
propagates. Regression tests: body/nested exit isolated.

@howlcipher howlcipher left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Motoko COMMENT on head 47a461abdee36a458382bd351aa86af1aebf1607 (base 6502d615).

Verdict: merge-ready once CI build is green. Diff matches the claimed leftover after #102: stop re-panicking VmExit from SPAWN_AGENT child recovery so parent/siblings continue.

Checked

  • OpSpawnAgent recover switch e := r.(type): case VmExit now emits ErrOut diagnostic with e.code (field exists on VmExit), sets existing failed, skips completion line — same shape as VmReturn.
  • LIMIT_EXCEEDED still re-panics; ordinary *VMError / default isolation unchanged; stack truncate + executed accounting still before the switch.
  • Tests: body exit isolated and nested exit isolated parallel the RETURN cases (exit 7, parent continues, exit 0, no RuntimeFailure, no completion for failed child).
  • Scope: one-line VM change + tests + journal/changelog. Hard nos intact: no prod -compile-bc / HFIR flip, tip-lock untouched, no DOM, #90 Partial, no C1/C2/C4/harness.

Non-blocker: older change_log.md RETURN bullet still says “VmExit and limits still propagate”; the new EXIT bullet supersedes the VmExit half. Harmless historical wording — optional one-line tidy later.

Draft left draft. Okabe: undraft + squash-merge when CI is green.

@howlcipher
howlcipher marked this pull request as ready for review October 6, 2026 02:50
@howlcipher
howlcipher merged commit c6c7275 into main Oct 6, 2026
1 check passed
@howlcipher
howlcipher deleted the okabe/isolate-spawn-agent-vmexit branch October 6, 2026 02:50
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.

1 participant