Repository navigation
fix(hooks): route mapped wakes to configured sessions - #116109
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 29, 2026, 6:48 PM ET / 22:48 UTC. ClawSweeper reviewWhat this changesRoutes mapped gateway-hook wake events to their configured agent and session, validates those targets under hook policy, and adds regression coverage for targeted, global, deferred, and invalid mappings. Merge readinessKeep this maintainer-authored PR open for human merge review. Current Priority: P2 Review scores
Verification
How this fits togetherGateway hooks accept external HTTP events, apply configured mappings, then either enqueue a wake event or start an isolated agent run. This PR changes the wake branch so the event queue key and heartbeat target reflect the mapping's configured agent/session rather than always defaulting to the main session. flowchart LR
A[External hook request] --> B[Hook mapping]
B --> C[Target and policy validation]
C --> D[Canonical session resolution]
D --> E[System event queue]
D --> F[Heartbeat target]
E --> G[Configured agent session]
F --> G
Decision needed
Why: The code repair is narrow and matches the schema's apparent intent, but deployed configurations may have unknowingly relied on the previous fallback; accepting the corrected routing semantics is a maintainer product and compatibility decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource +98, Tests +88. Total +186 across 7 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge only after maintainers accept targeted delivery and explicit policy errors as the correct upgrade behavior for previously misrouted wake mappings, while preserving the untouched default-main path for mappings without a target. Do we have a high-confidence way to reproduce the issue? Yes, from source: current Is this the best way to solve the issue? Yes, technically: carrying the configured mapping target through existing hook policy and canonical session-key resolution is narrower and safer than adding a parallel routing path. The remaining question is whether maintainers accept the corrected upgrade semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5141a3593c4c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
2cfdf50 to
43d88a0
Compare
|
Exact-head refresh: The branch is rebased onto current Fresh proof:
The fix keeps untargeted wake behavior unchanged, canonicalizes mapped agent/session targets, applies hook policy before admission, rejects empty templated session keys, and rejects custom-session @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer decision: activating an already configured, policy-allowed hook wake The branch remains narrow to wake routing, with 90 focused tests, formatting, type-aware oxlint, |
|
Merged via squash.
|
Closes #64556
What Problem This Solves
Fixes an issue where users configuring
agentIdorsessionKeyon a mappedaction: "wake"hook would receive a successful response, but the event was silently queued for the default main session instead of the configured agent and session.Why This Change Was Made
Mapped wake routing now carries the configured target through the existing hook agent/session policy, canonicalizes the event queue key and heartbeat target together, and preserves the legacy default-main behavior for untargeted mappings.
Custom session keys remain restricted to immediate wakes because deferred heartbeat routing cannot safely drain arbitrary custom-session queues. Explicit templated session keys that render empty fail closed instead of falling through to the main session.
User Impact
Multi-agent hook mappings can reliably wake the configured agent and deliver the event to the configured session. Invalid or policy-disallowed targets return an error instead of silently routing elsewhere.
Evidence
2cfdf501c32d1a647b28ce657c3ffa31c07f540d.git diff --checkpassed.CHANGELOG.mdremains release-owned.