Skip to content

Comments

Capture stdout/stderr for live display#819

Merged
willccbb merged 3 commits intomainfrom
sebastian/vf-eval-fix-re-render-errors-2026-02-03
Feb 4, 2026
Merged

Capture stdout/stderr for live display#819
willccbb merged 3 commits intomainfrom
sebastian/vf-eval-fix-re-render-errors-2026-02-03

Conversation

@snimu
Copy link
Contributor

@snimu snimu commented Feb 4, 2026

Description

Add fd-level stdout/stderr capture during Rich live eval to prevent stray output from corrupting the TUI; route it into the existing Logs panel and restore fds/terminal state on exit.

Cause of the error: non‑verifiers output (prints, warnings, tracebacks, subprocess stderr) was writing to the terminal while Rich Live was drawing. That moves the cursor, so the next refresh paints at the wrong location and you get overlapping panels. The fix intercepts fd 1/2 during the live display, so those writes no longer hit the terminal.

Turns a hot mess like this:

image

Into something nice like this (notice that the logs actually capture the outputs that previously caused the display issues):

2026-02-03_17-23-37

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test improvement

Testing

  • All existing tests pass when running uv run pytest locally.
  • New tests have been added to cover the changes

Checklist

  • My code follows the style guidelines of this project as outlined in AGENTS.md
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Note

Medium Risk
Touches low-level process I/O redirection and thread lifecycle; mistakes could hang or lose output or fail to restore terminal state on exit.

Overview
Prevents Rich Live TUI corruption by capturing fd-level stdout/stderr during BaseDisplay.start() and routing that output into the existing Logs panel instead of letting stray prints/warnings write to the terminal.

Adds a background _FDToLogger reader thread per stream, adjusts DisplayLogHandler formatting for these new verifiers.*.(stdout|stderr) loggers, and ensures BaseDisplay.stop() restores original fds/streams and joins threads/cleans up the temporary console file.

Written by Cursor Bugbot for commit da3f6a4. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@snimu snimu requested a review from willccbb February 4, 2026 02:31
@willccbb
Copy link
Member

willccbb commented Feb 4, 2026

any way to preserve the original logs in the "logs" panel without it showing as "verifiers.stderr" ?

@willccbb willccbb self-requested a review February 4, 2026 07:52
@willccbb willccbb merged commit 768b7ee into main Feb 4, 2026
6 checks passed
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.

2 participants