Skip to content

Avoid blocking TUI on agent metadata hydration#21870

Open
etraut-openai wants to merge 1 commit intomainfrom
etraut/fix-tui-agent-fanout-freeze
Open

Avoid blocking TUI on agent metadata hydration#21870
etraut-openai wants to merge 1 commit intomainfrom
etraut/fix-tui-agent-fanout-freeze

Conversation

@etraut-openai
Copy link
Copy Markdown
Collaborator

Why

Fixes #16688.

The TUI currently hydrates collab receiver metadata by awaiting thread/read before each active-thread notification is rendered. During large subagent fan-outs, the embedded app-server can be busy starting agents and processing spawn work, so those synchronous metadata reads queue behind the fan-out and block the TUI event loop. That makes the UI appear frozen even though the underlying agent work can continue.

What Changed

  • Replaced eager thread/read metadata hydration on the active notification path with local receiver-thread caching.
  • Kept ThreadStarted and picker refreshes as the places that fill in agent nickname/role metadata when it is available.
  • Skipped caching receiver threads that are explicitly reported as NotFound, avoiding live-looking ghost entries for failed stale-agent calls.
  • Added TUI tests covering both local receiver caching and NotFound suppression.

Verification

  • cargo test -p codex-tui collab_receiver_notification
  • just fix -p codex-tui

I also ran the full cargo test -p codex-tui; the new test passed, but the full process later aborted with an unrelated stack overflow in tests::fork_last_filters_latest_session_by_cwd_unless_show_all.

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.

TUI freeze during agent fan-out

1 participant