Skip to content

fix(execution-worker): treat empty-conditions decision branch as catch-all#33

Draft
librowski wants to merge 1 commit into
mainfrom
WB-229-decision-catch-all
Draft

fix(execution-worker): treat empty-conditions decision branch as catch-all#33
librowski wants to merge 1 commit into
mainfrom
WB-229-decision-catch-all

Conversation

@librowski

Copy link
Copy Markdown
Collaborator

Split out of #32 (found during WB-229 deployment verification) so the semantics change gets its own review.

The bug

A decision branch with an empty conditions array never matched, while two shipped artifacts assume the opposite:

  • the executor's own no_branch_matched error says "Add an explicit catch-all branch with no conditions"
  • the Sales Inquiry reference template's General branch is exactly that — dead code today

Any input the classifier labels outside the keyword branches fails the whole run. First reproduced when a model classified an input as "general"; local demos always happened to match pricing/technical, so it never surfaced.

The fix

branchMatches returns true for an empty conditions list. First-match order is preserved (a catch-all only fires when placed after conditional branches), and the strict fail-fast from packages/execution-core/decision-no-match.decision-log.md is untouched — a decision whose branches all have conditions and none match still throws.

⚠️ Supersedes a documented decision

decision-no-match.decision-log.md (29.04.2026) explicitly declared empty-conditions branches non-matching, with a tautological condition as the catch-all idiom, and a test pinned that. This PR supersedes that clause (test updated); the reasoning is recorded in apps/execution-worker/decision-catch-all.decision-log.md. Review from the original decision's author would be valuable.

…h-all

The no_branch_matched error message and the Sales Inquiry reference
template both treat a branch with no conditions as the explicit
catch-all, but branchMatches returned false for it — any input
classified outside the keyword branches failed the whole run.

Supersedes the empty-conditions bullet of
packages/execution-core/decision-no-match.decision-log.md (the strict
fail-fast core of that decision is unchanged); see
apps/execution-worker/decision-catch-all.decision-log.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants