Add field_validator for Lever.options to handle stringified arrays#142
Merged
Merged
Conversation
Local LLMs sometimes return the options field as a JSON string instead of a native list. This validator transparently parses stringified arrays, preventing ValidationError crashes in IdentifyPotentialLeversTask.
This was referenced Mar 6, 2026
huangyingting
pushed a commit
to repomesh/PlanExe
that referenced
this pull request
Jun 26, 2026
Resolves Dependabot security alerts in worker_plan/pyproject.toml by bumping to the first stable patched release of each package: - aiohttp 3.13.5 -> 3.14.1 (alerts PlanExeOrg#152,PlanExeOrg#153,PlanExeOrg#156-PlanExeOrg#164) - tornado 6.5.4 -> 6.5.7 (alerts PlanExeOrg#113,PlanExeOrg#114,PlanExeOrg#136,PlanExeOrg#155,PlanExeOrg#165,PlanExeOrg#166,PlanExeOrg#171) - python-multipart 0.0.22 -> 0.0.32 (alerts PlanExeOrg#142,PlanExeOrg#149,PlanExeOrg#167-PlanExeOrg#170) - urllib3 2.6.3 -> 2.7.0 (alerts PlanExeOrg#150,PlanExeOrg#151) - marshmallow 3.24.2 -> 3.26.2 (alert PlanExeOrg#81), staying on 3.x to avoid the breaking 4.x major transformers alert PlanExeOrg#137 is excluded: its only fix is the 5.x major line and the vulnerable Trainer class is never imported by PlanExe (handled separately). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Problem
Local LLMs (e.g. Qwen, GLM via LM Studio) sometimes return the
optionsfield as a JSON-encoded string ("[\"opt1\", \"opt2\"]") instead of a native list. This causes a PydanticValidationErrorinIdentifyPotentialLeversTask, crashing the pipeline.Fix
Added a
@field_validator('options', mode='before')to theLevermodel that transparently parses stringified JSON arrays before validation.Scope
worker_plan/worker_plan_internal/lever/identify_potential_levers.py