Skip to content

fix(workflow-executor): accept triggerType='mcp' in run mapper (PRD-832) - #1786

Merged
christophebrun-forest merged 1 commit into
feature/prd-49-expose-workflow-tools-in-forest-mcp-serverfrom
feature/prd-832-executor-accept-triggertype-mcp
Jul 28, 2026
Merged

fix(workflow-executor): accept triggerType='mcp' in run mapper (PRD-832)#1786
christophebrun-forest merged 1 commit into
feature/prd-49-expose-workflow-tools-in-forest-mcp-serverfrom
feature/prd-832-executor-accept-triggertype-mcp

Conversation

@christophebrun-forest

@christophebrun-forest christophebrun-forest commented Jul 28, 2026

Copy link
Copy Markdown
Member

Description

Foundational fix for MCP workflow triggering (epic PRD-49).

A workflow run triggered via MCP carries triggerType='mcp', but @forestadmin/workflow-executor only recognized manual | webhook. The run mapper validates the value against AvailableStepExecutionSchema, so every MCP-triggered run failed at step 0 before executing:

error Malformed run reported as error runId="438" stepIndex=0
error="Run 438 mapper produced invalid AvailableStepExecution — triggerType: Invalid option: expected one of \"manual\"|\"webhook\""

Surfaced in the Forest UI as:

Internal validation error occurred while preparing the step. Please contact support.

Root cause

triggerType is informational only in the executor — its sole consumer is a Debug log context in runner.ts; no execution logic branches on it. The run was aborted purely because of an unrecognized value in a logged field.

Fix

  • TriggerType (src/types/validated/execution.ts) — add Mcp = 'mcp'
  • ServerWorkflowTriggerType (src/adapters/server-types.ts) — add mcp = 'mcp'

Strict-enum approach, consistent with the executor's convention of mirroring the server contract. Unknown trigger types still fail loudly.

Tests

Added a mapper test asserting an mcp-triggered run maps to a valid AvailableStepExecution with triggerType preserved (no downgrade to manual). Full suite green (1469 passed), lint clean.

Notes

  • Discovered while testing the MCP discover → trigger → poll flow end-to-end; unblocks PRD-740 validation.
  • Follow-up idea: since triggerType is only logged, a drift-tolerant passthrough could avoid breaking on future server trigger types (scheduled, api, …).

fixes PRD-832

🤖 Generated with Claude Code

Note

Accept triggerType='mcp' in workflow executor run mapper

Adds mcp as a valid trigger type across the workflow executor by adding Mcp = 'mcp' to the TriggerType enum in execution.ts and mcp to ServerWorkflowTriggerType in server-types.ts. The run-to-available-step mapper now correctly maps ServerWorkflowTriggerType.mcp to TriggerType.Mcp, covered by a new test case.

Macroscope summarized 249bbb9.

MCP-triggered runs carry triggerType='mcp', but the executor only
recognized manual|webhook, so AvailableStepExecutionSchema.parse
rejected every MCP run at step 0 with a DomainValidationError before
executing. triggerType is informational only (logged in runner.ts, no
logic branches on it), so a run was aborted purely over an unrecognized
logged value.

Add 'mcp' to TriggerType and ServerWorkflowTriggerType so MCP runs map
to a valid AvailableStepExecution and execute.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jul 28, 2026

Copy link
Copy Markdown

PRD-832

@qltysh

qltysh Bot commented Jul 28, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

Unable to calculate total coverage change because base branch coverage was not found.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
New Coverage rating: A
packages/workflow-executor/src/types/validated/execution.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/adapters/server-types.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@christophebrun-forest
christophebrun-forest merged commit a5cd3a4 into feature/prd-49-expose-workflow-tools-in-forest-mcp-server Jul 28, 2026
65 of 66 checks passed
@christophebrun-forest
christophebrun-forest deleted the feature/prd-832-executor-accept-triggertype-mcp branch July 28, 2026 09:34
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