fix(mothership): report a Copilot workflow tool whose paused run settles after a resume or cancel by waleedlatif1 · Pull Request #9290 · simstudioai/sim · GitHub
Skip to content

fix(mothership): report a Copilot workflow tool whose paused run settles after a resume or cancel - #9290

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/run-workflow-server-completion
Oct 21, 2026
Merged

waleedlatif1 merged 3 commits into
stagingfrom
fix/run-workflow-server-completion

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • A Copilot run_workflow call whose workflow pauses for human approval was never reported once the run resumed or was cancelled: the browser's report at pause gets a 404 (the log isn't terminal), and the server's own report skips a paused log, so the tool call stayed running and the chat waited out its whole client wait
  • When a paused execution settles on the server (a resume completes or fails it, or it's cancelled while paused), PauseResumeManager now reports the bound tool call through the existing reportSettledClientWorkflowTool. That reporter still no-ops while the run is paused, and a browser report, a background detach, or a call bound to another execution still wins
  • The tool call id is read from the log's correlation with a single key lookup; selectCorrelation is now shared with getTrustedWorkflowToolExecution
  • The reporter is imported lazily, so importing the manager (Trigger workers included) does not open the confirmation channel's Redis connections
  • The client no longer sends the always-404 success report for a paused run, and no longer leaves a pending report to re-send after a reload

Type of Change

  • Bug fix

Testing

  • workflow-client-settlement.integration.ts: 13/13. New cases: a paused run stays open; resumed to completion is delivered exactly once; a resume that fails the run is delivered through the real startResumeExecution; a cancel while paused is delivered through the real completePausedCancellation. Each goes red with its call site or the helper removed
  • run-tool-execution.test.ts: a paused run sends no confirm and leaves nothing to re-send; red without the paused branch
  • Unit: run-tool-execution, human-in-the-loop-manager, execution-state, copilot/confirm/route (190 pass)
  • biome on changed files; full type-check, check:audits and the test suite run in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • 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 Oct 21, 2026 •

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files

Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/workflows/executor/execution-state.ts
@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Reports paused Copilot workflow tools when a resumed run finishes, fails, or is cancelled.

  • Paused Copilot workflow calls finish when their run resumes or is cancelled.

No new actionable issues were found. Tests were inspected, not run.

Diagram

sequenceDiagram
  participant Browser
  participant Manager as PauseResumeManager
  participant Log as Execution log
  participant Reporter as Settlement reporter
  participant Copilot
  Browser->>Log: Workflow pauses
  Browser->>Browser: Save server-report marker
  Note over Browser,Copilot: Tool remains running
  Manager->>Log: Resume finishes, fails, or cancellation completes
  Manager->>Log: Read bound tool call
  Manager->>Reporter: Report settled execution
  Reporter->>Log: Check terminal status
  Reporter->>Copilot: Complete matching running claim once
Loading

Reviews (3) · Last reviewed commit: "fix(mothership): read a paused run's Cop..." · Reviewed by Greptile

Comment thread apps/sim/lib/mothership/request/tools/workflow-client-settlement.integration.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 force-pushed the fix/run-workflow-server-completion branch from 64dec51 to 125655f Compare October 21, 2026 19:17
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 75f2960 into staging Oct 21, 2026
55 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/run-workflow-server-completion branch October 21, 2026 19:42

This branch was previously deployed

1 inactive deployment
Preview — 125655f4 Deployed Oct 21, 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