Skip to content

fix(android): keep a task's terminal streaming while another screen shows it - #311

Merged
johannesjo merged 1 commit into
mainfrom
ccr-b3399b1c-df93um
Oct 11, 2026
Merged

johannesjo merged 1 commit into
mainfrom
ccr-b3399b1c-df93um

Conversation

@johannesjo

Copy link
Copy Markdown
Owner

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

…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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T19:55:01.942723Z 3a160da PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@johannesjo
johannesjo merged commit 66a8857 into main Oct 11, 2026
3 checks passed
@johannesjo
johannesjo deleted the ccr-b3399b1c-df93um branch October 11, 2026 19:54

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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.

2 participants