Skip to content

Finish cancelling stopped tools and preserve late-title replay - #8264

Merged
Sg312 merged 2 commits into
stagingfrom
fix/staging-stop-pending-tools
Sep 24, 2026
Merged

Sg312 merged 2 commits into
stagingfrom
fix/staging-stop-pending-tools

Conversation

@Sg312

@Sg312 Sg312 commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Stopped responses now cancel tools waiting to start or awaiting approval as well as executing tools, so a stopped conversation cannot retain an actionable approval card after reload.

Server replay accepts a completion frame followed by a late title session event while retaining the matching terminal-run and gap-free-history requirements. Title generation itself is unchanged. This resolves the remaining findings from #8259.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other

Testing

  • All 61 persistence and Stop route regressions pass, covering pending/executing/approval tool states, immutability, completed tool preservation, a late title event, incomplete replay, and mismatched runs.
  • App type checking and Biome pass.
  • Greptile and Cubic finished reviewing the runtime changes. The sole finding, missing coverage for Stop marker creation, is fixed by testing every unfinished state with and without an existing marker. Updated CI must finish before staging merge.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 24, 2026 8:03pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

The PR appears safe to merge; restoring the no-marker regression case would improve coverage.

Findings

  1. P2 Stopped marker coverage dropped ▶

Summary

The PR cancels pending and approval-waiting tools when persisting a stopped response, and allows server replay when a title event follows the completion frame.

  • The replay still requires a terminal run for the chat and gap-free events.
  • The revised tool-state tests drop direct coverage of adding a cancelled completion marker.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Stop request] --> B{Matching terminal run?}
  B -- No --> C[Do not persist server replay]
  B -- Yes --> D{Gap-free events with completion?}
  D -- No --> C
  D -- Yes --> E[Build assistant response]
  E --> F[Cancel unfinished tool states]
  F --> G[Persist stopped response]
Loading

Reviews (1) · Last reviewed commit: "Cancel waiting tools and retain complete..."

Comment thread apps/sim/lib/mothership/chat/persisted-message.test.ts Outdated
@Sg312
Sg312 merged commit 13fb807 into staging Sep 24, 2026
33 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/staging-stop-pending-tools branch September 24, 2026 21:43

This branch was previously deployed

1 inactive deployment
Preview — 92d9263d Deployed Sep 24, 2026 by vercel[bot]
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.

1 participant