Skip to content

feat: keep the tool trace visible after a run completes - #12

Merged
shiqimei merged 1 commit into
runta-dev:mainfrom
AKollu72:feat/persist-run-activity
Sep 22, 2026
Merged

shiqimei merged 1 commit into
runta-dev:mainfrom
AKollu72:feat/persist-run-activity

Conversation

@AKollu72

Copy link
Copy Markdown
Contributor

Closes #9.

Why

Errand's core promise is that you can hand an agent a task, close the laptop, and come back later. But anyone who wasn't watching the screen during the run can never see what the agent actually did. The tool trace unmounts the moment a run completes, and it's discarded on agent switch, reload, and replay. The result of a run is only half the answer; the trace is the receipt. This PR keeps that receipt, so "every task leaves a trace you can read" (from the Errand launch post) holds after the run finishes, not just during it.

Before

The tool activity list exists only while a run is streaming. WorkingActivity unmounts the moment the agent message settles, activities state is cleared on send and agent-switch, and replayRunMessages consumes only text deltas so ten seconds after a run finishes (or after switching agents, or reopening the app) there is no way to see what the agent actually did.

After

Completed agent messages keep their trace as a collapsed Worked · N steps row, the same <details> block, tool rows, icons, and expand behavior as the live view, minus the timer. It survives run completion, agent switches, and app restarts (reconstructed from the run's event stream during the existing replay). Runs with no tool calls render exactly as before.

How

  • Message gains an optional activities field, so traces ride the existing snapshot / mergeVisualMessage reconciliation instead of new state.
  • replayRunMessages collects tool_execution_* events with the same activityFromPiEvent helper the live subscription uses, instead of discarding them, and attaches them to the replayed agent message.
  • useCrewController moves the live activity pool onto the message that stops streaming (completion, terminal update, or interruption), then clears it — the pool is never shared across runs or agents.
  • One CSS rule (.agent-worked-details … {background:none;animation:none;color:var(--muted)}) stops the working shimmer on settled summaries. No new visual elements or borders otherwise.

Verification

  • npm run typecheck, npm run lint, npm run build are clean.
  • npm test, all suites pass except the pre-existing win32 path-separator assertion in appBranding.test.ts (fails identically on unmodified main; fixed separately in fix: ensure clean installs and tests on Windows and Linux #8).
  • 7 new tests using the existing bounded-transport-double patterns: replay attaches the trace, zero-tool runs stay clean, completion keeps the trace and clears the live feed, agent switches don't leak traces, and the completed summary renders collapsed and expandable.
  • Manually verified in the dev app against Runta production: screenshot below shows a completed run's trace after a full quit and relaunch.
image

Happy to reshape any of this, the summary copy, where the trace sits relative to the reply, or splitting the replay change from the UI change whatever fits your direction for the activity surface.

@shiqimei
shiqimei merged commit df83586 into runta-dev:main Sep 22, 2026
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.

Tool activity trace doesn't persist after a run completes

2 participants