Skip to content

feat: close Muse ACP sessions cleanly - #4

Draft
obviyus wants to merge 3 commits into
bex-co:mainfrom
obviyus:codex/muse-session-close
Draft

feat: close Muse ACP sessions cleanly#4
obviyus wants to merge 3 commits into
bex-co:mainfrom
obviyus:codex/muse-session-close

Conversation

@obviyus

@obviyus obviyus commented Sep 1, 2026

Copy link
Copy Markdown

Problem

The adapter does not advertise or implement ACP session/close. ACPX and other clients cannot ask it to cancel active work and release adapter session resources through the protocol.

Fix

  • Advertise sessionCapabilities.close and register session/close.
  • Reserve each turn with a completion promise from prompt compilation through final cleanup.
  • Revoke new prompt admission synchronously when close starts.
  • Cancel the active Muse process, wait for prompt cleanup, then acknowledge close.
  • Preserve Muse's native session log so session/list and session/load recovery continue to work.
  • Keep unknown and already-closed session errors explicit.

Lifecycle proof

  • Idle close releases the adapter session and later prompts fail visibly.
  • Mid-turn close reaps the Muse child and removes staged images before returning.
  • Close during image staging prevents Muse from spawning.
  • A prompt cannot enter while close waits.
  • A concurrent second close receives the consistent unknown-session error.
  • Close still returns when the active prompt rejects during unwind.
  • A real Muse echo session remains in the native log and session/list after close.

Verification

  • npm run check
  • npm run build
  • npm run test:run — 116 passed, 2 live-provider tests skipped
  • Focused session-close tests — 6 passed
  • P1 autoreview — clean
  • Fable lifecycle design and implementation reviews — clean

Dependencies

This draft is stacked on #2 and #3. Merge those first; GitHub will then reduce this PR to the close lifecycle change.

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