Skip to content

fix: Gemini 3.1 Flash Lite JSON robustness and structured output coercion - #139

Closed
82deutschmark wants to merge 18 commits into
PlanExeOrg:mainfrom
VoynichLabs:fix/gemini31-json-repair
Closed

fix: Gemini 3.1 Flash Lite JSON robustness and structured output coercion#139
82deutschmark wants to merge 18 commits into
PlanExeOrg:mainfrom
VoynichLabs:fix/gemini31-json-repair

Conversation

@82deutschmark

Copy link
Copy Markdown
Collaborator

Summary

Fix structural issues with Gemini 3.1 Flash Lite JSON output that cause task failures in PlanExe pipeline. Implements centralized JSON repair utilities, Pydantic field validators for type coercion, and robust error recovery paths.

Bugs Fixed

  1. EnrichLeversTask — Gemini 3.1 returns JSON with trailing commas and incorrect top-level keys. Added schema validation and centralized JSON repair utility.

  2. GovernancePhase2BodiesTask — Scalar fields (decision_rights, meeting_cadence) returned as lists instead of strings. Fixed with Pydantic field_validator coercion.

  3. PreProjectAssessmentTask — Expert feedback items missing or malformed. Fixed via validator patches and structured output guards.

  4. IdentifyDocumentsTask — LLM interaction failures with no fallback path. Added JSON repair wrapper, fallback lane support, and artifact logging for diagnostics.

Changes

  • Added centralized JSON repair utility for common Gemini 3.1 malformations
  • Pydantic field validators for scalar/list type coercion across tasks
  • JSON repair wrapper for IdentifyDocumentsTask with artifact logging
  • Acceptance tests for trailing-comma JSON recovery

Testing

Full pipeline acceptance run (Gemini 3.1 Flash Lite) completes with 63 tasks, 0 failures. All repair paths exercised and validated.

@82deutschmark

Copy link
Copy Markdown
CollaboratorAuthor

Closing per Simon's review. Splitting into focused PRs: PR #142 (options validator) and a separate json_repair PR (coming next). Addresses all feedback: no hardcoded models, no LLMExecutor state mutation, proper deps, with tests.

Sign up for freeto 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

@82deutschmark