Reviewer agent loops on dozens of consecutive no-op Bash true calls
Problem
Read-only reviewers cannot use Write/Edit, but the current reporting instructions require embedding review Markdown inside shell-quoted JSON for both GitHub publication and AO bookkeeping.
Reviewers can attempt to write a temporary payload, fall back to emitting it as ordinary response text—which AO does not consume—and enter the tool-call loops analyzed below (measured evidence preserved in the thread of closed PR #5863).
Fix the reporting contract rather than adding a loop detector or enabling file writes.
Root cause (verified)
Verified from transcript re-analysis and the reviewer launch code:
- The reviewer is launched read-only (
backend/internal/adapters/reviewer/claudecode/claudecode.go): allowlist is Read/Grep/Glob plus narrow Bash (printf,gh, read-onlygit,ao review submit);Write/Edit/NotebookEdit/git push/git commitare hard-denied, headless — nothing outside the allowlist can be approved. The payload-file workaround is blocked by the Write ban (upstream #4810). - The review prompt (
backend/internal/review/prompt.go) allows exactly one hand-off: inline the entire review Markdown as a JSON string literal inside a shell-quotedprintf, piped intogh api(publication) and intoao review submit --reviews -(bookkeeping). - Long reviews full of quotes, backticks and newlines must be hand-escaped into shell-quoted JSON. When escaping fails, submission fails while the review text is already composed. The model then probes the only remaining channel (trivial Bash commands) and/or emits the JSON payload as plain assistant text, which a headless run never consumes — until a human intervenes.
- Two loop forms confirmed across hung reviewer transcripts: probe storms (fresh trivial command each time, commonly non-empty output; worst measured: 176 calls / 44 min / ~26M input tokens) and identical repeats (dozens of same-file
Readcalls with identical offset/limit). In every series the finished review was already present in the preceding assistant text. Loops also occur with thinking enabled. - Any repetition guard must tolerate legitimate retry streaks (observed: 5 consecutive
git rebase --continueretries is normal operation).
Decision: one submission to AO, breaking change
The reviewer submits only to AO through the existing ao review submit command:
printf '%s' 'Review summary in Markdown' | ao review submit \
--session worker-1 \
--run run-1 \
--verdict changes_requested \
--body - \
--comment-path src/auth.go \
--comment-line 42 \
--comment-body 'Missing authorization check.'
(--session is the canonical form for reviewer invocations; the positional form remains for interactive use.)
- Read the review body as plain Markdown from stdin.
- Accept inline findings through repeatable
--comment-path,--comment-line, and--comment-bodyflags. Pair values by occurrence; reject incomplete groups. Omit these flags when there are no inline findings. - Finding bodies are single-line by contract. Multi-line prose belongs in the review body, not in flag values; the CLI rejects multi-line
--comment-bodyvalues with a clear error instead of inviting fragile shell quoting again. - Do not parse findings out of Markdown or require model-authored JSON, temporary files, or JSON escaping in shell commands.
- The CLI performs internal serialization.
This replaces the old workflow, rather than adding another optional mode.
- No
--publishflag: submission always includes publication. - Remove legacy JSON/file submission through
--reviewsand file-valued--body. - Remove caller-supplied
--review-id; GitHub review IDs are outputs, not inputs. - Reject obsolete inputs clearly. Update prompts, help, documentation, and reviewer adapters to the new contract.
Daemon responsibilities
Use the existing submission endpoint and GitHub integration.
The daemon validates the run, persists the submitted content, publishes one GitHub COMMENT review containing the summary and inline findings, and records the returned review ID. Resolve the PR and target commit from the run.
Return the publication result through the same CLI invocation. Preserve findings in AO bookkeeping and worker feedback.
Repeated identical submissions must not create duplicate GitHub reviews. Persist publication-attempt state before the external request; report uncertain outcomes explicitly rather than blindly reposting.
Remove direct GitHub publication permissions from reviewers while retaining required read operations and AO submission. Keep Write/Edit prohibited.
No new MCP server, publication command, HTTP endpoint, generic JSON editor, or transcript-output parser.
Open question for whoever designed the review flow
This contract is a stopgap: the issue author patched the broken hand-off from the outside, as best they could, without access to the original design intent. Properly, this should be addressed to whoever designed the review submission flow itself: how do you want this to work for all users and harnesses? The day-to-day review loop in agent-orchestrator is genuinely good — the goal is to make it better, not to redefine it unilaterally. Input from the original designer or maintainers on the shape of this contract is explicitly requested before any upstream PR.
Acceptance and rollout
- Reviews with zero, one, and multiple inline findings reach GitHub and AO.
- Quotes, multiline Markdown, and code blocks survive unchanged.
- Multi-line
--comment-bodyvalues are rejected with a clear error. - Obsolete inputs fail clearly.
- Retries, concurrent submissions, daemon restarts, and GitHub failures do not lose results or silently duplicate publication.
- Verify the previously failing workflow with
Writedisabled, including another supported harness. - Validate on the fork and collect before/after evidence before opening an upstream PR. Do not claim this eliminates every possible model loop.
Working on this
@axisrow can you please specify the version of AO used here.
Closing: the root cause — the reviewer could not actually submit its review and looped on no-op commands — is addressed by the redesigned submission channel upstream: a single ao review submit --body - (stdin), with the daemon recording the result, no gh api composition and no large argv payloads.
If no-op loops reappear under the new contract, I'll open a fresh issue with the specific transcript.