Delay hook output preview rendering#2140
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2140 +/- ##
==========================================
+ Coverage 92.38% 92.39% +0.01%
==========================================
Files 122 122
Lines 25770 25815 +45
==========================================
+ Hits 23808 23853 +45
Misses 1962 1962 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a 500ms grace period before the per-hook output preview rows are rendered, so that fast hooks don't briefly flash preview lines on screen before disappearing. Output is still buffered in OutputPreview during the delay; once the threshold passes, the next chunk renders the accumulated lines.
Changes:
- Track each hook's
started_at: InstantinHookBar. - In
push_output, short‑circuit before creating any previewProgressBarwhile elapsed time is belowHOOK_OUTPUT_PREVIEW_DELAY(500ms) and no preview bars exist yet. - Add unit tests covering the pre‑delay buffering and post‑delay flush behavior.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27428bc2d1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if self.output_bars.is_empty() && self.started_at.elapsed() < HOOK_OUTPUT_PREVIEW_DELAY { | ||
| return None; |
There was a problem hiding this comment.
Flush buffered preview output after the delay elapses
When a hook writes output during the first 500 ms and then stays running without producing another chunk, this early return leaves the preview buffered indefinitely because push_output is only called from on_run_output; there is no timer or completion path that re-renders once HOOK_OUTPUT_PREVIEW_DELAY has elapsed. A long-running hook that prints an initial status line and then hangs or performs a slow step will therefore show no preview until it emits more output, which defeats the delayed-rendering behavior for exactly the case where users need live feedback.
Useful? React with 👍 / 👎.
No description provided.