Skip to content

fix(work-item-pipeline): harden parse_judge_decision against malformed judge replies - #516

Merged
getappz merged 1 commit into
masterfrom
fix/harden-judge-decision-parser
Aug 16, 2026
Merged

fix(work-item-pipeline): harden parse_judge_decision against malformed judge replies#516
getappz merged 1 commit into
masterfrom
fix/harden-judge-decision-parser

Conversation

@getappz

@getappz getappz commented Aug 16, 2026

Copy link
Copy Markdown
Owner

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_loop step 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

  • Prefer an explicit fenced code block (```json ... ```, or a bare fence) when present — an unambiguous boundary the judge only produces on purpose.
  • Otherwise, scan forward from the first { 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.
  • A genuine parse failure — including syntactically valid JSON missing a required field — still returns Err, retried by the step's own RetryPolicy exactly 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 missing action (the exact 2026-08-15 production repro), and an empty reply. All 10 tests in the module pass; cargo fmt/clippy clean.

…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
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

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.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9c4aa906-f080-4c01-9bb8-632887230d87

📥 Commits

Reviewing files that changed from the base of the PR and between 7eae8ff and 263d551.

📒 Files selected for processing (1)
  • src/work_item_pipeline.rs

Comment @coderabbitai help to get the list of available commands.

@getappz
getappz merged commit 2177723 into master Aug 16, 2026
17 checks passed
@getappz
getappz deleted the fix/harden-judge-decision-parser branch August 16, 2026 04:37
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