Skip to content

fix: show mirrored approvals once the Session is visible - #27

Merged
Golden-Pigeon merged 1 commit into
mainfrom
fix/22-approval-queue
Nov 9, 2026
Merged

Golden-Pigeon merged 1 commit into
mainfrom
fix/22-approval-queue

Conversation

@Golden-Pigeon

Copy link
Copy Markdown
Owner

Fixes #22.

Original problem

An approval for a mirrored remote Session could be answered automatically with unavailable when the local mirror runtime was not ready: the approval stream starts before the first session sync, so the user never saw the prompt and the remote turn could appear stuck. The approval was also dispatched as soon as the runtime mounted, before a client could present it.

Change

  • Keep mirrored approvals queued until the mirror runtime exists and a connected client reports the local mirrored Session visible.
  • The client's existing session-claim poll now also reports the currently visible local Session; the host uses a short freshness window.
  • Dispatch queued approvals once through the ordinary native approval UI. Replayed approval ids are deduplicated.
  • Add fake-host approval support and a two-client Playwright test.

Fixed during this change

  • None.

Resolved

  • An approval arriving before the mirror is ready is no longer answered unavailable on the user's behalf.
  • An approval reaches the native approval UI only while a client is actually showing the mirrored Session.
  • Two clients see one pending approval; when one answers, the other dismisses through the native approval cancel path, and the remote agent receives exactly one answer.

Unresolved

  • The visibility signal reports the client's current Session; a mirrored Session open only in a background view is treated as not visible, and the approval waits until it is shown.
  • No full SSH / real remote DSH E2E was run for this path; the end-to-end test uses an isolated DSH host with a fake remote agent.

Testing

  • pnpm --filter dsh-remote-local-plugin test (129/129)
  • pnpm --filter dsh-remote-local-plugin typecheck
  • pnpm --filter @dsh-remote/testkit typecheck
  • Full Playwright suite: 13/13, including the new two-client approval test: the approval arrives before any client shows the mirror; both clients see it; one answers; the other dismisses; the remote agent receives one allowed-once.

Keep a mirrored approval queued until the mirror runtime exists and a client reports the Session visible, then hand it to the ordinary approval UI. This preserves native waiting semantics instead of answering unavailable when no local prompt is available. Deduplicate replayed approval ids so two clients see one pending event. Add fake-host approval support and a two-client Playwright test that verifies one answer dismisses the other client and the remote agent receives exactly one answer.

Refs #22
@Golden-Pigeon
Golden-Pigeon merged commit c197e02 into main Nov 9, 2026
2 checks passed
@Golden-Pigeon
Golden-Pigeon deleted the fix/22-approval-queue branch November 9, 2026 14:16
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.

Approval for an unopened mirrored Session answers unavailable and leaves the remote turn hanging

1 participant