Skip to content

fix: rebind remote permission handlers after session swap#1124

Closed
wang-kaopu wants to merge 1 commit intoslopus:mainfrom
wang-kaopu:fix/claude-session-swap
Closed

fix: rebind remote permission handlers after session swap#1124
wang-kaopu wants to merge 1 commit intoslopus:mainfrom
wang-kaopu:fix/claude-session-swap

Conversation

@wang-kaopu
Copy link
Copy Markdown
Contributor

Closes #1123

Summary

This PR fixes a remote permission approval issue where tapping approve/deny
on iOS could stay stuck in a loading state after a session/client change.

The root cause was that Claude-side permission handling could remain bound
to an outdated session client after session swap, so permission responses no
longer matched the active pending request.

Changes

  • make Session.client updatable in the Claude remote flow
  • add Session.updateClient() to sync the active API session client
  • add PermissionHandler.updateSession() so the permission RPC handler
    can be rebound after session changes
  • rebind the Claude permission handler when the session changes
  • update Claude remote flow to use the current API session reference for
    session events/state updates
  • add a minimal unit test covering permission handler rebinding after
    session swap

Why this fixes the issue

Remote permission approvals depend on a session-scoped permission RPC
channel. After a session/client change, the old handler could still be
registered against the stale client, which meant iOS approval responses
would not resolve the active pending request.

By rebinding the permission handler and updating the active session client
reference, approval responses are routed back to the current session
correctly.

Validation

  • built packages/happy-wire
  • ran packages/happy-cli typecheck successfully
  • added and ran a minimal unit test:
    • src/claude/utils/permissionHandler.test.ts

Notes

In my local repro flow, this also resolved the similar approval-loading
symptom I was seeing with Codex, although this PR is focused on fixing the
Claude-side session swap gap directly.

@wang-kaopu wang-kaopu closed this Apr 22, 2026
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.

happy-cli: remote permission approvals get stuck loading in Claude/Codex

1 participant