Fix JSON schema flow state kickoff inputs#6325
Conversation
Allow required JSON schema state fields to be supplied by kickoff inputs
instead of requiring every field to exist in state.default before
runtime.
Example: a flow with required lead_name and no state.default can now run
with kickoff inputs={"lead_name": "Ada Lovelace"}.
There was a problem hiding this comment.
Summary: This PR changes JSON schema flow state construction to permit missing required state fields at initialization when they are expected to be provided later via kickoff inputs; no exploitable security vulnerabilities were identified.
Risk: Low risk. The change affects internal state validation behavior and does not introduce a new public endpoint, authentication/authorization boundary, external integration, or direct handling of sensitive data.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughFlow state construction now falls back to unvalidated model construction when validation fails only because required fields are missing. Tests add a json_schema flow fixture and verify required state values can be supplied through ChangesJSON schema state fallback
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Allow required JSON schema state fields to be supplied by kickoff inputs instead of requiring every field to exist in state.default before runtime.
Example: a flow with required lead_name and no state.default can now run with kickoff inputs={"lead_name": "Ada Lovelace"}.
Note
Low Risk
Small, targeted change to initial state construction; non-missing validation still fails fast, and kickoff continues to validate merged state.
Overview
JSON-schema flows no longer fail at startup when required fields are absent from
state.default._build_definition_state_modelstill tries normal construction from defaults; if Pydantic reports only missing field errors, it falls back tomodel_constructso kickoff can supply those values via_initialize_state. Any other validation errors are unchanged and still raise.A regression test covers a declarative flow with a required
lead_nameand no default, kicked off withinputs={"lead_name": "Ada Lovelace"}.Reviewed by Cursor Bugbot for commit d3c2fff. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit