Skip to content

fix(receiver): wait for a slot before refusing a delivery - #95

Open
tbhb-agent wants to merge 2 commits into
mainfrom
agent/gm-rec-r1-codex
Open

tbhb-agent wants to merge 2 commits into
mainfrom
agent/gm-rec-r1-codex

Conversation

@tbhb-agent

Copy link
Copy Markdown
Collaborator

Why

In 17 hours the receiver answered 503 to 395 deliveries because all 16 body slots were busy. GitHub doesn't retry a failed delivery, and nothing repairs lost workflow job or check run events. Bursts from one CI run arrive in the same millisecond. A short wait clears most of them.

Behavior change

  • A delivery waits up to 8 seconds for a free slot before the receiver reads its body. The wait stays under GitHub's 10-second delivery timeout.
  • If no slot frees up, the receiver answers 503 with Retry-After and logs at error level with the delivery ID and event.
  • If the request context ends during the wait, the receiver doesn't read or store the body.
  • Repeated log keys became constants, and the log output stays the same.

Decisions

  • The wait is the constant slotWait, set to the 8 seconds from the task.
  • MaxInFlight and the body limit keep their values, so the body memory bound is unchanged.

Deviations from the task

None.

Needs human judgment

Whether to spool bodies to disk later, to free a slot while a body arrives. This change leaves that out.

Risk

Tier 1. The signature check and the store write are unchanged. Under load a connection can wait up to 8 seconds longer.

Verification

  • bazelisk test //internal/receiver/... passes in a clean worktree.
  • pr_size reports 195 of 400 code lines.

Human steering

None so far.

Opened-by: LLM effort=medium;harness=claude-code:2.1.330;model=anthropic:claude-sonnet-5-5;session=sha-256-64:6507fa80a17e0653;surface=cli
Generated-by: LLM effort=high;harness=codex:0.171.0;model=openai:gpt-6.2-sol;session=sha-256-64:f4928d57ebb9943e;surface=exec
Assisted-by: LLM effort=medium;harness=claude-code:2.1.330;model=anthropic:claude-sonnet-5-5;session=sha-256-64:6507fa80a17e0653;surface=cli

Generated-by: LLM effort=high;harness=codex:0.171.0;model=openai:gpt-6.2-sol;session=sha-256-64:f4928d57ebb9943e;surface=exec
Comment thread internal/receiver/receiver.go Fixed
Comment thread internal/receiver/receiver.go Fixed
Comment thread internal/receiver/receiver.go Fixed
Comment thread internal/receiver/receiver.go Fixed
Generated-by: LLM effort=medium;harness=claude-code:2.1.330;model=anthropic:claude-sonnet-5-5;session=sha-256-64:6507fa80a17e0653;started_at=2026-11-15T17:24:44Z;surface=cli

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants