Skip to content

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

Open
kshptl wants to merge 1 commit intoanomalyco:devfrom
kshptl:feat/tool-timing
Open

feat: show timestamp and duration on tool execution blocks#22145
kshptl wants to merge 1 commit intoanomalyco:devfrom
kshptl:feat/tool-timing

Conversation

@kshptl
Copy link
Copy Markdown

@kshptl kshptl commented Apr 12, 2026

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
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.

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

1 participant