fix(work-item-pipeline): harden parse_judge_decision against malformed judge replies - #516
Conversation
…d judge replies
The SDD-loop judge parser found the first '{' and last '}' in the
whole reply and parsed the slice between them. Reproduced live
(item #478, 2026-08-15): trailing commentary containing its own
unrelated braces, or a JSON object missing a required field,
either corrupted the extracted span or hard-failed the step.
Prefer an explicit fenced code block (```json ... ```) when
present, and otherwise scan forward from the first '{' for its own
matching '}' (tracking nesting depth and skipping brace-like bytes
inside string literals) instead of blindly spanning to the last
'}' anywhere in the reply. A genuine parse failure -- including
syntactically valid JSON missing a field -- still returns Err,
retried by the step's own RetryPolicy as before.
Agentflare-Agent: claude-code_2-1-233_agent
Agentflare-Branch: fix/harden-judge-decision-parser
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 9 minutes Limit details: You’ve used all 1 included review currently available under your plan. You completed 75 included PR reviews in the past 7 days; at that activity level, included reviews refill at 1 review per hour. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Comment |
What
parse_judge_decision(src/work_item_pipeline.rs) is the SDD-loop's judge-reply parser. It found the first{and the last}anywhere in the reply and parsed the slice between them.Reproduced live in this session (item #478, 2026-08-15) and again during a redispatch smoke-test today: a judge reply missing a required field hard-failed the
sdd_loopstep outright, and the same naive span-finding is vulnerable to trailing commentary that contains its own unrelated{...}-shaped text (e.g. "uses the {config} pattern"), which would corrupt the extracted slice.Closes item #479.
Fix
```json ... ```, or a bare fence) when present — an unambiguous boundary the judge only produces on purpose.{for its own matching}, tracking nesting depth and skipping brace-like bytes inside JSON string literals, instead of spanning to the last}anywhere in the reply.Err, retried by the step's ownRetryPolicyexactly as before. No new retry mechanism; this is purely about correctly extracting the candidate JSON.Tests
6 new cases added to
judge_decision_tests: fenced block (with and without a language tag), trailing prose with unrelated braces, a brace inside a string value, a syntactically valid object missingaction(the exact 2026-08-15 production repro), and an empty reply. All 10 tests in the module pass;cargo fmt/clippyclean.