← Back to PRs

#7846: feat: add agentId param to webhook agent endpoint

by Bre77 open 2026-02-03 07:40 View on GitHub →
docs gateway stale
There is no way (that I can find) to route a webhook to a specific agent. This PR adds the parameter to do this so tasks can be routed directly to the right agent. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds an optional `agentId` field to the `/hooks/agent` webhook payload, normalizes it (trim/empty-to-undefined) in `normalizeAgentPayload`, documents it in `docs/automation/webhook.md`, and forwards it through the gateway hook handler to `runCronIsolatedAgentTurn` so an isolated webhook-triggered run can be routed to a specific agent configuration. <h3>Confidence Score: 4/5</h3> - This PR is largely safe to merge; changes are small and localized with tests covering normalization. - The `agentId` plumbing is straightforward (types, normalization, forwarding) and includes unit tests and docs. The main concern is the cron job object not capturing `agentId`, which could become a correctness issue if the job is ever persisted/replayed or if `runCronIsolatedAgentTurn` behavior changes. - src/gateway/server/hooks.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs