Skip to content

feat: show timestamp and duration on tool execution blocks - #22145

Closed
kshptl wants to merge 3 commits into
anomalyco:devfrom
kshptl:feat/tool-timing
Closed

feat: show timestamp and duration on tool execution blocks#22145
kshptl wants to merge 3 commits into
anomalyco:devfrom
kshptl:feat/tool-timing

Conversation

@kshptl

@kshptl kshptl commented Apr 12, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #22144

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Shows a clock timestamp and running duration on every tool execution block in both the web UI and TUI. While a tool is running, the timer ticks live every second. Once completed, it freezes at the final duration.

Interrupted/aborted tools display "Interrupted" in red instead of a misleading "0s" duration.

Web UI: New shared utility module (tool-timing.ts) with locale-aware formatting via Intl.DateTimeFormat/Intl.NumberFormat. Reactive SolidJS hooks track timing state per tool part. Timing appears on all tool types — reads, edits, grep, bash, tasks, etc.

TUI: Extracted createTiming hook used by both BlockTool and InlineTool (including spinner branch for running tools). Local formatting helpers use system locale.

Backend fix: prompt.ts now preserves the existing start timestamp when a tool's metadata callback fires during execution, preventing the timer from resetting mid-run. Task-tool cancellation sets metadata.interrupted: true.

How did you verify your code works?

  • bun typecheck clean across all 13 packages (runs via pre-push hook)
  • 13 unit tests passing in packages/ui covering duration formatting, header timing, zero-duration edge cases, and interrupt detection
  • Reviewed tool state machine in processor.ts — timing survives all transitions (pending → running → completed/error)

Screenshots / recordings

Screenshots of the running timer and interrupted state to be added.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Related PR Found:

Note: PR #22145 is the current PR, so it's excluded from the duplicate list.

Display clock time and running duration on every tool execution block in both web UI and TUI. Interrupted tools show 'Interrupted' in red instead of a misleading duration.

Closes anomalyco#22144
@kshptl
kshptl force-pushed the feat/tool-timing branch from b0c1a0a to 71ba4ed Compare April 12, 2026 14:30
@rekram1-node

Copy link
Copy Markdown
Collaborator

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

@kshptl

kshptl commented May 15, 2026

Copy link
Copy Markdown
Author

This PR is still active and being worked on. The linked issue #22144 is still active too: it is open, was assigned to @jlongster, and received a new comment today.

Please do not treat this as closed; I am continuing the work here.

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.

[FEATURE]: Show timestamp and duration on tool execution blocks

2 participants