Conversation
FLUSH and CANCEL declare `callback: z.void()`, so the child acks with `message: undefined`. Node's JSON IPC serialization drops that key, and zod 4.4+ treats a `z.any()` key as required, so the ACK packet failed to parse and `sendWithAck` waited out its full timeout: ~6s on every run completion and ~31s on cancel. Make the ACK packet's `message` optional. Fixes triggerdotdev#4979 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 42f254f The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (7)
🧰 Additional context used🧠 Learnings (1)📓 Common learningsWalkthroughThe ACK packet schema now permits the message field to be absent. Tests use a forked child process to check void and payload acknowledgments. A patch changeset describes the task completion and cancellation delays reported for projects using Zod 4.4 or newer. Priority: ⬆️ High Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change addresses delayed completion and cancellation acknowledgments. No concrete merge-blocking risk is identified; normal checks remain appropriate. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change restores acknowledgments from child processes when callbacks return no value. No new externally reachable entrypoint or introduced security bypass was established, but the shared completion protocol warrants review. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
The `resolves` assertion already fails when the ack is rejected, and a wall-clock bound could flake on a slow runner. Also hyphenate the changeset's compound adjectives. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@coderabbitai On the retained reliability concern (an ACK without Changeset wording fixed in d098714 as well. For maintainers: the failing webapp unit/E2E checks are the fork-secrets issue ( |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
fd -a '^(zodIpc\.ts|zodIpc\.test\.ts|void-ipc-acks\.md)$'
ast-grep outline packages/core/src/v3/zodIpc.ts --items all
ast-grep outline packages/core/test/zodIpc.test.ts --items all
sed -n '1,280p' packages/core/src/v3/zodIpc.ts
sed -n '1,180p' packages/core/test/zodIpc.test.ts
cat .changeset/void-ipc-acks.md
git show HEAD^:packages/core/src/v3/zodIpc.ts | sed -n '1,110p' || trueLength of output: 16548
I also see the corrected changeset wording. Thanks for the context on the webapp checks; I have not independently verified their failure logs. Would you like a follow-up issue for ACK callback validation? ✏️ Learnings added
You are interacting with an AI system. |
Replace the in-memory JSON channel with a forked child process so the ack goes through Node's actual IPC serialization. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Closes #4979
Credit to @marcus-dk for finding and root-causing this in #4979, including the zod version bisect and the end-to-end confirmation with a patched worker.
Summary
FLUSHandCANCELdeclarecallback: z.void(), so the task run process acks them with{ type: "ACK", id, message: undefined }. Node's JSON IPC serialization drops the undefinedmessagekey. Under zod 4.4+ az.any()object key is required at parse time (it was optional under zod 3 and 4.0–4.3), soPacket.safeParserejects every such ack,#handlePacketreturns silently, andsendWithAckwaits out its full timeout.Because
zodIpc.tsimportszod/v4and@trigger.dev/coreresolveszodfrom the user's project, every project on zod ≥ 4.4 pays this on every run: ~6 s between the task finishing and the completion reaching the engine (FLUSH: 5 s + 1 s), and ~31 s on cancel.The fix makes the ACK packet's
messageoptional again (z.any().optional()). Only the ACK packet can legitimately carryundefined, so the other packets are unchanged.✅ Checklist
Testing
packages/core/test/zodIpc.test.ts: forks a real child process (test/fixtures/zodIpcChild.ts) and sendsFLUSH(void callback) andPING(payload callback) over Node's IPC channel, so the ack goes through the same JSON serialization as between a worker and its task run process. Onmain(zod 4.5.4 in this repo) the void-callback test fails withsendWithAck() timeout; with the fix it resolves immediately.pnpm run build --filter @trigger.dev/corepasses.completed_at - started_at - usage_duration_mson successful runs):Changelog
Fix a ~6 second delay between a task finishing and its run completing (and a ~31 second delay when cancelling a run) in projects that use zod 4.4 or newer.
🤖 Generated with Claude Code