Repository navigation
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
8a5c39b to
b30b9cc
Compare
There was a problem hiding this comment.
Thanks for porting this to V2. In my run, the TUI part of the change doesn't show up in the default view yet, and the web renderer has an unrelated layout change.
How I checked: I ran OpenCode from source on the base and on this branch with the simulated model, using a sleep 6 shell call followed by a read, and took screenshots while it was running and after it finished. They look the same on both. The shell block shows no time, and the read is grouped into Explored: 1 read. Both packages type-check. The TUI snapshot test file and session-ui's unit tests pass. I didn't run the Playwright component test or the web UI.
Public API: unchanged. This only changes rendering in packages/tui and packages/session-ui; the new time props are internal to those components.
Concerns, with details inline:
- The TUI shell block, the main case in #50891, never shows the duration. The interval still runs for it in the background.
- apply_patch/edit with files now gets an extra locked
FileToolheader row around the file accordion. That isn't part of this feature. - The new TUI test uses a real
Bun.sleep(1100)next tosetSystemTime, so it depends on timing.
Could you also add a before/after screenshot of the TUI default view with a running shell command?
Related: #50891
| const error = createMemo( | ||
| () => props.error ?? (props.part?.state.status === "error" ? props.part.state.error.message : undefined), | ||
| ) | ||
| const elapsed = createToolElapsed( |
There was a problem hiding this comment.
BlockTool only adds the duration next to props.title or props.path. The shell renderer calls <BlockTool part={props.part} ...> with neither, so a long-running shell command (the main case in #50891) never shows its time. I ran sleep 6 from source and saw no duration while it ran or after it finished. The interval still ticks once a second for a value nothing displays. Could the shell block (and any other title-less blocks) render it, e.g. next to the command line or the spinner?
There was a problem hiding this comment.
You are right — ShellDisplay passed no title/path to BlockTool, so the elapsed value was computed but never rendered. Fixed in ba7ce1f: ShellDisplay now shows the duration next to the command line in both running and completed states (same createToolElapsed source, Locale.duration formatting). Before/after captures of the real Shell render are in the PR body.
|
|
||
| return | ||
| } | ||
| <FileTool {...props} title={title()} count={files().length}> |
There was a problem hiding this comment.
This wraps the apply_patch/edit accordion in FileTool, so every patch with files now gets an extra locked Patch · N files header row above the file list. Before, that header was only the empty-files fallback. That's a visible layout change unrelated to elapsed time. Could you keep the previous structure and show the duration some other way (e.g. in the accordion actions, as you did for write), or move this to its own PR?
There was a problem hiding this comment.
Agreed — the FileTool wrapper added a locked header row that was not part of this feature. Fixed in ba7ce1f: the patch renderer keeps the base structure (bare FileAccordionGroup, FileTool only for the empty fallback) and the duration now renders in each file row trigger actions next to DiffChanges, like write does with accordion actions.
| } | ||
| expect(await renderFrame(component, { width: 72, height: 3 })).toContain("Shell sleep 5 · 3.0s") | ||
| setSystemTime(12_000) | ||
| await Bun.sleep(1100) |
There was a problem hiding this comment.
This mixes setSystemTime with a real Bun.sleep(1100) and relies on the real setInterval firing within that window. On a loaded CI machine the check for 5.0s can fail. Could the test drive time without sleeping, e.g. by testing createToolElapsed with a controllable clock? Or drop the ticking step and just check the running and frozen values.
There was a problem hiding this comment.
Fair point — dropped the real Bun.sleep step and the mid-tick assertion. The test now checks the running value and the frozen-at-completed value only, both fully deterministic. Live ticking stays covered by the Playwright component test, which drives time with a fake clock.
|
Thanks for the review — all three inline points checked out on the rebased base and are addressed in ba7ce1f (replies inline). Summary: shell duration now renders next to the command line in the TUI default view (before/after captures added to the PR body); apply_patch/edit keeps the base layout with duration in per-file trigger actions; the snapshot test no longer depends on a real sleep. Re-verified: TUI snapshot file 14 pass, session-ui unit 251 pass, typechecks for both packages pass. |
There was a problem hiding this comment.
Thanks for the quick follow-up. All three earlier points are resolved:
- The TUI shell block now shows the duration: in my run it read
· 3.0swhile running and· 6.0safter finishing. On the base it shows nothing. - apply_patch/edit is back to the base layout, with the duration in each file's row.
- The TUI test no longer uses a real
Bun.sleep.
How I checked: I re-ran OpenCode from source on the base and on this branch with the simulated model and a sleep 6 shell call. The TUI snapshot test file and session-ui's unit tests pass, and both packages type-check. I didn't run the Playwright component test or the web UI.
Public API: unchanged. This only changes rendering inside packages/tui and packages/session-ui.
One small leftover, not blocking: BlockTool still creates its own elapsed timer for the shell block, which has no title or path, so that interval runs while the shell is running but is never displayed.
Fixes #50891
|
Thanks, I checked both in |
|
Web screenshots refreshed on current code (component test re-run, ba7ce1f included): the running/completed captures in the PR body now also show the write row with per-file duration in trigger actions and no extra FileTool header. |
ba7ce1f to
4a3b0df
Compare
aca3ba0 to
e1f2e80
Compare
- Show shell duration next to the command line in ShellDisplay (BlockTool only renders elapsed for title/path blocks) - Revert FileTool wrapper around apply_patch/edit file list; show duration in per-file trigger actions instead - Rework elapsed snapshot test to avoid real Bun.sleep timing dependence
c214b59 to
ff03922
Compare
|
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:
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. |



Issue for this PR
Related to #50891. V2 replacement for the closed V1 PR #50892.
Type of change
What does this PR do?
Show tool execution duration in the V2 TUI and shared Web session renderer. Running tools update once per second from
time.ran; completed and failed tools freeze attime.completed. Queued tools without a start timestamp show no duration.It uses the V2 wire schema rather than the V1 tool-state timestamps.
How did you verify your code works?
dev;bun run checkat the base has a pre-existing ast-grep unused-suppression failure inpackages/util/src/cross-spawn-spawner.ts(untouched by this PR), so the repo-wide pre-push hook was bypassed with--no-verify. Changed packages pass individually:packages/tui+packages/session-uitypechecks pass; oxlint on changed files: 0 warnings, 0 errors.Bun.sleep(running value + frozen value only; ticking is covered by the component test under a fake clock).SessionAssistantContent: verifies live shell/generic timing, completed/error timing, and hidden pending duration.ba7ce1f: shell duration now renders next to the command line in the TUI default view; apply_patch/edit keeps the base layout with duration in per-file trigger actions.Screenshots / recordings
Running tools:
After completion, duration remains frozen:
TUI default view, running shell command (real
Shellrender via TUI test harness):Before (no duration shown):
After (duration next to the command line; frozen once completed):
Checklist
Added by the opencode bot (AI-generated).
Fixes #50891