Conversation
…o 3s (v0.2.3) completeEntry stamped completedAt on every call. Combined with scanSessionState re-running on every 1s tick (since now() is reactive) and re-matching the persistent [ALL BACKGROUND TASKS COMPLETE] system reminder text, the stamp advanced by 1s per tick. Result: a 'Done' entry displayed an ever-growing elapsed time, looking like it was still running. Stamp completedAt only on the first transition to a terminal state. Status can still flip (e.g. completed -> error) but the timestamp is preserved. Also drop COMPLETION_RETENTION_MS from 10s to 3s so completed entries fade faster, per user feedback.
There was a problem hiding this comment.
Pull request overview
Fixes a UI bug in the TUI sidebar where completed (“Done”) agent entries kept showing an increasing elapsed time due to repeated rescans re-stamping completedAt, and shortens the post-completion retention window.
Changes:
- Make
completeEntrystampcompletedAtonly on the first transition into a terminal state, preventing elapsed time from continuing to climb after completion. - Reduce completed-entry retention from 10s to 3s so completed rows disappear sooner.
- Bump plugin/package version to
0.2.3and regenerate distribution artifacts.
Reviewed changes
Copilot reviewed 2 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tui.ts | Freezes completedAt on first terminal transition; reduces completion retention; bumps plugin version constant. |
| package.json | Bumps package version to 0.2.3. |
| dist/tui.js | Regenerated build output reflecting the completeEntry and constants changes. |
| dist/tui.js.map | Updated sourcemap from regenerated build. |
| dist/tui.d.ts.map | Updated type-definition sourcemap from regenerated build. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause
`completeEntry` unconditionally wrote `entry.completedAt = completedAt` on every call. That was fine in isolation, but the surrounding code re-invokes it once per second:
`renderAgentLine` computes `entry.completedAt - entry.startedAt`, so as `completedAt` advanced 1s per tick, the displayed elapsed time advanced 1s per tick. The entry was "Done" (gray) but visually behaved like it was still running.
It also caused unnecessary `bumpVersion` calls (since `completedAt` mismatch was reported as mutated), inflating render churn.
Change
```ts
const completeEntry = (entry: AgentEntry, status: AgentStatus, completedAt: number): boolean => {
const nextStatus = status === "error" ? "error" : "completed";
const statusChanged = entry.status !== nextStatus;
// Stamp completedAt only on the first transition to a terminal state.
// Re-stamping (e.g. when scanSessionState re-matches the same
// [ALL BACKGROUND TASKS COMPLETE] system reminder on every 1s tick) would
// make the elapsed timer keep climbing past completion, so a "Done" entry
// visually behaves like it's still running.
const stampChanged = entry.completedAt === undefined;
if (stampChanged) entry.completedAt = completedAt;
if (statusChanged) entry.status = nextStatus;
return statusChanged || stampChanged;
};
```
Status can still flip (e.g. `completed` → `error`) but the original completion timestamp is preserved.
Verification
Files changed