fix(workflows): surface condition_json_parse_failed as workflow error instead of silent skip (#1673)#1694
Conversation
… instead of silent skip (coleam00#1673) When a when: condition references $nodeId.output.field and the node's output text is not valid JSON, the condition evaluator now returns parsed:false so the DAG executor treats it as an error (instead of silently skipping downstream nodes and exiting 0). Additionally, strip common markdown fences (e.g. ```json blocks) from output text before attempting JSON.parse, handling the common Pi/Minimax pattern of wrapping JSON in fences.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR hardens condition evaluation by introducing explicit JSON parsing failure handling in ChangesJSON Parse Error Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 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 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 |
Review SummaryVerdict: ready-to-merge This PR fixes #1673 by surfacing JSON parse failures as Minor / nice-to-have
Compliments
Reviewed via maintainer-review-pr workflow (Pi/Minimax). Aspects run: code-review, error-handling, test-coverage, comment-quality. |
… instead of silent skip (coleam00#1673) (coleam00#1694) When a when: condition references $nodeId.output.field and the node's output text is not valid JSON, the condition evaluator now returns parsed:false so the DAG executor treats it as an error (instead of silently skipping downstream nodes and exiting 0). Additionally, strip common markdown fences (e.g. ```json blocks) from output text before attempting JSON.parse, handling the common Pi/Minimax pattern of wrapping JSON in fences.
Summary
when:condition references$nodeId.output.fieldand the node output is not valid JSON (e.g. Pi/Minimax wrapping JSON in markdown fences or prepending reasoning prose), the condition evaluator returnsparsed: truewithresult: false. The DAG executor treats this as a legitimate "condition not met" skip. The workflow exits 0 — no error, no review posted, silent failure.maintainer-review-prruns with Pi.resolveOutputRef()now throwsOutputRefParseErrorwhen JSON parse fails (instead of returning empty string).evaluateAtom()catches it and returns{parsed: false}. Also strips common markdown fences (\x60\x60\x60jsonblocks) before attemptingJSON.parse.dag-executor.ts— it already correctly handlesparsed: false(surfaces error message, logs properly, exits non-zero). No changes tostructuredOutputpaths — they are unaffected since the JSON parse fallback is only reached when structured output is absent.UX Journey
Before
After
Architecture Diagram
Before
After
Connection inventory:
Label Snapshot
risk: lowsize: Sworkflowsworkflows:condition-evaluatorChange Metadata
bugworkflowsLinked Issue
Validation Evidence (required)
bun run format:checkcovered by lint-staged on commit.Security Impact (required)
Compatibility / Migration
Human Verification (required)
Side Effects / Blast Radius (required)
when:clauses referencing$node.output.fieldwhere the producing node is an LLMcondition_json_parse_failedwarn log already exists; the new behavior just escalates it from "silent skip" to "error + exit non-zero"Rollback Plan (required)
when_condition_parse_errormessagesRisks and Mitigations
Summary by CodeRabbit
Bug Fixes
Tests