Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ab5db508e
ℹ️ 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".
| || workflow.subscription.trigger !== event.trigger | ||
| ) continue | ||
|
|
||
| const grant = await this.grants.get(workflow.triggerGrantId) |
There was a problem hiding this comment.
Batch grant lookups before dispatch
When a connection and trigger have multiple active workflows backed by a persistent grant store, this await performs one database/network round trip at a time, so webhook dispatch latency grows linearly with the number of matching workflows and can exceed ingress timeouts. Collect the candidate grant IDs first and use listByIds when available (with a parallel get fallback, as resolveBundleGrants already does) while retaining the fail-closed behavior before invoking the handler.
Useful? React with 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Why
Event dispatch previously matched installed workflow status, connection and trigger without rechecking the current trigger grant or subscription status. Revoked, deleted or narrowed grants could remain effective.
Implementation
Reuse the existing workflow primitive. Require active workflow and subscription; resolve the current trigger grant for each candidate; verify its status, allowed trigger, manifest, owner, grantee, connection and connector. Grant lookup errors fail closed before consumer invocation. Existing APIs and callback behavior are preserved.
Verification
Complete repository verification passed for head
1ab5db508ef1d9e1160ffa5fd156fe7b636431a3: frozen installation, typecheck, full Vitest suite and packed-release checks.Run: https://github.com/tangle-network/agent-integrations/actions/runs/34722173137
Behavioral tests cover successful dispatch, later revocation, deleted/narrowed/mismatched grants, inactive subscriptions, unrelated events, grant-store errors and consumer failures. Earlier isolated harness evidence was 7/23 passing before the fix and 23/23 after; the repository CI above supersedes the earlier local-only verification limitation.
Integration and boundaries
Companions: #303 adds messaging adapters/verifiers; tangle-network/agent-dev-container#7334 binds queued messaging work and reply effects to their current source connection; tangle-network/agent-app#579 removes single-use broker-token sharing.
Ingress authentication remains the caller's responsibility. A dispatch-time grant snapshot is not a transaction-wide revocation lease; deferred effects must recheck authority. This PR does not provision accounts, buy numbers, send live messages, publish packages or deploy services. Non-draft implementation PR; not a deployment claim.