Skip to content

bug(sessions): retire replacement when its source placement disappears #815

Closed

Description

@Juliusolsson05

A read-only orchestration review of #812 reproduced a pre-existing replacement ownership race: close a source pane while replaceSession awaits provider spawn. The successor is inserted into session metadata and returned, but no grid/detached placement remains to remap. The new external lifecycle receipt can consequently report completed for an invisible orphan backend.

Expected: replacement revalidates the source's current durable placement and identity after asynchronous spawn/retirement. If it can no longer commit, retire the successor through the existing owned-backend cleanup and report failure/uncertainty, preserving the user's close/bury/layout action.

Reproduction evidence: production-hook in-memory deferred-spawn/concurrent-close probe from orchestration reviewer 8f6e2b0a-a700-44c6-804f-e76f4d13c038 at 961d542e. Add a deterministic real-hook regression. This is separate from #807's current-draft transfer bug and A5/A6's independently owned fixes.

Refs #795, #812.

Activity

  1. Juliusolsson05 commented on Sep 5, 2026

    @Juliusolsson05
    OwnerAuthor

    Two independent Agent Code orchestration reviews completed for the full feature at 961d542eee331f773d2b8b58878a9ef16eb08930, base 5d641845:

    • Reviewer 96b42118-6a39-4e98-8faf-1b4501bcde0f: no actionable findings; 6 unit files/14 tests and 9 renderer files/23 tests passed. Noted an extra EOF blank line, now removed.
    • Reviewer 8f6e2b0a-a700-44c6-804f-e76f4d13c038: two P2 findings, both reproduced with production-handler probes: (1) source closes during spawn and replacement reports completed with no placement; (2) workspace navigation reports requested target even if focus moves during frame acknowledgment.

    Both findings are resolved in 2b0058d7. #815 tracks the pre-existing ownership race. The fix checks the synchronous live store before retirement and at remap commit, cleans an uncommittable successor through the owned-backend boundary, and transfers the draft only after placement succeeds. Navigation now checks canonical effective focus. Three deterministic regressions fail against the reviewed revision and pass corrected; existing draft continuity remains green. Full types, test contract and renderer121files514tests pass.

    Both original reviewers are rechecking this final revision. CI must pass on it before the user-authorized merge; no merge has occurred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions