fix(next): a stand-in pane close never leaves its intent behind
Fix-forward for #34448 (follow-up 1 of #34367's review, receipt: https://github.com/manaflow-ai/cmux/pull/34367#issuecomment-6619422023). Also fixes item 2 of #34449.
Leo's words that started #34367, about "This pane is still opening; try again in a moment.": "this is extremely bad. i should be able to just close immedeiately."
What was wrong. closePane registered the stand-in pane's close intent (intendStandInPaneClose) before ctx.send. If the daemon had no connection, the send body never ran, nothing settled or rejected the intent, and the pane (and the daemon pane that later adopts it) stayed hidden for good. The handler also sent on the context's daemon rather than the pane's own.
Fix. DaemonService.closePane(_:finished:) (in DaemonService+CancelledCreation.swift) owns the whole close. It registers the intent only when a connection exists, and rejects it if close-pane fails. The handler calls it on ctx.services.daemon(for: pane), so the close goes to the pane's own daemon. Settling is unchanged from #34367: noteSettled at the reply's sequence, or at the next snapshot, and PendingPaneNotCreated rejects the intent.
Test. StandInPaneCloseTests.aStandInPaneCloseOnANotConnectedDaemonLeavesNoIntentBehind closes a stand-in pane on a not-connected daemon. It asserts that only the dock intent is left, the pane is still shown, finished was not called, and the mirror has no violations. On base, the close intent stays behind and this test fails.
Risk: small. It is confined to the stand-in pane close path that #34367 added.
Agent session: agent session
š¤ Generated with Claude Code