Skip to content

fix(core): report tasks running in another Nx process in the inline TUI - #36341

Merged
FrozenPandaz merged 2 commits into
masterfrom
fix/nxc-4597-inline-tui-running-in-another-process
Jul 17, 2026
Merged

fix(core): report tasks running in another Nx process in the inline TUI#36341
FrozenPandaz merged 2 commits into
masterfrom
fix/nxc-4597-inline-tui-running-in-another-process

Conversation

@AgentEnder

@AgentEnder AgentEnder commented Jul 14, 2026

Copy link
Copy Markdown
Member

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 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.

Expected Behavior

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.

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 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.

Related Issue(s)

Relates to NXC-4597


View session information ↗

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 7410e6e
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/6a5a672c0752da0008adf72d
😎 Deploy Preview https://deploy-preview-36341--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud

nx-cloud Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 7410e6e

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 47m 51s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 1m 2s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 18s View ↗
nx-cloud record -- nx format:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-17 18:24:59 UTC

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 7410e6e
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/6a5a672c1974f400089c87a9
😎 Deploy Preview https://deploy-preview-36341--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

nx-cloud[bot]

This comment was marked as outdated.

@AgentEnder
AgentEnder marked this pull request as ready for review July 16, 2026 01:59
@AgentEnder
AgentEnder requested a review from a team as a code owner July 16, 2026 01:59
@AgentEnder
AgentEnder requested a review from JamesHenry July 16, 2026 01:59
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.
@AgentEnder
AgentEnder force-pushed the fix/nxc-4597-inline-tui-running-in-another-process branch from 1d74225 to 618ab86 Compare July 17, 2026 14:54
@AgentEnder

Copy link
Copy Markdown
Member Author

Rebased onto latest master. The build_status_bar_props conflict from #36263 was purely textual (both PRs appended a method right after dispatch_action); kept both. The full status_bar suite plus the three new tests pass on the rebased tree.

Addressed the two non-blocking notes:

  • Rustdoc on is_running_in_another_process — reworded to your suggestion. It now describes the predicate (Shared/Stopped with no local pty) and calls out that the pty check is the load-bearing conjunct separating a task stopped elsewhere from one stopped locally, which does have a pty. You're right that Stopped is terminal and set locally on the fulfilled path in task-orchestrator.ts — the old present-tense 'is being run by' wording didn't fit it.
  • 'cannot drift apart' — softened in the description. The pane reads its own TerminalPaneState (flattened props, not TuiState), so it can't call the helper without a larger refactor; the description now says the two agree today but aren't structurally coupled, and flags unifying the pane as a follow-up.

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 (collapsible_if in request_inline_mode) is fixed with a let-chain, matching the edition-2024 idiom already used elsewhere in app.rs.

@nx-cloud nx-cloud Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Nx Cloud View detailed reasoning in Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

@FrozenPandaz
FrozenPandaz merged commit 7480b69 into master Jul 17, 2026
25 checks passed
@FrozenPandaz
FrozenPandaz deleted the fix/nxc-4597-inline-tui-running-in-another-process branch July 17, 2026 21:41
FrozenPandaz pushed a commit that referenced this pull request Jul 20, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants