#22061: [Bug]: return 200 for hook invocations
gateway
size: XS
Cluster:
Gateway and Hooks Enhancements
## Summary
Fixes #22036 by returning HTTP 200 for webhook invocations while keeping async job dispatch unchanged.
## Changes
- Updated `src/gateway/server-http.ts` hook handling to respond with status 200 for:
- `/hooks/agent`
- mapped hook action dispatches that call `dispatchAgentHook`
- Kept run payload behavior (`{ ok: true, runId }`) the same so existing consumers still receive run context.
## Validation
- `pnpm test:e2e src/gateway/server.hooks.e2e.test.ts`
## Confidence Score
- 10/10 confidence.
- Change is narrowly scoped to HTTP response codes and directly matches the issue report that integrations expect 200.
- Behavior remains async; only response status and semantics changed.
- Regression coverage updated in existing hook e2e suite to pin new expected status.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Changed webhook invocation responses from HTTP 202 (Accepted) to 200 (OK) to align with webhook consumer expectations. The async dispatch behavior remains unchanged - hooks still execute asynchronously and return a `runId` immediately. All test assertions updated to reflect the new status code.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The change is narrowly scoped to HTTP status codes only. The async behavior and response payload remain identical, so existing consumers are unaffected. Comprehensive test coverage validates the change across all webhook endpoints.
- No files require special attention
<sub>Last reviewed commit: 3429e81</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#23447: Gateway: harden hook ingress content-type validation
by bmendonca3 · 2026-02-22
68.4%
#8084: fix(plugins): wire up message_sending hook in outbound delivery
by lailoo · 2026-02-03
67.7%
#10679: fix(hooks): invoke gateway_start and gateway_stop in lifecycle
by yassinebkr · 2026-02-06
67.6%
#20541: fix(hooks): clear internal hooks before plugins register
by ramarnat · 2026-02-19
67.3%
#13415: fix(hooks): bridge agent_end events to internal/workspace hooks
by mcaxtr · 2026-02-10
67.2%
#8121: fix(gateway): remove query parameter token support for hooks
by yubrew · 2026-02-03
67.2%
#13471: fix: security audit distinguishes internal hooks from external webh...
by jarvisz8 · 2026-02-10
66.6%
#19922: feat(hooks): add message:received and message:sent hook events
by NOVA-Openclaw · 2026-02-18
66.4%
#23765: Gateway hooks: enforce JSON content type and strict payload keys
by bmendonca3 · 2026-02-22
66.3%
#13178: fix: dedup mapped hook dispatches to prevent Gmail Pub/Sub retries
by striking · 2026-02-10
66.2%