Loosen quote matching, unify JSON extraction, and add subagent visibility - #284
Merged
openshift-merge-bot[bot] merged 4 commits intoSep 9, 2026
Conversation
…parse_json_output helper - validate_evidence: normalize \" → " and Unicode smart quotes (U+201C/U+201D → ", U+2018/U+2019 → ') before the quote-in-line check to eliminate false negatives from cosmetic quoting differences. - Add public parse_json_output(text) that tries json.loads then falls back to _try_extract_json_array, returning (data, errors) tuple. - run-doctor.py _analyze_single_job: replace bare json.loads with parse_json_output so the save path uses the same extraction logic as the validation hook. - run-doctor.py _run_claude_session: add --forward-subagent-text flag (safe because _extract_job_stats already filters by parent_tool_use_id). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Advanced Run ID: Comment |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pmtk, redhat-chai-bot The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four targeted fixes addressing diagnostics issues observed in CI Doctor run
2097218638762217472.
Changes
1. Normalize escape sequences in quote matching (
validate-rca-output.py)validate_evidence()already normalizes whitespace and case before comparingagent-cited quotes against log lines, but does not normalize escape sequences.
This causes false "quote not found" warnings when the agent cites
\"probe failed\"but the log line has"probe failed"(or vice versa).Added normalization for:
\"→"(backslash-escaped double quotes)\u201c/\u201d→"(Unicode left/right double quotes)\u2018/\u2019→'(Unicode left/right single quotes)2. Add
parse_json_output()helper (validate-rca-output.py)New public function that tries
json.loads()first, then falls back to_try_extract_json_array()for prose-wrapped output. Returns a(parsed_data, errors)tuple.This consolidates the extraction logic that was previously split between the
hook (which used
_try_extract_json_arrayfallback) andrun-doctor.py(which used bare
json.loadswith no fallback).3. Use
parse_json_output()inrun-doctor.pyReplaced the bare
json.loads(final_text)in_analyze_single_job()with thenew
parse_json_output()helper. This fixes two issues:json.loads()failed and the output file was never written — even though_try_extract_json_array()would have found valid JSON. Jobs2097173349762338816and2097173364866027520were lost this way._try_extract_json_array), but the save path rejected it (via barejson.loads). Now both use the same extraction logic.4. Add
--forward-subagent-textto claude invocation (run-doctor.py)Adds subagent text and thinking blocks to the parent transcript with
parent_tool_use_idset. This is safe because_extract_job_stats()alreadyfilters by
parent_tool_use_idwhen counting parent-level turns.Benefits:
"1 turn" for the orchestrator)
Testing
.pyfiles compile cleanly (py_compile)plugins/microshift-ci/scripts/also compileparse_json_outputtested with: valid JSON array, prose-wrapped JSON,non-JSON text, and dict (non-array)
validate_evidencequote normalization tested with: escaped double quotes,smart double quotes, and smart single quotes
AI-generated. Review for accuracy.
@pmtk requested in Slack thread