Skip to content

fix(app): dispose server roots when the app unmounts - #33

Merged
stroopc-owner merged 1 commit into
charon-execute-expandfrom
dispose-server-roots
Oct 8, 2026
Merged

stroopc-owner merged 1 commit into
charon-execute-expandfrom
dispose-server-roots

Conversation

@brxck

@brxck brxck commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

GlobalProvider creates one detached createRoot per server and only disposed it when the server left the list. Unmounting the app left every root alive, so each server's event stream stayed open and kept reconnecting.

Forge remounts the embedded app on every task switch. Each switch leaked one /api/event stream. Once the leaked streams fill the browser's per-origin limit (6 over HTTP/1.1, 100 streams on Forge's HTTP/2 origin), new requests queue indefinitely. The agent, provider, and model syncs never complete, the composer hides the model picker, and sending shows "Select an agent and model".

GlobalProvider now disposes every server root on cleanup.

Verification

Mounted the embedded app against two local OpenCode servers and switched between them repeatedly.

  • Before: open /api/event streams grew by one per switch. The pane stopped loading after 4 switches over HTTP/1.1, and after 10 behind an HTTP/2 proxy limited to 12 streams.
  • After: one open stream at any time; 15 switches behind the same HTTP/2 proxy all load with the model picker, and a prompt sends.

@brxck brxck added the coder-task-generated PR generated by an automated Coder/Forge task label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above before requesting review.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

The following comment was made by an LLM, it may be inaccurate:

@stroopc-owner
stroopc-owner marked this pull request as ready for review October 8, 2026 20:16
@stroopc-owner
stroopc-owner self-requested a review October 8, 2026 20:17
@stroopc-owner
stroopc-owner merged commit 0952411 into charon-execute-expand Oct 8, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coder-task-generated PR generated by an automated Coder/Forge task needs:compliance needs:issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants