Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
|
Test ResultsSummary
Runner Tests - Full Report
SDK1 Tests - Full Report
|
|
| Filename | Overview |
|---|---|
| workers/executor/executors/answer_prompt.py | Broadened null/non-dict check in handle_json: replaces isinstance(parsed_data, str) with not isinstance(parsed_data, (dict, list)), correctly catching None (from json.loads("null")) and other scalar JSON values that the old guard missed. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[handle_json called] --> B{answer == 'na'?}
B -- Yes --> C[Set output to None and return]
B -- No --> D[repair_json_with_best_structure]
D --> E{parsed_data is dict or list?}
E -- No --> F[Log error, set output to empty dict, return]
E -- Yes --> G{Webhook enabled?}
G -- Yes --> H[Run webhook postprocess]
H --> I[Set structured_output key to processed_data]
G -- No --> I
Reviews (1): Last reviewed commit: "UN-2980 Handle null response" | Re-trigger Greptile
chandrasekharan-zipstack
left a comment
There was a problem hiding this comment.
@Deepak-Kesavan I hope this code isn't duplicated elsewhere and required



What
handle_jsonsilently storingNonewhen the LLM returns literalnullfor a JSON-type promptWhy
json, the application expects the stored result to be a dict or listnull,repair_json_with_best_structurecorrectly parsed it to PythonNone(JSON null → Python None)isinstance(parsed_data, str)only caught the case whererepair_jsoncompletely failed and returned the original string — it missedNoneentirelyNonewas silently written tostructured_output[prompt_key], with no error log or warn event, breaking downstream consumers that expected a dict/listHow
handle_jsonfromisinstance(parsed_data, str)tonot isinstance(parsed_data, (dict, list)){}as a safe fallback{"key": null}— still flow through unchanged"na"sentinel (storesNone) is untouchedrepair_json_with_best_structurehelper is not modified — the type constraint is specific to the JSON output type and belongs at the callerCan this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
handle_jsonis only invoked forprompt_type == "json", where the contract is already "output must be a structured value". Any prior code path that received a scalar orNonefrom this function was already a latent contract violation. The"na"branch, therepair_json_with_best_structurehelper, and all other callers of that helper (e.g., structure tool) are untouched.Database Migrations
Env Config
Relevant Docs
Related Issues or PRs
Dependencies Versions
Notes on Testing
nullstructured_output[prompt_key] == None, no error/warn logstructured_output[prompt_key] == {}, error log + warn event published{"a": 1}still flows through unchanged{"key": null}is still stored as-is (not remapped to{})"na"responses still storeNoneas beforeScreenshots
Checklist
I have read and understood the Contribution Guidelines.