Skip to content

Commit 7ed7417

Browse files
committed
chore(repo): record the traps in driving nx's TUI unattended
Reproducing #36520 needed 160 unattended runs per version, and each of these cost an iteration before it was understood. - `tui.autoExit: 0` is a duration, so it means never auto-exit, not exit immediately. A loop set that way waits forever for a keypress. - 22.7.x keeps the TUI open after a task fails and `--tuiAutoExit=true` does not override it, so an unattended run hangs on exactly the case being measured. Feed it a quit. - `--tui` and `--outputStyle` are mutually exclusive; passing both prints help and exits 1, which reads as the reproduction failing. Also: size the pty, or the capability check refuses the TUI and the run measures the non-TUI path again.
1 parent 1e28fa0 commit 7ed7417

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

.claude/skills/triage-issues/SKILL.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,11 @@ problem, and check it against the flags you are about to set.
381381
**Your own environment is a flag you did not set.** `CI` is the one you choose; these are set for you,
382382
and each one silently reroutes the code under test:
383383

384-
| Set by | What it changes |
385-
| --- | --- |
386-
| `CLAUDECODE=1`, and the other `CLAUDE*` vars | `isAiAgent()` returns true, and `shouldUseTui()` returns false on it. Every TUI test an agent runs is on the non-TUI path unless the vars are stripped. |
387-
| The pty you run under | `is-tui-enabled.ts` gates on `process.stdout.columns > 0 && rows > 0`. A pty with no winsize (lefthook's inner pty reports 0x0) refuses the TUI outright. |
388-
| `SANDBOX_RUNTIME=1` | `isSandbox()` is true inside the review sandbox, which some paths branch on. |
384+
| Set by | What it changes |
385+
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
386+
| `CLAUDECODE=1`, and the other `CLAUDE*` vars | `isAiAgent()` returns true, and `shouldUseTui()` returns false on it. Every TUI test an agent runs is on the non-TUI path unless the vars are stripped. |
387+
| The pty you run under | `is-tui-enabled.ts` gates on `process.stdout.columns > 0 && rows > 0`. A pty with no winsize (lefthook's inner pty reports 0x0) refuses the TUI outright. |
388+
| `SANDBOX_RUNTIME=1` | `isSandbox()` is true inside the review sandbox, which some paths branch on. |
389389

390390
The failure is always the same shape: the arm you believe is exercising the feature is quietly
391391
exercising its absence, and it comes back clean. **Assert the state you are testing rather than
@@ -394,6 +394,21 @@ print it, or find a byte-level tell such as the alternate-screen sequence `CSI ?
394394
measured twice on the non-TUI path, once for the explicit `--outputStyle=stream` and once for
395395
`isAiAgent()`, before anyone checked.
396396

397+
**Driving the TUI in a loop has three traps, and each one costs an iteration.** They surfaced
398+
reproducing `#36520`, where the arms had to run unattended 160 times per version:
399+
400+
- **`tui.autoExit: 0` means never auto-exit**, not "exit immediately". On 22.6+ the zero is a
401+
duration, so a loop set that way hangs forever waiting for a keypress. Use `true`.
402+
- **22.7.x deliberately keeps the TUI open after a task fails**, and `--tuiAutoExit=true` does not
403+
override it. An unattended run therefore hangs on exactly the case you are trying to measure. Feed
404+
it a quit: `{ sleep 8; printf 'q'; } | script -qec "..." /dev/null`.
405+
- **`--tui` and `--outputStyle` are mutually exclusive.** Passing both makes nx print its help and
406+
exit 1, which reads as the reproduction failing rather than as a bad invocation. The two axes
407+
cannot be crossed; vary them separately.
408+
409+
Give the pty a real size while you are at it (`stty rows 50 cols 200`), or the capability check
410+
refuses the TUI and you measure the non-TUI path again.
411+
397412
**Reproductions are cheaper than they look, because they share one container.** `sandbox start` hands
398413
out a workspace inside the _same_ long-lived host, so a second reproduction is a directory and an
399414
install, not a new container — which is exactly why "a run is too expensive for this one" does not

0 commit comments

Comments
 (0)