Repository navigation
feat(sdk): add durable child-flow dispatch - #588
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Warning Review limit reachedNext included review available in 40 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (8)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (22)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughAuthored flows can now dispatch direct children declared with ChangesAuthored Child-Flow Dispatch
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~60 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant ParentFlow
participant AuthoredFlowExecutor
participant LoadedFlowGraph
participant ChildJournal
ParentFlow->>AuthoredFlowExecutor: Dispatch declared child with input
AuthoredFlowExecutor->>LoadedFlowGraph: Resolve direct child name
LoadedFlowGraph-->>AuthoredFlowExecutor: Return child definition
AuthoredFlowExecutor->>ChildJournal: Record child operations and receipt
ChildJournal-->>AuthoredFlowExecutor: Return completion data
AuthoredFlowExecutor-->>ParentFlow: Return dispatch receipt
Merge Risk: ⚪ Minimal · up to This change adds durable child-flow dispatch with depth, capability, and budget checks, plus connected Cloud graph mirroring. No specific merge-blocking issue was identified. Normal pre-merge checks apply. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Dispatch is limited to declared children and shares the parent’s execution limits, but the promised limit on child integration capabilities is not fully enforced at the helper call. The effect depends on which integrations are mounted and which child flows are invoked. 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 | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 18 files. (4 skipped: 4 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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. I’m a rabbit with a journal to chart, Comment |
|
@coderabbitai review |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f79a8ab. Configure here.
|
Verification at head 6eff9d7: Command: Captured output: The standalone Bun 1.4.0 boundary was also rerun after the CI-reported stale test was updated: Command: Captured output: |
|
@coderabbitai review |
|
|
Ready for authorized human merge at exact head 6eff9d7. All repository checks are green (Linux artifact included), Cursor Bugbot is green, and all five review threads are resolved. Per AGENTS.md, an agent may not merge this PR; @khaliqgant please review and merge so the coordinated release, Cloud dependency pin, runtime artifact rollout, and production dashboard proof can continue. |
|
Follow-on authoring guidance is ready in AgentWorkforce/relay#1867 and explicitly depends on this PR. All checks at this exact head are green and all review threads are resolved. Per this repository's constitution I cannot perform the merge; once a human merges #588, I can publish the coordinated package release and continue the Cloud dependency/runtime pin rollout. |
…shot per subscription Main's durable child-flow dispatch (#588) runs a child body in the same root run with a fresh AuthoredActivities, so a child's f.on() would reuse the root-scoped ordinal activity-1 and collide with the parent's subscription. Refuse it with dispatch_invalid before journal contact, matching f.human. Add a kernel test pinning that subscription.inspect reports exactly one snapshot per subscription id across prepared -> active -> closed and restart; Cloud's lifecycle mirroring relies on it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ops: add event-await overnight implementation flow Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * feat(surface): add bounded event activities Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * docs(evidence): record event activity surface slice Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * fix(sdk): open activities before body work Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * docs(evidence): add activity opening fix Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * feat(kernel): add durable event activities Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * docs(evidence): record event activity kernel slice Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * fix(daemon): restrict activity close reasons Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * docs(evidence): record activity close boundary Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * fix(daemon): reserve subscription streams Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * docs(evidence): record reserved stream boundary Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * feat(event-await): integrate local activity ingress Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * docs(evidence): record event await local slice Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * test(event-await): pin unread lifetime accounting Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * docs(evidence): update event await acceptance capture Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * fix(event-await): preserve durable activity wake recovery Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * docs(evidence): record event-await audit commit Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * fix(event-await): retain normal wakes until acknowledged Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * docs(evidence): record event-await audit pass 2 Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * feat: add durable event await suspension protocol Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * feat: report immutable prepared event subscription facts Session-Id: 01a09c40-ce3b-7f11-a7df-b6b7ccab6fd9 * docs(events): replace stale handoff claims with captured CLI evidence * fix(events): isolate subscription waits and record cancellation correctly * fix(events): preserve body failures before subscription activation * fix(events): fail closed when replaying corrupt journal data Reject malformed pending ranges, malformed stream entries, and missing frames. Remove the unused one-off implementation driver; the current runtime probe remains the acceptance fixture. * docs(events): specify stable call-order subscription identity * fix(cli): load activity compiler only for authored checks * feat(events): fence router delivery and expose durable subscription metadata * fix(events): integrate main and verify subscription reporting boundaries * test(events): pin recovery of torn overflow fences * fix(sdk): attach local workers to declared agent streams * test(sdk): select the step_failed diagnostic rather than the last one The merged tree's run-report boundary appends a trailing protocol_error diagnostic when durable subscriptions cannot be inspected, so `at(-1)` no longer names the step failure the test means to pin. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(event-await): use authored failure verdict in CLI probe Session-Id: 01a0d51d-44ff-76b3-924f-83afe48f4b4f * docs(event-await): record authored verdict proof and Cloud blockers Session-Id: 01a0d51d-44ff-76b3-924f-83afe48f4b4f * fix(sdk): refuse f.on in dispatched child flows; pin one inspect snapshot per subscription Main's durable child-flow dispatch (#588) runs a child body in the same root run with a fresh AuthoredActivities, so a child's f.on() would reuse the root-scoped ordinal activity-1 and collide with the parent's subscription. Refuse it with dispatch_invalid before journal contact, matching f.human. Add a kernel test pinning that subscription.inspect reports exactly one snapshot per subscription id across prepared -> active -> closed and restart; Cloud's lifecycle mirroring relies on it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(kernel): report closed for canceled pulls; close prepared bindings at terminal A close over an outstanding subscription.next settles its wait as {closed:true}. Live next and ordinal replay decoded that ready completion as an event wake and failed with "lacks from_offset" instead of the defined closed refusal. wake_from_completed now reports the subscription as closed. (Cursor Bugbot, state.rs:229) A binding still prepared when the run becomes terminal never got a subscription.closed entry, so Cloud's prepared row had no terminal signal and inspect kept reporting it prepared. The terminal boundary now closes prepared ids too, and inspect reports them closed with their completion reason. (CodeRabbit, subscriptions/mod.rs:101) Both regressions are covered by kernel tests that fail without the change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sdk): check f.on through the body's actual context; drop stray SDK bun.lock flows check matched only calls on an identifier literally named f, so async (ctx) => ctx.on(source, {}) or a destructured { on } skipped the unbounded_subscription preflight. Resolve the context parameter of each authored body (the last function argument of flow(...) and the default export, inline or by same-file name) and track a destructured on alias. Other .on calls, such as event emitters, are still ignored. None of the repo's 39 .flow.ts files is refused. (Codex, cli/check-activities.ts:49) packages/sdk/bun.lock came in with an earlier merge of this branch. It pins @relayflows/surface 2.0.30 against the manifest's 2.0.35, and main has no SDK bun.lock; CI installs the SDK with npm ci. Remove it rather than maintaining a second lockfile. (Codex, packages/sdk/bun.lock:11) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sdk): scope the f.on preflight to authored bodies and respect shadowing c297b16 collected context parameter names file-wide, so a helper outside the body such as function wire(ctx) { ctx.on('data', h) }, or an imported node:events on, was refused as an unbounded activity. Check only inside the resolved body functions, and drop a context name inside a nested function that rebinds it. Each case is covered by a test that fails when the scoping or the shadowing is removed. (Independent review of c297b16) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sdk): preflight f.on inside flow(...).on(trigger, body) handlers Trigger handlers registered on a flow handle are authored bodies that receive the same Ctx.on, but the scoped checker only resolved flow(...)'s last argument and the default export. Also resolve .on(trigger, body) on a flow handle, whether chained or stored in a variable. (Cursor Bugbot, cli/check-activities.ts:90) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: khaliqgant <khaliqgant@gmail.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Relayflow Lead <lead@relayflows.local> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Summary
f.dispatch(name, input)for direct staticusechildrenVerification
Safety boundaries
usechildren and names must be unambiguoususecycles are rejectedCloud follow-up
The corresponding Cloud schema/storage/graph/UI change is prepared separately. It will pin the released Flows package after this PR is merged and published.
Note
Medium Risk
Nested execution touches budgeting, worker admission, journal DAG edges, and Cloud mirror projection; mistakes could affect replay, concurrency, or dashboard graphs, though guards and live tests target those paths.
Overview
Adds durable
f.dispatch(name, input)for children declared in a flow’s staticuseheader, replacing the previousunsupported_verbstub.Child runs stay in one journal-backed run tree: qualified step ids (
dispatch-2--run-1), shared root budget and worker capacity (scoped slots), depth cap of 3, load-time cycle / duplicate-path / ambiguous name checks, and capability attenuation (MCP/helpers; no child budgets orf.human). Successful dispatch returns a journaledDispatchResult; non-success child verdicts fail the parent step.Cloud mirror folds parent and child journals into one connected DAG (labels/
depends_on), hides internalcomplete-Nreceipts, andonRunReceiptcovers fast runs that finish before watched journal events. Docs and RFC text are updated to describe this narrower authored composition vs future public Flow Tools.Reviewed by Cursor Bugbot for commit 6eff9d7. Bugbot is set up for automated code reviews on this repo. Configure here.