Repository navigation
feat(agent): support JSON object input on begin node - #16685
Conversation
Add object as a begin-node parameter type with JSON editor UI, webhook schema support, and backend parsing in UserFillUp. Co-authored-by: Cursor <[email protected]>
📝 WalkthroughWalkthroughAdds a new "object" data type across agent constants, translations, debug-content form schema/rendering, and webhook request body operators, paired with a backend change that parses JSON strings for object-typed fillup values instead of returning them raw. ChangesObject Type Support
Estimated code review effort: 2 (Simple) | ~12 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant DebugContent
participant JsonEditor
participant FormField
User->>DebugContent: select Object type field
DebugContent->>JsonEditor: render field.value (default {})
User->>JsonEditor: edit JSON content
JsonEditor->>FormField: field.onChange(parsedValue)
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@agent/component/fillup.py`:
- Around line 79-85: The object-value parsing in the fillup logic is too broad
and hides parse failures; update the parsing path in the value extraction helper
in component/fillup.py to catch only JSON decode errors instead of Exception.
Add logging for the parse-failure branch so when json.loads(raw) fails and the
code falls back to returning the raw string, the reason is recorded for
debugging malformed webhook/object payloads. Keep the existing raw-return
behavior, but make the failure path explicit and logged in the function that
handles value.get("type") == "object".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: abcdf1b3-5654-418f-99b8-b2d2a7bbfaa2
📒 Files selected for processing (6)
agent/component/fillup.pyweb/src/locales/en.tsweb/src/locales/zh.tsweb/src/pages/agent/constant/index.tsxweb/src/pages/agent/debug-content/index.tsxweb/src/pages/agent/form/begin-form/webhook/request-schema.tsx
| raw = value.get("value") | ||
| if value.get("type") == "object" and isinstance(raw, str) and raw.strip(): | ||
| try: | ||
| return json.loads(raw) | ||
| except Exception: | ||
| return raw | ||
| return raw |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Narrow the exception handling and add logging for the new parse-failure path.
except Exception (flagged by Ruff BLE001) swallows unrelated errors beyond JSON decoding, and no logging records why a value was returned raw instead of parsed — making malformed webhook/object payloads hard to diagnose in production. As per coding guidelines, new flows in .py files should add logging (**/*.py: "Add logging for new flows").
🛠️ Proposed fix
raw = value.get("value")
if value.get("type") == "object" and isinstance(raw, str) and raw.strip():
try:
return json.loads(raw)
- except Exception:
+ except json.JSONDecodeError:
+ logging.warning("Failed to parse object-typed fillup value as JSON, returning raw string")
return raw
return raw📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| raw = value.get("value") | |
| if value.get("type") == "object" and isinstance(raw, str) and raw.strip(): | |
| try: | |
| return json.loads(raw) | |
| except Exception: | |
| return raw | |
| return raw | |
| raw = value.get("value") | |
| if value.get("type") == "object" and isinstance(raw, str) and raw.strip(): | |
| try: | |
| return json.loads(raw) | |
| except json.JSONDecodeError: | |
| logging.warning("Failed to parse object-typed fillup value as JSON, returning raw string") | |
| return raw | |
| return raw |
🧰 Tools
🪛 Ruff (0.15.20)
[warning] 83-83: Do not catch blind exception: Exception
(BLE001)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@agent/component/fillup.py` around lines 79 - 85, The object-value parsing in
the fillup logic is too broad and hides parse failures; update the parsing path
in the value extraction helper in component/fillup.py to catch only JSON decode
errors instead of Exception. Add logging for the parse-failure branch so when
json.loads(raw) fails and the code falls back to returning the raw string, the
reason is recorded for debugging malformed webhook/object payloads. Keep the
existing raw-return behavior, but make the failure path explicit and logged in
the function that handles value.get("type") == "object".
Sources: Coding guidelines, Linters/SAST tools
|
Thank you. Please submit your changes to the Go implementation. The Python backend will be transitioned to legacy support. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16685 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Add object as a begin-node parameter type with JSON editor UI, webhook schema support, and backend parsing in UserFillUp.