Skip to content

fix(agent-review): fail stalled inference requests sooner; explain environment denials - #15

Merged
egparedes merged 5 commits into
mainfrom
fix/v0.1.1-validation-findings
Nov 17, 2026
Merged

egparedes merged 5 commits into
mainfrom
fix/v0.1.1-validation-findings

Conversation

@egparedes

@egparedes egparedes commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes from the v0.1.0 release validation, for v0.1.1. No new permission, input, ceiling, endpoint, harness pin or AWF version: not a breaking change under the release policy.

Stalled inference requests (both adapters)

In the validation, keyed reviews took 17 to 19 of the 20 minutes of harness_timeout_minutes: requests got no response headers for exactly 300 s, were retried, and a later one was answered.

Cause: the 300 s is each harness's own default, not AWF's API proxy (which has no such timeout). opencode 2.2.7 waits 300 s for response headers (headerTimeout) and 900 s for the next event of a stream (chunkTimeout); Pi 1.5.2 waits 300 s for either (httpIdleTimeoutMs). Both retry a timed-out request 3 times (after 2, 4 and 8 s). Pi's count is a setting; opencode's is fixed at 3 timeouts per run.

The audit logs of the validation also show that the one slow request that succeeded waited 185 s for its headers, after two requests had been given up at 300 s each: about 13 minutes without any answer at the start of the run. That looks like a service that holds requests, not like single lost requests. No client timeout shortens such a wait, and a shorter one must not end runs that succeed today. So the waits are barely shorter than before, on purpose:

  • opencode: headerTimeout stays 300 s, now set explicitly; chunkTimeout goes from 900 s to 300 s. The chunk timeout also covers the wait between the headers and the first event, where a service that queues an accepted request, or a model that thinks before its first token, is silent as well, so it gets the same value as the header wait. With a fixed 3 retries a run can wait 4 × the timeout; lower values would have ended the validation's reviews instead of letting them finish.
  • Pi: httpIdleTimeoutMs goes from 300 s to 240 s (one setting for headers and for the next chunk), and the retries from 3 to 5. Six attempts exceed the harness time limit, so a run waits for a silent service as long as before.
  • A stream that keeps sending is never cut.

In short: a stream that stops is recovered (in opencode it used to cost 900 s, most of the time limit). A long silence before the first response headers is not fixed: such a review is still slow, and a service that answers nothing for more than about 15 minutes still ends in the "no review" warning. That silence is the service holding requests: it is to be raised with the service's operators (one possible cause, not verified, is a rate limit of the key), not worked around in code; the only setting here that would help is a higher time limit, a raised ceiling and so a breaking change.

Caller-visible: a Pi run that hits stalls makes more requests than before. Each retry counts against requests_per_hour. One that ends before any response does not count against max_turns; whether a stream cut after its headers does was not checked.

Tests: agent-review/tests/test-harness-stall.sh runs the pinned harnesses against a local server that stalls (tests/fake_inference.py). Six cases per harness: no response headers; a stream that stops; a slow stream that must not be cut; a request answered only after 185 s; a stream whose first event comes 185 s after its headers; and 1050 s of silence, more than Pi's default of 3 retries can sit out. 12 of 12 cases pass with the real values (and with --fast). The two cases added in review fail against the values they guard: with opencode's chunk timeout at 120 s, the first-event case ends without a review after four attempts of 120 s (exit 1 after 500 s); with Pi's retries at 3, the silence case gives up after four attempts (exit 2 after 976 s). The other ten cases pass there too

The test executes harness code outside any sandbox, so it stays out of the self-test on purpose (the adapters job only installs the harnesses). Run it locally when an adapter's timeouts or pin change: bash agent-review/tests/test-harness-stall.sh (about 18 minutes), or with --fast (about a minute, every timeout and retry delay divided by 30); opencode or pi selects one harness. It needs jq, npm, curl and python3.

Message after an environment denial

