fix: guard against None structured output in MakeAssumptionsTask and DistillAssumptionsTask#180
Merged
neoneye merged 1 commit intoPlanExeOrg:mainfrom Mar 7, 2026
Conversation
…tions PR PlanExeOrg#168 migrated make_assumptions.py and distill_assumptions.py from json.loads(chat_response.message.content) to chat_response.raw (Pydantic model). However, when a local/small model echoes the schema instead of producing valid JSON (the schema-echo failure mode seen with GLM 4.7 Flash and Qwen 3.5-35B), as_structured_llm may return None for .raw. With the old code a clear ValueError('Invalid JSON response from LLM.') was raised and logged. With the new code, None.question_assumption_list raises AttributeError with no log entry, causing a silent exit-0 that leaves no output files and no error in the pipeline log. Fix: add an explicit None-guard immediately after reading chat_response.raw in both files, raising ValueError with a descriptive message that names the model compatibility issue. This restores the explicit failure signal so operators can diagnose which model is incompatible rather than seeing a silent stop.
HejEgonBot
pushed a commit
to VoynichLabs/PlanExe2026
that referenced
this pull request
Mar 7, 2026
…ibility DeduplicationAnalysis schema (List[LeverDecision] with lever_id, classification, justification) causes schema echo in GLM 4.7 Flash and Qwen 3.5-35B. The model returns the schema description object instead of values. Fix: add LeverClassificationDecision (2 fields: classification enum + justification string). Call as_structured_llm(LeverClassificationDecision) once per lever. Code provides lever_id from context and assembles DeduplicationAnalysis in-memory. Failed levers default to keep to avoid data loss. Backward-compatible: save_raw(), save_clean(), to_dict() unchanged. Adds None-guard on chat_response.raw per PR PlanExeOrg#180 pattern.
HejEgonBot
pushed a commit
to VoynichLabs/PlanExe2026
that referenced
this pull request
Mar 8, 2026
chat_response.message.content can be None when OpenAILike returns an empty structured response. Add None guard consistent with PR PlanExeOrg#180 pattern. Also guard chat_response.raw to raise a clear error instead of AttributeError downstream.
82deutschmark
pushed a commit
to VoynichLabs/PlanExe2026
that referenced
this pull request
Mar 8, 2026
chat_response.message.content can be None when OpenAILike returns an empty structured response. Add None guard consistent with PR PlanExeOrg#180 pattern. Also guard chat_response.raw to raise a clear error instead of AttributeError downstream.
82deutschmark
pushed a commit
to VoynichLabs/PlanExe2026
that referenced
this pull request
Mar 8, 2026
chat_response.message.content can be None when OpenAILike returns an empty structured response. Add None guard consistent with PR PlanExeOrg#180 pattern. Also guard chat_response.raw to raise a clear error instead of AttributeError downstream.
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.
After PR #168 replaced json.loads() with chat_response.raw (Pydantic model), there is no guard for the case where chat_response.raw is None. When a local/small model fails structured output validation (e.g. GLM 4.7 Flash schema echo), chat_response.raw is None, causing AttributeError on .question_assumption_list with no logged error — silent exit-0 instead of a clear failure.
Fix: add explicit None check on chat_response.raw in both make_assumptions.py and distill_assumptions.py, raising a descriptive ValueError so the pipeline logs the failure properly and retry logic can handle it.
Fixes MakeAssumptionsTask silent failure observed in GLM 4.7 Flash runs. Related to commit f766959.