Skip to content

fix(harness): fence and join Assistant runtime retirement [SAP-3292] - #994

Closed
ynadge wants to merge 1 commit into
assistant-native-startup-cancellationfrom
assistant-runtime-retirement
Closed

ynadge wants to merge 1 commit into
assistant-native-startup-cancellationfrom
assistant-runtime-retirement

Conversation

@ynadge

@ynadge ynadge commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Primary change type

  • Bug fix

Problem and motivation

Ending one Assistant runtime could hold startup for every Studio session. A repeated retirement could also resolve before the first cleanup completed, and a late workspace lookup could publish a new runtime after End.

Summary and scope

Join retirement by Studio ID, fence pending authorization/startup, and expose exact-instance cleanup plus bounded, truthful cleanup results. Failed cleanup retains ownership and blocks replacement of that session. Other sessions remain independent. Add a synchronous whole-host admission fence for the lifecycle coordinator.

Related work

Related issue: https://linear.app/sapiom/issue/SAP-3292

Native stack target: main. Depends on the preceding branch, preserving Epic 2 dependency ancestry through #987. Depends on #993. This increment supplies host retirement primitives; the companion Terminal change and lifecycle controls follow.

Validation

pnpm --filter @sapiom/harness exec vitest run src/core/opencode-host.test.ts — 45 passed
pnpm --filter @sapiom/harness typecheck — passed (server and web)
pnpm exec eslint packages/harness/src/core/opencode-host.ts — passed

pr:size is absent in sapiom-js; incremental git diff --numstat measures 264 changed lines, including tests.

Tests and documentation

Behavior tests cover the new contract and failure paths; inline documentation describes limits and provenance.

Compatibility and release impact

  • Breaking or externally visible changes: Assistant retirement no longer delays unrelated session startup. Failed cleanup remains fenced.
  • Changeset: added for @sapiom/harness.
  • Fix-forward: correct startup/cleanup in a follow-up while retaining process guards and proof; never delete guards to bypass uncertain cleanup.

Security

  • No secrets, credentials, private data, or unsanitized logs included.
  • No suspected vulnerability disclosed publicly.

AI assistance

  • AI assistance used: Codex implemented the modules/tests; a separate agent reviewed their integration contracts and the root agent reran validation and reviewed the incremental diff.

Checklist

  • CONTRIBUTING.md read; maintainer-authorized issue work.
  • One focused increment, tests, relevant checks, documentation, and release impact addressed above.
  • I can explain and maintain the submitted changes.

Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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