Skip to content

fix(frontend): retire tool previews when approvals take over - #6597

Merged
mmabrouk merged 1 commit into
release/v0.115.2from
fix/release-1152-terminal-tool-preview
Sep 6, 2026
Merged

fix(frontend): retire tool previews when approvals take over#6597
mmabrouk merged 1 commit into
release/v0.115.2from
fix/release-1152-terminal-tool-preview

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Sep 6, 2026

Copy link
Copy Markdown
Member

Context

A tool waiting for approval could remain visible as a second running tool after its saved approval row appeared. If terminal transcript adoption was deferred to protect the approval, that temporary preview could survive recovery into the next turn and leave activity dots after completion.

Changes

Hand an unchanged input preview to the saved tool with the same call ID when the bounded transcript is adopted. Keep newer tool outputs and errors, and keep text that the saved transcript does not cover. The existing approval card remains the source of the approval state.

How to review

Start with the tool ownership check in retireCoveredSessionLivePreview, then the reducer regression and the hook recovery scenario. This PR is stacked on #6596 so one frontend image can verify both corrections.

Tests

The new reducer regression fails before the correction. All 61 combined reader, preview, and commit-notification tests pass after stacking; TypeScript and all 25 frontend lint tasks pass. Independent review passed. The original defect was captured in a real OSS preview session; fixed-image desktop/mobile browser verification is pending the combined image build.

What to QA

With the shared reader enabled, pause on a tool approval, then resume or cancel it and continue with another turn. Each tool should have one visible row, and completed turns should leave no running preview or activity dots. Newer streamed text and tool errors must stay visible during saved-transcript updates.

@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agenta-documentation Ready Ready Preview Sep 6, 2026 1:15am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: b206113b-d040-4b9e-9686-c82612df1343

📥 Commits

Reviewing files that changed from the base of the PR and between bda6a6e and e30b0f8.

📒 Files selected for processing (3)
  • web/packages/agenta-chat/src/model/livePreview.ts
  • web/packages/agenta-chat/tests/unit/hooks/useSessionLivePreview.test.tsx
  • web/packages/agenta-chat/tests/unit/model/livePreview.test.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved live preview recovery when reconnecting or restoring an active session, preventing outdated approval previews from remaining visible.
    • Preserved durable approval states while clearing temporary running indicators.
    • Ensured tool errors remain visible after preview handoffs and session recovery.
  • Tests
    • Added coverage for reconnect scenarios, snapshot recovery, approval handoffs, and tool error preservation.

Walkthrough

The change retires captured tool previews when durable tool records cover them. Tests validate approval preservation, output-error handling, and recovery from an old paused turn to a newer running turn.

Changes

Live Preview Retirement

Layer / File(s) Summary
Durable tool retirement
web/packages/agenta-chat/src/model/livePreview.ts, web/packages/agenta-chat/tests/unit/model/livePreview.test.ts
The retirement logic collects durable tool call IDs and retires matching streaming or available previews. Tests verify approval state preservation and output-error handling.
Recovery handoff validation
web/packages/agenta-chat/tests/unit/hooks/useSessionLivePreview.test.tsx
The recovery test verifies that an old approval preview is cleared when snapshot recovery adopts a newer running turn. New connection text frames replace the old messages.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to e30b0

This change retires temporary tool previews when matching saved tool records take ownership, while preserving approval state and newer error output. The covered handoff and recovery behaviors present no remaining merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: retiring frontend tool previews when approvals take ownership.
Description check ✅ Passed The description directly explains the preview-retirement fix, preserved content, recovery behavior, tests, and pending browser verification.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/release-1152-terminal-tool-preview

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mmabrouk

mmabrouk commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: @coderabbitai review

Please review e30b0f8 for saved-tool ownership and preservation of newer output. Independent review passed. The new regression fails before the fix; 61 combined preview, reader and commit-notification tests pass, as do TypeScript and frontend lint. Fixed-image browser verification remains pending.

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

@mmabrouk I will review the requested commit. I will check saved-tool ownership, preservation of newer text and errors, and recovery behavior.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-09-06T02:50:49.882Z

@mmabrouk
mmabrouk changed the base branch from fix/release-1152-live-commit-refresh to release/v0.115.2 September 6, 2026 02:50
@mmabrouk
mmabrouk merged commit 4c50996 into release/v0.115.2 Sep 6, 2026
76 of 77 checks passed
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.

1 participant