fix(core): report tasks running in another Nx process in the inline TUI - #36341
Conversation
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit 7410e6e
☁️ Nx Cloud last updated this comment at |
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
When a task was being run by a different Nx process, the inline TUI sat on "Waiting for tasks to start..." forever - it never had a pty to stream and never explained why. The full-screen terminal pane already surfaced this as "Running in another Nx process...". - Add TuiState::is_running_in_another_process (Shared/Stopped status with no local pty) so both TUIs agree on the condition. - Block entering inline mode for such a task and show a hint instead of dropping into a view that can never render output. - Make the inline no-pty fallback status-aware so a task that transitions to running-elsewhere while already displayed flips to the correct message.
1d74225 to
618ab86
Compare
|
Rebased onto latest master. The Addressed the two non-blocking notes:
Also captured the finished-shared-task rendering as a known-limitation note in the description for the follow-up. One clippy nit surfaced by the rebase ( |
…UI [Self-Healing CI Rerun]
There was a problem hiding this comment.
Nx Cloud has identified a flaky task in your failed CI:
🔂 Since the failure was identified as flaky, we triggered a CI rerun by adding an empty commit to this branch.
🎓 Learn more about Self-Healing CI on nx.dev
…UI (#36341) When a task is being run by a *different* Nx process, this process never gets a pty for it — there is no output to stream and nothing to interact with. The full-screen terminal pane already handles this: it renders `Running in another Nx process...` for a task whose status is `Shared`/`Stopped` with no pty. The inline TUI does not. It falls back to `Waiting for tasks to start...` for *any* missing pty, without asking why the pty is missing, so: - A task running in another Nx process shows `Waiting for tasks to start...` indefinitely — output that will never arrive. - The user can still enter inline mode for such a task (F11, Enter on a focused pane, double-click a pane, Enter/F11 from the run report), landing in a view that can never render anything. - A task already displayed inline that transitions from pending (dependency view) to running-elsewhere keeps showing the same misleading message. The two views agree, and inline mode is never a dead end: - **Entering inline mode is blocked** for a task another Nx process is running. A hint (`This task is running in another Nx process`) is shown instead of switching, so the user stays in full-screen where the pane explains what is happening. All four entry points route through a single `App::request_inline_mode`. - **The inline no-pty fallback is status-aware.** A task that is (or becomes) running-elsewhere renders `Running in another Nx process...`, covering the case where the user was *already* in the inline TUI when the task transitioned. An in-progress task with no pty renders `Waiting for task results...`, matching the full-screen pane's wording. - A new `TuiState::is_running_in_another_process` (status is `Shared`/`Stopped` **and** no local pty) gives the inline app a single named definition of "running elsewhere" that matches what the full-screen pane checks. The pane still reads its own `TerminalPaneState` copies rather than calling the helper (it works off flattened props, not `TuiState`), so the two agree today but are not yet structurally coupled — unifying the pane on the helper is a reasonable follow-up. Note: the guard applies to a task selected in the task list as well as one pinned to a focused pane — inline always renders exactly one item, and that item would have nothing to show. Known limitation (inherited, follow-up): because `Shared` and `Stopped` are lumped together, a *shared* continuous task that has finished (goes `Stopped`, never had a local pty) keeps rendering `Running in another Nx process...`. The full-screen pane already behaves this way, so this change inherits rather than introduces it. - `test_inline_mode_blocked_for_task_running_in_another_process` — a shared task shows a hint and does not switch. - `test_inline_mode_allowed_for_local_task` — a locally running task still drops into inline. - `test_inline_reports_task_running_in_another_process` — renders the inline view across the `NotStarted → Shared → Stopped` transition. All 320 TUI tests pass; `cargo fmt --check` and `cargo clippy` are clean. End-to-end validation against a real second Nx process holding a shared task has not been done — behavior is covered by unit tests. Relates to [NXC-4597](https://linear.app/nxdev/issue/NXC-4597/error-insert-before-failed-when-swapping-to-inline-mode) <!-- polygraph-session-start --> --- [View session information ↗](https://app.trypolygraph.com/orgs/6a061dcb561c062131116eca/sessions/Fix-inline-TUI-Waiting-for-tasks-state-for-multi-process-scenarios-7a1fd4ea) <!-- polygraph-session-end --> --------- Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com> (cherry picked from commit 7480b69)
Current Behavior
When a task is being run by a different Nx process, this process never gets a pty for it — there is no output to stream and nothing to interact with.
The full-screen terminal pane already handles this: it renders
Running in another Nx process...for a task whose status isShared/Stoppedwith no pty.The inline TUI does not. It falls back to
Waiting for tasks to start...for any missing pty, without asking why the pty is missing, so:Waiting for tasks to start...indefinitely — output that will never arrive.Expected Behavior
The two views agree, and inline mode is never a dead end:
This task is running in another Nx process) is shown instead of switching, so the user stays in full-screen where the pane explains what is happening. All four entry points route through a singleApp::request_inline_mode.Running in another Nx process..., covering the case where the user was already in the inline TUI when the task transitioned. An in-progress task with no pty rendersWaiting for task results..., matching the full-screen pane's wording.TuiState::is_running_in_another_process(status isShared/Stoppedand no local pty) gives the inline app a single named definition of "running elsewhere" that matches what the full-screen pane checks. The pane still reads its ownTerminalPaneStatecopies rather than calling the helper (it works off flattened props, notTuiState), so the two agree today but are not yet structurally coupled — unifying the pane on the helper is a reasonable follow-up.Note: the guard applies to a task selected in the task list as well as one pinned to a focused pane — inline always renders exactly one item, and that item would have nothing to show.
Known limitation (inherited, follow-up): because
SharedandStoppedare lumped together, a shared continuous task that has finished (goesStopped, never had a local pty) keeps renderingRunning in another Nx process.... The full-screen pane already behaves this way, so this change inherits rather than introduces it.Tests
test_inline_mode_blocked_for_task_running_in_another_process— a shared task shows a hint and does not switch.test_inline_mode_allowed_for_local_task— a locally running task still drops into inline.test_inline_reports_task_running_in_another_process— renders the inline view across theNotStarted → Shared → Stoppedtransition.All 320 TUI tests pass;
cargo fmt --checkandcargo clippyare clean. End-to-end validation against a real second Nx process holding a shared task has not been done — behavior is covered by unit tests.Related Issue(s)
Relates to NXC-4597
View session information ↗