Repository navigation
Drop agent-run events the server refuses instead of retrying forever - #1163
alexeyzimarev merged 2 commits into
Conversation
The queue has one consumer, so a head event the server never accepts stalled every later event on the daemon until restart, and the queue is in memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
PR Summary by QodoPrevent refused agent-run events from blocking the delivery queue
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1.
|
A 401 fails every queued event alike and clears on login, so dropping the head after the bound would lose an AgentRunStopped and leave the run live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-3060 — no GitHub issue: this was filed in Linear directly, and opening one here would import a duplicate back into Linear.
What & why
The daemon's agent-run event queue retried any failed POST forever with one consumer, so a single event the server refuses (today: the policy snapshot/decision types an older server answers with 500) blocked every later
AgentRunStopped/AgentRunHeartbeaton that daemon until restart. Delivery now mirrorsHookSpool.IsRetryable: a non-retryable status is logged once and dropped, and a retryable answer (5xx, 408, 429) is retried with the same backoff for at most 15 answers (~5 min) before the event is dropped.Where to look
A 401 and a transport failure (no response) retry without spending that bound — they say nothing against the event, fail everything behind it too, and clear on their own (login, reconnect). The bearer token is now set per request rather than on the shared client's default headers, which the drain and the shutdown post both wrote.
Verification
AgentRunEventQueueTests: 7/7 pass (400/404/413 dropped, 503 recovered in order, 500 dropped after the bound, 401 and transport failures uncounted); each guard mutated in turn turns its test red.KCAP_DAEMON_IDset in the local shell, and an orchestrator timing test that passes in isolation.🤖 Generated with Claude Code