Skip to content

TUI: Stay open on error to allow reviewing logs#2421

Draft
domenkozar wants to merge 3 commits into
mainfrom
tui-stay-open-on-error
Draft

TUI: Stay open on error to allow reviewing logs#2421
domenkozar wants to merge 3 commits into
mainfrom
tui-stay-open-on-error

Conversation

@domenkozar
Copy link
Copy Markdown
Member

Summary

When a build fails, the TUI now stays open instead of immediately exiting. This allows users to:

  • See which specific derivation failed (shown with ✗)
  • Navigate to the failed activity with arrow keys
  • Expand logs with ^e to inspect build output
  • Exit when ready with q/Enter/Esc (Ctrl+C still exits immediately)

Technical details

  • Adds ViewMode::ErrorPaused state that pauses the TUI after errors
  • Filters out noisy error/warning messages ("Cannot build X") from cluttering the activity list
  • Parses Nix error messages to find and mark the specific build activity as failed (workaround for Nix reporting builds as "success" then emitting separate error messages)
  • Failed activities remain visible indefinitely (no linger timeout)

Test plan

  • Run devenv shell with a failing build and verify TUI stays open
  • Verify failed derivation shows with ✗ marker
  • Verify ^e expands logs for the failed build
  • Verify q/Enter/Esc exits from paused state
  • Verify Ctrl+C still exits immediately

🤖 Generated with Claude Code

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Jan 22, 2026

Deploying devenv with  Cloudflare Pages  Cloudflare Pages

Latest commit: f3fd256
Status: ✅  Deploy successful!
Preview URL: https://845b25fc.devenv.pages.dev
Branch Preview URL: https://tui-stay-open-on-error.devenv.pages.dev

View logs

domenkozar and others added 3 commits January 27, 2026 13:57
Add `parent: Option<u64>` to InternalLog::Msg to forward the parent
activity ID from Nix's structured log format. Add `message_with_parent()`
to the activity stack so the nix log bridge can pass an explicit parent
instead of relying on the task-local stack. This enables the TUI to
associate error messages with the specific build that produced them.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Track activities that received error messages and override their
  success status on completion, so failed builds are visually marked.
- Extract derivation paths from Nix error messages to associate errors
  with the specific build activity.
- Filter Error/Warn messages from the activity tree (they still appear
  in the message log and final error summary).
- Keep failed activities always visible in get_children(), regardless
  of linger duration limits.
- Add ViewMode::ErrorPaused variant for the upcoming --tui-open-on-error
  flag.
- Add has_errors() method to check if any errors occurred during session.
- Update test snapshots for filtered error/warning message activities.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add opt-in --tui-open-on-error flag (also DEVENV_TUI_OPEN_ON_ERROR env)
that keeps the TUI open when errors occur, allowing users to navigate
and review errors interactively. Users can press q/Enter/Esc to exit.

When errors occur without the flag (the default), the TUI exits normally
and prints a tip suggesting the flag for future use.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant