fix(tui): isolate scheduled top-level threads from the agent picker#185
Closed
andrei-hasna wants to merge 1 commit into
Closed
fix(tui): isolate scheduled top-level threads from the agent picker#185andrei-hasna wants to merge 1 commit into
andrei-hasna wants to merge 1 commit into
Conversation
Global scheduled prompts resume their owning top-level thread, and the app server broadcasts that thread's ThreadStarted to every connected client. Unrelated TUI sessions unconditionally upserted any inactive ThreadStarted into the agent picker, so a scheduled thread leaked in as a subagent. Gate the realtime picker upsert in infer_session_for_thread_notification on verified subagent lineage: register only the primary thread or a genuine ThreadSpawn subagent whose parent chains to the primary (directly or via an already-registered navigation entry), reusing thread_spawn_parent_thread_id so the realtime and resume-time (find_loaded_subagent_threads_for_primary) paths agree. Thread channel/session buffering is unchanged, so schedule runtime and the owning session keep working; schedule-manager UI is untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
Closing as superseded after live PR0 wave2 recheck. This scheduled-thread / agent-picker leak fix is covered by newer PR #199, which is narrower and current. This PR is also unstable with red required checks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Global scheduled prompts resume their owning top-level thread, and the app server broadcasts that thread's
ThreadStartedto every connected client. Unrelated TUI sessions unconditionally upserted any inactiveThreadStartedinto the agent picker, so a scheduled thread leaked in as a subagent in sessions that don't own it.This keeps scheduled task runtime behavior intact and isolates it from the agent UI: it gates the realtime picker upsert in
infer_session_for_thread_notificationon verified subagent lineage.Changes
tui/src/app/thread_routing.rs: newthread_started_belongs_to_agent_pickerguard — register only the primary thread, or a genuineThreadSpawnsubagent whose parent chains to the primary (directly or via an already-registered navigation entry). Thread channel/session buffering is unchanged, so schedule runtime and the owning session keep working.tui/src/app/loaded_threads.rs: exposethread_spawn_parent_thread_id(pub(crate)) so the realtime guard and the resume-time walk (find_loaded_subagent_threads_for_primary) agree on what counts as subagent lineage.tui/src/app.rs: import the shared helper.tui/src/app/tests.rs: regression testscheduled_top_level_thread_started_is_isolated_from_agent_picker(scheduled top-level thread → buffered channel but no picker entry; genuine + deep subagents → registered); updated one existing realtime test to use genuine subagent lineage.Schedule-manager UI (
loop_display.rs/chatwidget/protocol.rs) and theThreadScheduleUpdated/ThreadScheduleRunUpdatedhandling are untouched.Validation
cargo test -p codex-tui --lib(new test passes; the only failures are pre-existing, environment-dependentchatwidgetsnapshot tests that also fail on the clean base)cargo clippy -p codex-tui --all-targets -- -D warnings— cleancargo fmt— clean🤖 Generated with Claude Code