Skip to content

Add live duration to active running command#10757

Open
seemeroland wants to merge 3 commits into
masterfrom
roland/live-command-run-duration
Open

Add live duration to active running command#10757
seemeroland wants to merge 3 commits into
masterfrom
roland/live-command-run-duration

Conversation

@seemeroland
Copy link
Copy Markdown
Contributor

@seemeroland seemeroland commented May 12, 2026

Description

The active block now gets a live duration counter that is rounded to the nearest second and repainted every second.
It does this by adding a new LiveElement wrapper that handles repainting on an interval. On the next repaint, we can end up removing the LiveElement wrapper which ends the loop.

Linked Issue

Closes #9801

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

  • I have manually tested my changes locally with ./script/run

Screenshots / Videos

https://www.loom.com/share/a5337675f17f4b99b5c09aab6369c5f3

Note the tooltip clipping issue is fixed by #10423

Not in loom but also tested that shared session viewers get the live counter

Changelog Entries for Stable

CHANGELOG-NEW-FEATURE: Added live duration to active running command

@cla-bot cla-bot Bot added the cla-signed label May 12, 2026
@seemeroland seemeroland marked this pull request as ready for review May 12, 2026 19:38
@seemeroland seemeroland requested a review from zachbai May 12, 2026 19:38
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 12, 2026

@seemeroland

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds live elapsed duration text for currently executing terminal blocks by deriving an in-progress duration from start_ts and wrapping the rendered duration in an element that schedules periodic repainting.

Concerns

  • Silent commands can miss the repaint loop entirely because the duration is hidden until at least one whole second has elapsed, so the first post-preexec render does not mount the repainting element.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

self.start_ts.and_then(|start| {
let elapsed = now.signed_duration_since(start);
let whole_secs = elapsed.num_seconds();
(whole_secs > 0).then(|| Duration::seconds(whole_secs))
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.

⚠️ [IMPORTANT] Returning None for the first second means a silent command’s initial post-preexec render will not include LiveDurationElement, so no repaint_after tick is scheduled and the live counter may never appear until unrelated output or interaction triggers another repaint.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This review might have been kicked off before the refactor. We do handle this case line 22374 in terminal view

@seemeroland seemeroland requested review from harryalbert and removed request for zachbai May 12, 2026 23:59
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.

Add start running time counter on long running shell commands

1 participant