tui: add ephemeral /btw side-question threads#14506
tui: add ephemeral /btw side-question threads#14506charley-oai wants to merge 7 commits intomainfrom
Conversation
Bazel was failing the BTW app tests before they reached any BTW logic because the test helper tried to probe a real terminal on stdout. Add a test-only TUI constructor with synthetic terminal state and route the BTW app tests through it so they no longer depend on an interactive terminal. Co-authored-by: Codex <noreply@openai.com>
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1909889d0a
ℹ️ 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".
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6170eda3ce
ℹ️ 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".
|
@codex review this |
|
Codex Review: Didn't find any major issues. Delightful! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Bazel was failing the BTW app tests before they reached any BTW logic because the test helper tried to probe a real terminal on stdout. Add a test-only TUI constructor with synthetic terminal state and route the BTW app tests through it so they no longer depend on an interactive terminal. Co-authored-by: Codex <noreply@openai.com>
dff7305 to
869c5d2
Compare
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Lines 2456 to 2462 in 324aa33
handle_active_thread_event now returns AppRunControl and emits Exit(UserRequested) after the tracked ShutdownComplete, but the main select-loop ignores that return value and always continues. This prevents ExitMode::ShutdownFirst from actually exiting on shutdown completion in the real app loop.
ℹ️ 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".
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48b240cd92
ℹ️ 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".
Bazel was failing the BTW app tests before they reached any BTW logic because the test helper tried to probe a real terminal on stdout. Add a test-only TUI constructor with synthetic terminal state and route the BTW app tests through it so they no longer depend on an interactive terminal. Co-authored-by: Codex <noreply@openai.com>
ffac786 to
a466f20
Compare
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a466f20732
ℹ️ 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".
|
@codex review this |
|
Codex Review: Didn't find any major issues. Delightful! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Bazel was failing the BTW app tests before they reached any BTW logic because the test helper tried to probe a real terminal on stdout. Add a test-only TUI constructor with synthetic terminal state and route the BTW app tests through it so they no longer depend on an interactive terminal. Co-authored-by: Codex <noreply@openai.com>
89aa63f to
68f5479
Compare
|
@codex review this |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 31df052227
ℹ️ 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".
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4e56ca00a
ℹ️ 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".
Bazel was failing the BTW app tests before they reached any BTW logic because the test helper tried to probe a real terminal on stdout. Add a test-only TUI constructor with synthetic terminal state and route the BTW app tests through it so they no longer depend on an interactive terminal. Co-authored-by: Codex <noreply@openai.com>
b4e56ca to
5570788
Compare
Bazel was failing the BTW app tests before they reached any BTW logic because the test helper tried to probe a real terminal on stdout. Add a test-only TUI constructor with synthetic terminal state and route the BTW app tests through it so they no longer depend on an interactive terminal. Co-authored-by: Codex <noreply@openai.com>
2be24f1 to
8ec8f95
Compare
Implement /btw as an ephemeral forked side-thread flow in the TUI and the mirrored tui_app_server frontend. The branch adds BTW thread lifecycle and navigation handling, uses interrupted-snapshot forks when needed, keeps BTW threads hidden from normal agent navigation, routes BTW prompts to the model, and mirrors the footer/fork-banner UI plus replay-only fallback behavior in the app-server variant. Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Resolve the remaining API and test drift after restacking the /btw implementation onto current main. - align tui /btw with ForkSnapshot-based forking - adapt tui_app_server BTW attachment to the current session/turn cache model - make BTW fork banners deterministic even for unnamed parent threads - clean up the stale thread_manager test import from the cherry-pick Co-authored-by: Codex <noreply@openai.com>
a519259 to
5731998
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
codex/codex-rs/tui_app_server/src/app.rs
Lines 4928 to 4929 in 5731998
When a BTW child closes unexpectedly, failover switches with select_agent_thread(...) instead of select_agent_thread_and_discard_btw_chain(...). That bypasses BTW cleanup, leaving entries in btw_threads/thread_event_channels after switching away. Hidden ephemeral threads can retain stale per-thread state (e.g., pending approvals) until a full reset.
ℹ️ 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".
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a67c3f5c6
ℹ️ 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".
- add a live-thread fork path for pathless ephemeral threads - use it for direct TUI /btw and /fork - allow app-server thread/fork from ephemeral source threads Co-authored-by: Codex <noreply@openai.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
codex/codex-rs/tui_app_server/src/app.rs
Lines 1457 to 1464 in 86fe197
This shutdown path only unsubscribes the active thread. After nested /btw, /fork and /resume call this and then clear local thread maps, so hidden BTW ancestors are no longer tracked but remain subscribed/running on the app server. That violates the discard-on-switch behavior and can leak background thread activity.
ℹ️ 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".
| if matches!(source_status, AgentStatus::Running) { | ||
| append_interrupted_boundary(history, /*turn_id*/ None) |
There was a problem hiding this comment.
Recompute turn state before adding interrupted fork boundary
fork_thread_from_thread gates ForkSnapshot::Interrupted on a stale source_status read before live_fork_history(). If the source thread completes between those awaits, status can still be Running and this appends an Interrupted boundary to already-complete history, producing an incorrect aborted turn in the fork.
Useful? React with 👍 / 👎.
Co-authored-by: Codex <noreply@openai.com>
Summary
/btwslash command that forks the current thread into an isolated side-question childTesting
cargo test -p codex-tuijust fix -p codex-tuijust fmt