Repository navigation
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6196656969
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ...(value.accountId | ||
| ? { delivery: { mode: "announce" as const, accountId: value.accountId } } | ||
| : {}), |
There was a problem hiding this comment.
Preserve deliver=false when accountId is provided
Adding job.delivery unconditionally when accountId is present changes delivery semantics for /hooks/agent: requests with deliver: false now still request announce delivery, because resolveCronDeliveryPlan treats any job.delivery.mode === "announce" as delivery requested and ignores payload.deliver. In practice, a caller that explicitly disables delivery but includes accountId (for routing context) will still send outbound messages, which is a behavioral regression and can leak outputs to channels unexpectedly.
Useful? React with 👍 / 👎.
Greptile SummaryThis PR fixes a real bug where Key findings:
Confidence Score: 3/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/gateway/server/hooks.ts
Line: 73-75
Comment:
**`deliver: false` silently ignored when `accountId` is present**
The spread unconditionally sets `delivery.mode = "announce"` whenever `accountId` is provided. In `resolveCronDeliveryPlan`, once `hasDelivery` is `true` the `payload.deliver` field is completely bypassed and `requested` is always `true` (`requested: resolvedMode === "announce"`).
This means a caller who sends `{ deliver: false, accountId: "x", channel: "whatsapp" }` will still get delivery after this fix, silently contradicting their explicit `deliver: false` intent.
A safer approach respects the original `deliver` flag:
```suggestion
...(value.accountId
? {
delivery: {
mode: value.deliver !== false ? ("announce" as const) : ("none" as const),
accountId: value.accountId,
},
}
: {}),
```
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 6196656 |
| ...(value.accountId | ||
| ? { delivery: { mode: "announce" as const, accountId: value.accountId } } | ||
| : {}), |
There was a problem hiding this comment.
deliver: false silently ignored when accountId is present
The spread unconditionally sets delivery.mode = "announce" whenever accountId is provided. In resolveCronDeliveryPlan, once hasDelivery is true the payload.deliver field is completely bypassed and requested is always true (requested: resolvedMode === "announce").
This means a caller who sends { deliver: false, accountId: "x", channel: "whatsapp" } will still get delivery after this fix, silently contradicting their explicit deliver: false intent.
A safer approach respects the original deliver flag:
| ...(value.accountId | |
| ? { delivery: { mode: "announce" as const, accountId: value.accountId } } | |
| : {}), | |
| ...(value.accountId | |
| ? { | |
| delivery: { | |
| mode: value.deliver !== false ? ("announce" as const) : ("none" as const), | |
| accountId: value.accountId, | |
| }, | |
| } | |
| : {}), |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/gateway/server/hooks.ts
Line: 73-75
Comment:
**`deliver: false` silently ignored when `accountId` is present**
The spread unconditionally sets `delivery.mode = "announce"` whenever `accountId` is provided. In `resolveCronDeliveryPlan`, once `hasDelivery` is `true` the `payload.deliver` field is completely bypassed and `requested` is always `true` (`requested: resolvedMode === "announce"`).
This means a caller who sends `{ deliver: false, accountId: "x", channel: "whatsapp" }` will still get delivery after this fix, silently contradicting their explicit `deliver: false` intent.
A safer approach respects the original `deliver` flag:
```suggestion
...(value.accountId
? {
delivery: {
mode: value.deliver !== false ? ("announce" as const) : ("none" as const),
accountId: value.accountId,
},
}
: {}),
```
How can I resolve this? If you propose a fix, please make it concise.…law#43866) HookAgentPayload was missing the accountId field, causing normalizeAgentPayload() to silently drop it. Multi-account channel delivery (especially WhatsApp) would fail because the delivery target couldn't identify the correct connection. Added accountId to HookAgentPayload and threaded it through dispatchAgentHook into the CronJob delivery config. Co-authored-by: Copilot <[email protected]>
|
Closing to manage active PR count. Will reopen when slot is available. |
Summary
/hooks/agentsilently dropsaccountIdfrom payloads, causing multi-account channel delivery to fail silently (caller gets success but message never sent)./hooks/agentwith multi-account WhatsApp or any channel requiring accountId are affected.accountIdtoHookAgentPayloadtype and threaded it through normalization into CronJob delivery config.Change Type
Scope
Linked Issue/PR
Security Impact
Repro + Verification
Steps
Expected
Actual (before fix)
Evidence
Human Verification
Compatibility / Migration
Failure Recovery
Risks and Mitigations
None
This PR was AI-assisted (fully tested with pnpm build/check/test).