Skip to content

fix(app): recover child session permissions after reconnect - #65120

Merged
neriousy merged 2 commits into
devfrom
child-permission-sync
Nov 20, 2026
Merged

neriousy merged 2 commits into
devfrom
child-permission-sync

Conversation

@neriousy

Copy link
Copy Markdown
Member

Issue for this PR

Fixes #65086

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

createSessionRequestModel only synced pending permissions for the currently open session (params.id), while forms already synced every running session in the session tree. Since permission.asked / permission.replied are ephemeral events and the server's per-session permission endpoint matches exact session IDs, a child/subagent's pending permission was never fetched after a page reload or SSE reconnect—even though sessionPermissionRequest walks the whole tree.

Changes (building on @pavlovma007's report and fix idea):

  • packages/app/src/session/requests/model.ts: Rename formSessions to requestSessions and sync both permissions and forms for the open session, running sessions in its tree, and any tree sessions that currently hold cached permissions or forms (so reconnects also clear requests resolved while offline without polling idle subagents).
  • packages/app/src/shell/titlebar/tab-strip.tsx & packages/app/src/shell/titlebar/inbox-model.ts: Apply the same family-scoped sync for inactive session tabs and inbox settle checks instead of syncing only the root session ID.
  • packages/app/e2e/regression/session-request-docks.spec.ts: Add a regression test covering initial load recovery, stale permission clearing when a child finishes while offline, reconnect recovery without permission.asked, replying to the child session, and verifying idle subagents are not polled.

How did you verify your code works?

  • Verified the new Playwright regression test fails before the model.ts fix (dock-prompt[data-kind="permission"] not found).
  • Ran e2e/regression/session-request-docks.spec.ts in built mode (12/12 passed, including PLAYWRIGHT_FULLY_PARALLEL=1 --workers=5 --retries=0 and --repeat-each=10 --workers=5 --retries=0 on the new test).
  • Ran bun run test in packages/app (2842 unit + 378 browser tests passed).
  • Ran bun run lint:changed, bun run typecheck:tsc in packages/app, and bun run check from repo root.

Screenshots / recordings

N/A (no visual styling change).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix works. With the PR's new e2e test run against the base branch, the child session's pending permission never shows up after load: no permission dock, and the test fails at its first check. With this PR the dock appears, and all of session-request-docks.spec.ts passes (12/12). typecheck:tsc in packages/app passes too.

The tab-strip and inbox changes follow the same rule: fetch requests for the open session, running sessions in the tree, and sessions that still have cached requests. Idle subagents stay unfetched, and the test checks that.

Public API is unchanged; this only touches app-internal client code.

No blocking concerns.

Before

After

@neriousy
neriousy force-pushed the child-permission-sync branch from d2ec051 to 08ad347 Compare November 20, 2026 09:43

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commit only moves the "running, or still has cached requests" check into one shared sessionMayHoldRequests helper used by the model, tab-strip and inbox. Which sessions get fetched is unchanged, and the test edit is a small cleanup. On the new head, typecheck:tsc passes and session-request-docks.spec.ts passes 12/12.

Public API is unchanged. No new concerns.

@neriousy
neriousy merged commit f0df607 into dev Nov 20, 2026
10 checks passed
@neriousy
neriousy deleted the child-permission-sync branch November 20, 2026 09:55
huuhabn pushed a commit to huuhabn/opencode that referenced this pull request Nov 20, 2026
@amrkmn amrkmn mentioned this pull request Nov 23, 2026
1 task
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.

[bug] (+patch from me with solution) Web client drops subagent permission requests after reconnect

1 participant