Repository navigation
fix(hooks): avoid false admission timeouts during runtime reload - #128975
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 11:34 PM ET / August 25, 2026, 03:34 UTC. ClawSweeper reviewWhat this changesMoves hook HTTP success from agent-runner entry to canonical session/global placement admission so model-runtime preparation during reload does not cause a false admission timeout. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep this PR open: current main still reports admission before writer and placement validation, while this patch moves the signal to the authoritative placement boundary. No blocking correctness defect was found; the documented public HTTP-success milestone needs normal maintainer acceptance before merge. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherGateway hook requests start an isolated agent turn and wait for an admission signal before replying. The embedded runner acquires session/global placement, then prepares the model runtime and enters the agent runner. flowchart LR
A[Hook HTTP request] --> B[Gateway hook handler]
B --> C[Isolated cron turn]
C --> D[Embedded runner lanes]
D --> E[Canonical placement admission]
E --> F[HTTP success response]
E --> G[Model runtime preparation]
G --> H[Agent runner entry]
Decision needed
Why: The branch deliberately changes a documented Gateway response milestone; source supports the repair, but accepting that public contract is maintainer intent. Before merge
Agent review detailsSecurityNone. PR surfaceSource -3, Tests +48, Docs 0. Total +45 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the placement-owned signal after confirming that the documented earlier HTTP 200 acknowledgement is the intended public hook contract, while retaining the abort fence and runner-entry fallback. Do we have a high-confidence way to reproduce the issue? Yes — holding remote placement after lane dequeue reproduces the source-proven premature waiting:false signal on current main; the branch’s focused tests encode that ordering. Is this the best way to solve the issue? Yes — placement admission owns the fact the hook needs, so moving the existing signal there is narrower and safer than extending timeouts or adding a downstream workaround. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 70e6aa135a54. 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
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where authenticated agent hooks could return
503 hook agent run did not start before admission timeoutduring Gateway startup or hot reload even after the run had acquired its canonical session lane,hook-dispatchlane, and placement owner. The later prepared-model-runtime wait was incorrectly counted as admission time, so valid work was aborted and ended with paired lane errors plusmessage processed ... outcome=error.Why This Change Was Made
The embedded lane controller now publishes its existing
waiting: falsefact exactly once at authoritative placement admission, after lifecycle/writer validation and run-context claim. Hook HTTP admission consumes that owner-produced fact while retaining runner-entry fallback for direct execution paths; the 15-second deadline, typed409/502/503failures, idempotency, same-session ordering, abort fence, and shared cron/hook capacity remain unchanged.AI-assisted: yes.
User Impact
Post-restart and hot-reload hook catch-up no longer fails merely because the admitted run is waiting for the replacement model runtime.
200now means canonical session/global placement admission succeeded; genuine pre-admission failures remain visible and timed-out work still cannot start later.Evidence
waiting: falsebefore placement; the HTTP regression remained pending after placement instead of returning200.node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/lane-controller.queue-liveness.test.ts src/agents/embedded-agent-runner/run/lane-controller.group-wait.test.ts src/agents/embedded-agent-runner/run/lane-controller.lifecycle.test.ts src/agents/embedded-agent-runner/run/lane-controller.writer-claim.test.ts src/agents/session-placement-admission.test.ts src/cron/service/timer.timeout-watchdog.test.ts src/gateway/server.hooks-admission.test.ts src/gateway/server/hooks.agent-trust.test.ts— 85 tests passed.node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/gateway-hook-concurrency.e2e.test.ts— real isolated Gateway concurrency/fairness E2E passed.node scripts/check-changed.mjs -- docs/automation/cron-jobs.md docs/gateway/configuration-reference.md src/agents/embedded-agent-runner/run/lane-controller.queue-liveness.test.ts src/agents/embedded-agent-runner/run/lane-controller.ts src/gateway/server.hooks-admission.test.ts src/gateway/server/hooks.ts— selected core, core-test, and docs gates passed.