Skip to content

Surface package workflow and connector ingress failures - #442

Merged
kentcdodds merged 3 commits into
mainfrom
cursor/propagate-workflow-export-errors-081d
May 12, 2026
Merged

kentcdodds merged 3 commits into
mainfrom
cursor/propagate-workflow-export-errors-081d

Conversation

@kentcdodds

@kentcdodds kentcdodds commented May 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Surface non-2xx package workflow export responses as workflow errors so failed package invocations do not appear complete.
  • Route /connectors/* through the Worker before Cloudflare Assets in production, preview, and test so home connector websocket ingress reaches RemoteConnectorSession instead of the SPA shell.
  • Rebased on main after the remote-connector workflow support landed there.

Verification

  • npx oxfmt --check packages/worker/wrangler.jsonc packages/worker/src/package-runtime/package-workflows.ts packages/worker/src/package-runtime/package-workflows.node.test.ts
  • npx vitest run --project node-unit packages/worker/src/package-runtime/package-workflows.node.test.ts
  • npx vitest run --project workers-unit packages/worker/src/security/public-route-hardening.workers.test.ts
  • npm run typecheck
  • npm run build
  • Local Wrangler probe confirmed ws://127.0.0.1:3742/connectors/home/default opens and receives {"type":"server.ping"}, while plain HTTP returns 404.
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Tests

    • Added test cases for error handling in package workflow execution, including failure scenarios with API errors and redirect responses.
  • Improvements

    • Enhanced error messaging for workflow export failures with more descriptive feedback.
    • Updated routing configuration for connector request handling.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 12, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c249ce59-c1c2-432f-b614-e8a877c7bfe5

📥 Commits

Reviewing files that changed from the base of the PR and between 006a3bc and e705a2b.

📒 Files selected for processing (3)
  • packages/worker/src/package-runtime/package-workflows.node.test.ts
  • packages/worker/src/package-runtime/package-workflows.ts
  • packages/worker/wrangler.jsonc
✅ Files skipped from review due to trivial changes (1)
  • packages/worker/src/package-runtime/package-workflows.node.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/worker/wrangler.jsonc

📝 Walkthrough

Walkthrough

Package workflow export invocations now validate HTTP-2xx responses and extract user-facing error messages from response bodies. Tests cover 500-like and 302-like error scenarios. Wrangler configuration routes /connectors/* assets through the worker before static serving across all environments.

Changes

Package Workflow Export Error Handling and Asset Routing

Layer / File(s) Summary
Export response error message extraction and validation
packages/worker/src/package-runtime/package-workflows.ts
getWorkflowInvocationErrorMessage(response) extracts error messages from response bodies, falling back to HTTP-status-based messages. invokePackageWorkflowExport now validates non-2xx responses and throws using the extracted message.
Workflow export error scenario tests
packages/worker/src/package-runtime/package-workflows.node.test.ts
Tests verify that HTTP 500-like errors record workflow runs as errored with extracted tool-name messages, and HTTP 302 redirects record runs as errored with HTTP-status-based messages.
Wrangler connector asset routing configuration
packages/worker/wrangler.jsonc
/connectors/* is added to run_worker_first assets in production, preview, and test environments, ensuring connector requests route through the worker before static asset serving.

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly Related PRs

  • kentcdodds/kody#433: Both PRs modify the package export invocation path in package-workflows.ts—the main PR adds HTTP-error handling while the related PR threads remote connectors into the same invocation flow.
  • kentcdodds/kody#335: The main PR's response-status validation and error message extraction directly extend the package workflow invocation logic introduced in this PR.
  • kentcdodds/kody#423: Both PRs modify the same package-workflows module; this PR adds HTTP-status and error-message handling for export invocation.

Poem

🐰 Workflow exports now dodge the errors with grace,
extracting messages from responses, keeping pace.
A 500 or 302 won't slip through the cracks,
connectors route smoothly, no asset attacks.
Wrangler and tests together ensure all runs clean! 🎀

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Surface package workflow and connector ingress failures' directly and clearly summarizes the two main objectives: surfacing workflow export failures and routing connector ingress through the Worker.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 cursor/propagate-workflow-export-errors-081d

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 and usage tips.

@kentcdodds
kentcdodds marked this pull request as ready for review May 12, 2026 02:36

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/worker/src/package-runtime/package-workflows.ts`:
- Around line 1013-1015: The current check in the package export response
handling (the conditional using response.status and the thrown Error created by
getWorkflowInvocationErrorMessage) only rejects 4xx/5xx; change the condition so
any non-2xx response is rejected — i.e., replace the check that uses
response.status >= 400 with one that rejects status codes outside the 200–299
range (for example response.status < 200 || response.status >= 300) so redirects
(3xx) are treated as errors and the same getWorkflowInvocationErrorMessage is
thrown.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ea3fe65c-3927-495a-918e-1e39e3a3b7ba

📥 Commits

Reviewing files that changed from the base of the PR and between b85be86 and 1168b82.

📒 Files selected for processing (4)
  • packages/worker/src/package-invocations/service.node.test.ts
  • packages/worker/src/package-invocations/service.ts
  • packages/worker/src/package-runtime/package-workflows.node.test.ts
  • packages/worker/src/package-runtime/package-workflows.ts

Comment thread packages/worker/src/package-runtime/package-workflows.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/worker/wrangler.jsonc`:
- Line 102: The test environment's asset routing omits "/connectors/*" from the
run_worker_first list, causing inconsistent worker-first behavior vs
production/preview; update the env.test.assets.run_worker_first array to include
"/connectors/*" (matching the top-level "run_worker_first" and the
production/preview configurations) so connector routes are exercised in
worker-first order during tests; locate and modify the
"env.test.assets.run_worker_first" entry and any other run_worker_first arrays
(e.g., the one referenced near the preview/production blocks) to ensure
"/connectors/*" is present across environments.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2dc63a4e-9074-46f4-82be-bb71979bb516

📥 Commits

Reviewing files that changed from the base of the PR and between 1168b82 and 1247a55.

📒 Files selected for processing (1)
  • packages/worker/wrangler.jsonc

Comment thread packages/worker/wrangler.jsonc
@cursor cursor Bot changed the title Surface package workflow export failures Surface package workflow and connector ingress failures May 12, 2026
cursoragent and others added 3 commits May 12, 2026 03:29
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@cursor
cursor Bot force-pushed the cursor/propagate-workflow-export-errors-081d branch from 006a3bc to e705a2b Compare May 12, 2026 03:30
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-442.kentcdodds.workers.dev

Worker: kody-pr-442
D1: kody-pr-442-db
KV: kody-pr-442-oauth-kv

Mocks:

@kentcdodds
kentcdodds merged commit 9545255 into main May 12, 2026
5 checks passed
@kentcdodds
kentcdodds deleted the cursor/propagate-workflow-export-errors-081d branch May 12, 2026 03:39
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.

2 participants