Skip to content

feat(daemon): recover owned detached sessions - #43

Merged
rynfar merged 3 commits into
pylonfrom
feat/recoverable-owned-session-adoption
Sep 1, 2026
Merged

feat(daemon): recover owned detached sessions#43
rynfar merged 3 commits into
pylonfrom
feat/recoverable-owned-session-adoption

Conversation

@rynfar

@rynfar rynfar commented Sep 1, 2026

Copy link
Copy Markdown

Problem

A client-owned Prime session could not be safely recovered after its owning client detached or the daemon supervisor restarted. The SDK had no authority-preserving way to recover the exact worker, replay its retained state, rotate ownership, and prove cleanup.

Implementation

  • Add capability-gated create, prepare, commit, and confirm adoption commands. Bind every phase to the exact supervisor and ownership generation.
  • Recover the exact detached worker from durable authority state. Attach and validate an authoritative snapshot, then deliver retained frames before live events.
  • Preserve the caller-owned launch environment and recovery config through supervisor and worker replacement. Keep shared-client reservations scoped to the exact session and recovery request.
  • Bound MCP ownership-transfer receipts and recovery retention. Remove the former pre-registration cleanup timer and contain post-launch store failures to the exact new worker.
  • Keep the public failure text exactly Recoverable owned session adoption is unavailable. Do not expose recovery handles, environment values, paths, tokens, process identities, sockets, or hashes on public surfaces.
  • Revalidate the exact {pid, processStartId} immediately before termination signals. Sanitize daemon worker bootstrap variables before runtime startup.
  • Keep native Windows supervisor hello behavior while omitting and refusing the POSIX adoption capability.
  • Export the frozen SDK feature, schemas, helpers, and public types. Document the SDK and daemon contracts.

Verification

  • npm run check — passed; 964 files checked, no fixes or warnings.
  • npm run build — passed for TUI, AI, agent core, and coding agent.
  • Focused non-process adoption suite — 10 files passed, 329 tests passed.
  • daemon-supervisor-process.test.ts with an isolated HOME and cleared PRIME_AGENT_INTERNAL_*, RLM_*, PRIME_AGENT_CODING_AGENT_DIR, FORCE_COLOR, and live-worker variables — 20 passed, 9 platform skips.
  • git diff --check — passed.

Model: openai-codex/gpt-5.6-sol
Harness: Prime Agent RLM subagent


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@rynfar
rynfar marked this pull request as ready for review September 1, 2026 17:26
@rynfar
rynfar force-pushed the feat/recoverable-owned-session-adoption branch from 3cdc268 to a3dd5ce Compare September 1, 2026 18:22
@rynfar
rynfar force-pushed the feat/recoverable-owned-session-adoption branch from a3dd5ce to b6ca021 Compare September 1, 2026 18:46
@rynfar
rynfar merged commit 8583567 into pylon Sep 1, 2026
20 checks passed
@rynfar
rynfar deleted the feat/recoverable-owned-session-adoption branch September 1, 2026 23:43
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