When the environment refused the keyed review job (a dispatch from a branch other than the default one, say), publish warned that "the agent produced no review" and pointed at sandbox logs that do not exist.

  • Both review jobs now set a started output in their first step. publish passes it, the job's result and the keyed flag to the new publish-comment explain, which words the warning from those values alone (no token, nothing from the review).
  • The cases: a failure inside the sandbox (the message it had); a review job that failed or was cancelled before the sandbox ran; a job that reported no step; a job cancelled before it reported a step.
  • "Reported no step" means that the job never got a runner or that its runner was lost; the two cannot be told apart from publish. For the keyed job the message names the environment and its protection rules as the usual cause, and says that the key was not used only for that case.
  • The workflow's result output is unchanged (missing).
  • The structure test pins the first step, the output and the arguments (started_signal_problems).

Documentation

  • Troubleshooting: the "no review" causes, and what the adapters do about stalled requests and what they cannot.
  • Invariant 5: exactly which control characters are dropped (C0 except tab and newline, and DEL; C1 passes, and GitHub's Markdown render API shows it as U+FFFD).
  • "What remains risky": a base link to an uncovered path, Markdown-level hiding and bot command lines are accepted risks, each with its reason. The bot-command item adds that publish posts with github.token, whose events start no workflow runs, so only webhook-based bots could react.
  • Release checklist item 3.11 and the status note: invariant 6 was run end to end with a file named in the addendum.

Invariants

None is weakened. Invariant 3 (after the sandbox: no token, fixed shell) and 12 (permissions) are untouched: the new step runs first in the review jobs and writes one constant output; explain runs in publish without a token. Invariant 13 holds for the new call (/usr/bin/python3 -I -S -B, PATH: /usr/bin:/bin).

Evidence

From a separate test caller, through a dispatch-only workflow pinned to commits of this branch (c366404, 80a822a, then 430fb19). The commits after 430fb19 change opencode's chunk timeout (120 s to 300 s), the wording of the "no step" messages, tests and documentation; no live run was repeated for them; run ids are in that repository.

  • Environment denial: run 44067261673, a keyed dispatch from a non-default branch. review failed with 0 steps; the warning named the environment agent-review and its protection rules (at commit c366404; the wording has since been made exact about a lost runner, which is unit-tested).
  • Failure before the sandbox: run 44068631568 (a wrong addendum path): "the 'review-keyless' job failed before the sandbox ran (job result 'failure')".
  • Keyed dry runs with audit logs, 3 of a budget of 3: Pi at the final values (240 s, 5 retries), run 44078309637 at commit 430fb19 (review 39 s, 8 calls, 0.8 to 1.0 s to headers); opencode, run 44069604673 at 80a822a (review 111 s, 6 calls, at most 20 s to headers; with a chunk timeout of 120 s, since raised to 300 s); an earlier Pi run, 44068636270 at 80a822a (120 s, 9 retries; review 30 s). The service did not stall, so these show no regression; the stall behaviour is shown by the offline test.
  • Invariant 6 on the released commit 4ed4519, label path, stub: a PR changing the file the addendum names (run 44067263503) and one replacing it with a symlink to an uncovered path (run 44067652806). Both log "1 rule file(s) and 1 file(s) named by the addendum are their base versions" and post the comment: the reset restores the base file, so the fail-closed post-condition does not fire; it is covered by the offline tests.
  • Local: pytest (1100 passed), mypy, the script suites, the structure test, pre-commit.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.2 noreply@anthropic.com

egparedes and others added 5 commits November 17, 2026 11:38
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…rding

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…t locally

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…stall test covers the first event and Pi's retries

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@egparedes
egparedes marked this pull request as ready for review November 17, 2026 12:48
@egparedes
egparedes merged commit 30cd7db into main Nov 17, 2026
16 checks passed
@egparedes
egparedes deleted the fix/v0.1.1-validation-findings branch November 17, 2026 12:48
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.

1 participant