Repository navigation
fix(android): keep a task's terminal streaming while another screen shows it - #311
Conversation
…hows it Two screens can show one agent's terminal at once: reopening a task while its previous screen still animates out, or the task pager replacing the lone-task view when the task list changes. The new screen reused the buffer, then the old one's dispose released it, removing the buffer and unsubscribing. The open screen was left drawing a buffer nothing fed, so the terminal showed only its empty background. Count terminal watchers, as chat watchers already are, and stop streaming only when the last screen lets go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012boc2XLLaQiSeNwAqk8YYs
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a160dad71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| * and the screen leaving last must not drop the buffer the other one is drawing. | ||
| */ | ||
| fun getTerminalBuffer(agentId: String): TerminalBuffer { | ||
| terminalWatchers[agentId] = (terminalWatchers[agentId] ?: 0) + 1 |
There was a problem hiding this comment.
Register watcher ownership only after composition commits
When Compose abandons or retries a composition after the remember initializer calls this method but before its DisposableEffect is committed, this increment has no matching releaseTerminal. A subsequent committed composition increments again, so disposing its screen only decrements the count to one and permanently retains the buffer and WebSocket subscription. Register the watcher from a committed effect, or return an idempotent lease whose cleanup is tied to that effect.
Useful? React with 👍 / 👎.
Two screens can show one agent's terminal at once: reopening a task while
its previous screen still animates out, or the task pager replacing the
lone-task view when the task list changes. The new screen reused the
buffer, then the old one's dispose released it, removing the buffer and
unsubscribing. The open screen was left drawing a buffer nothing fed, so
the terminal showed only its empty background.
Count terminal watchers, as chat watchers already are, and stop
streaming only when the last screen lets go.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_012boc2XLLaQiSeNwAqk8YYs