fix: recover wrapped classifier JSON for phase 8 demo#15
Merged
Galzi1 merged 2 commits intoApr 11, 2026
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Review Summary by QodoRecover wrapped classifier JSON from model responses
WalkthroughsDescription• Harden classifier JSON parsing to recover wrapped/fenced model output - Extract JSON from bare JSON, markdown fenced blocks, and prose-wrapped responses - Add regex-based fence detection and multi-candidate parsing strategy • Add regression tests for fenced and prose-wrapped JSON responses • Update classification error handling to use new robust parser Diagramflowchart LR
ModelOutput["Model output<br/>bare/fenced/prose"] -->|_parse_classification_response| JSONExtractor["Extract JSON<br/>from candidates"]
JSONExtractor -->|fence regex| FencedJSON["Fenced code block"]
JSONExtractor -->|raw decode| ProseJSON["Prose-wrapped JSON"]
JSONExtractor -->|direct parse| BareJSON["Bare JSON"]
FencedJSON --> ValidDict["Valid dict"]
ProseJSON --> ValidDict
BareJSON --> ValidDict
ValidDict -->|return| Classifier["Classifier uses<br/>parsed result"]
File Changes1. src/github_pr_kb/classifier.py
|
Code Review by Qodo
1.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
This PR fixes the classifier failure mode exposed by the latest Phase 8 demo attempt and updates the Phase 8 demo tracking docs with the current live status.
Why
The fresh demo run from
github-pr-kb-demoreproduced the same blocker as the earlier content-demo attempt: the workflow reachedclassify, but model responses were not always bare top-level JSON, so classification fell through to repeated parse failures and no KB article was published.What changed
PRClassifierto recover JSON objects from:jsonblocks,.planning/phases/08-github-action-readme/08-DEMO-COMPLETE.mdwith:#3merged status,24266078977outcome,github-pr-kbValidation
python -m ruff check src tests.venv\Scripts\python.exe -m pytest tests\test_classifier.py -q.venv\Scripts\python.exe -m pytest tests -qPhase 8 context
This branch is intentionally based on
gsd/phase-08-github-action-readme, notmain, so the PR describes the incremental fix and status update on top of that Phase 8 workstream.