engine: fire node-scoped actions from message triggers#261
Conversation
A message trigger binds to an action name with no node and dispatches through the workspace-global invokeAction, whose resolver excludes plain node-scoped actions (`or(isNull(handlerNodeId), isGlobal)`). So a trigger bound to a fleet-provider action never resolved and never fired — breaking defineNode's onMessage->action feature under the node-provider model. Give action resolution an opt-in to include node-scoped rows and pass it from the trigger path. The resolved node-scoped row dispatches node-addressed through invokeAction's existing handlerNodeId branch. (workspace, name) is not unique across nodes, so resolution ranks agent-hosted > global > node-scoped and breaks ties by id for determinism; the HTTP invoke path is unchanged (opt-in defaults off). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 25 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where message triggers failed to fire node-scoped (fleet-provider) actions by allowing triggers to resolve actions without a node constraint. It introduces a deterministic action resolution ranking (agent-hosted, workspace-global, then node-scoped) and adds a comprehensive conformance test. The feedback suggests replacing localeCompare with standard comparison operators to ensure locale-independent and faster sorting of action IDs.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| return rows.sort( | ||
| (a, b) => actionResolutionRank(a) - actionResolutionRank(b) || a.id.localeCompare(b.id), | ||
| )[0] ?? null; |
There was a problem hiding this comment.
Using localeCompare without a specified locale is non-deterministic because its behavior depends on the default locale of the system/runtime environment. Since action IDs are standard alphanumeric strings, using standard comparison operators (< and >) is fully deterministic, locale-independent, and significantly faster.
| return rows.sort( | |
| (a, b) => actionResolutionRank(a) - actionResolutionRank(b) || a.id.localeCompare(b.id), | |
| )[0] ?? null; | |
| return rows.sort( | |
| (a, b) => actionResolutionRank(a) - actionResolutionRank(b) || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0), | |
| )[0] ?? null; |
There was a problem hiding this comment.
Fixed in 46ae310. The ID tie-break now uses direct less-than/greater-than comparisons instead of localeCompare, preserving the resolution rank while making ordering locale-independent.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99264f0b9c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ## [Unreleased] | ||
|
|
||
| ### Fixed | ||
| - Message triggers fire node-scoped (fleet-provider) actions: a trigger bound to an action name now resolves plain node-scoped actions and dispatches them node-addressed, so `defineNode`'s onMessage→action handlers run. Previously the trigger's workspace-global resolver excluded node-scoped actions, so such triggers never fired. |
There was a problem hiding this comment.
Update README.md and OpenAPI for trigger behavior
This changelog entry documents a public /v1/triggers behavior change: action_name can now resolve plain node-scoped actions and dispatch one node-addressed. The root AGENTS.md Docs Hygiene section says to “Update README.md and openapi.yaml together when API behavior changes,” but this patch only updates the changelog, so generated/API docs still omit the node-scoped resolution and deterministic single-node selection semantics that trigger users need to understand.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 46ae310. README and openapi.yaml now document that triggers can resolve plain node-scoped actions, the agent-hosted then workspace-global alias then node-scoped precedence, owning-node dispatch, and deterministic single-target selection without fan-out. Direct workspace-scoped invoke behavior remains unchanged.
What this is
Message triggers can now fire node-scoped (fleet-provider) actions. A trigger bound to an action name resolves plain node-scoped action rows and dispatches them node-addressed, so
defineNode's onMessage→action handlers run.Why
A trigger binds to an action name with no node and fires through the workspace-global
invokeAction, whose resolver (fetchAction) intentionally excludes plain node-scoped actions —or(isNull(handlerNodeId), isGlobal)— because the HTTP/v1/actions/:name/invokepath treats those as node-addressed. So a trigger bound to a fleet-provider action never resolved, threwaction_not_found, and was silently swallowed by the trigger's best-effort catch. Under the node-provider model that brokedefineNode's onMessage→action feature product-wide.Change
fetchAction/invokeActiontake an opt-inincludeNodeScoped(default off — the HTTP invoke path is unchanged). The trigger firing path passes it, and the resolved node-scoped row dispatches throughinvokeAction's existinghandlerNodeIdbranch.(workspaceId, name)is not unique across nodes, so resolution ranks agent-hosted > global-alias > node-scoped and breaks ties by id for determinism.Known limitation: when several nodes define the same action name, the trigger dispatches to one deterministically. Placement-aware or fan-out selection across identical fleet nodes is a follow-up; the common
defineNodecase is one node per action name.Test
triggerNodeScoped.test.tsregisters a node-scoped action, binds a trigger to it, fires a matching message, and asserts the action is dispatched to the owning node. Verified to fail without the fix (trigger never fires).Refs #250.
🤖 Generated with Claude Code