fix(media-understanding): parse nested Gemini output JSON#96432
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 25, 2026, 3:43 AM ET / 07:43 UTC. Summary PR surface: Source +103, Tests +100. Total +203 across 2 files. Reproducibility: yes. at source level: current main slices from the last Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the shared extractor fix after maintainer review, keeping Gemini JSON recovery in the media-understanding common helper rather than duplicating it in the runner. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main slices from the last Is this the best way to solve the issue? Yes. The media-understanding common extractor is the narrow owner boundary for this runtime path; moving the fix into the runner or reusing the broader agent CLI parser would be a less local ownership fit. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 31e941c3fc32. Label changesLabel justifications:
Evidence reviewedPR surface: Source +103, Tests +100. Total +203 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
0404471 to
cb83c3e
Compare
cb83c3e to
cfc2963
Compare
|
Merged via squash.
|
What Problem This Solves
extractGeminiResponseparsed the last JSON object in noisy CLI output by takinglastIndexOf("{"). That fails for ordinary nested JSON payloads because the last{may belong to an inner object such asusagerather than the top-level response object.In that case the extractor returns
nulleven though the provider output contains a validresponsefield.Why This Change Was Made
The extractor now scans candidate
{positions from right to left until it finds a full JSON object that parses. This keeps the noisy-output behavior while allowing nested objects in the final provider payload.User Impact
Gemini-style media-understanding CLI output with nested metadata can still yield the response text instead of dropping the provider result.
Evidence
Live behavior proof from this branch:
Focused validation:
git diff --checkproduced no output.AI-assisted: OpenAI Codex helped inspect the media-understanding output extractor and add focused regression coverage.