Skip to content

fix(mothership): surface the real run error for browser-settled workflow tools - #9634

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/run-tool-failure-error
Nov 3, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/run-tool-failure-error

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • When run_block, run_from_block, run_workflow, or run_workflow_until_block ran in the browser and the workflow failed, the tool error the agent read was always the generic Workflow execution failed.. The real message (<Block>: <reason>) only showed up nested in output.output.error.
  • Cause: getTrustedWorkflowToolExecution read only the top-level executionData.error. Error finalization (completeWithError and its cost-only fallback, finalizationPath: 'force_failed') never writes that field. It stores the message as finalOutput: { error }.
  • Fix: the trusted read now takes finalOutput.error when the run was error-finalized (force_failed). This string has already gone through filterForDisplay and PII redaction, and the agent already sees it nested in output, so nothing new is exposed.
  • A run that failed only through its block spans keeps its workflow output, so its finalOutput.error is workflow data. That case is not read. Cancelled runs are unchanged.
  • Effect on consumers: in client.ts the message now becomes the top-level tool error and the persisted tool-call row error, and it is added to the trusted provenance import. It still passes through boundRunResultForModel and the secret-provenance projection unchanged. /api/copilot/confirm reads only status and executionId, so it is not affected.

Type of Change

  • Bug fix

Testing

  • New trusted-tool-failure.integration.ts runs against real Postgres. It finalizes runs through a real LoggingSession and reads them back through getTrustedWorkflowToolExecution.
    • Thrown run returns its message. This test fails on the pre-fix code.
    • Run that failed through its block spans with a workflow { error } output returns no message. This test fails when the force_failed gate is removed.
  • execution-state.test.ts, mothership/request/tools/client.test.ts, and copilot/confirm/route.test.ts pass (118 tests). bun run lint passes.

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 Nov 3, 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 Nov 3, 2026 9:03pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the cleanup change fixes the earlier finding without introducing a new issue.

Summary

Browser-settled workflow tools now read the saved failure message when finalizationPath is force_failed. Other runs keep treating finalOutput.error as workflow data.

  • Browser-run workflow tools show the saved reason when a run fails.

Reviews (2) · Last reviewed commit: "fix(mothership): clean up run logs and s..." · Reviewed by Greptile

@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 2 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@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 Nov 3, 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 2 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 4dd8a14 into staging Nov 3, 2026
81 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/run-tool-failure-error branch November 3, 2026 22:11

This branch was previously deployed

1 inactive deployment
Preview — 55c2f528 Deployed Nov 3, 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