Skip to content

Fix bool inputs incorrectly compiled as NumberInput in code execution nodes#3729

Open
awlevin wants to merge 2 commits intomainfrom
fix/code-execution-node-deployed-bug
Open

Fix bool inputs incorrectly compiled as NumberInput in code execution nodes#3729
awlevin wants to merge 2 commits intomainfrom
fix/code-execution-node-deployed-bug

Conversation

@awlevin
Copy link
Copy Markdown
Contributor

@awlevin awlevin commented Feb 16, 2026

Summary

  • In Python, bool is a subclass of int, so isinstance(True, int) returns True. This caused _compile_code_inputs to convert boolean values to NumberInput (True -> 1.0, False -> 0.0) instead of preserving them as booleans via JsonInput.
  • This bug specifically affects the API execution path (used when packages, non-default runtimes, or secrets are present), which is the path used in deployed workflows. The inline execution path (used in sandbox) passes values directly and handles booleans correctly.
  • The fix adds a bool isinstance check before the (float, int) check in the type dispatch chain within _compile_code_inputs.

Test plan

  • Added failing test test_run_node__bool_input that verifies boolean inputs are compiled as JsonInput(value=True) rather than NumberInput(value=1.0)
  • All 49 code execution node tests pass
  • All 3 workflow-level code execution tests pass
  • All serialization tests pass

🤖 Generated with Claude Code


Open with Devin

awlevin and others added 2 commits February 16, 2026 18:14
Boolean values in code_inputs are incorrectly compiled as NumberInput
(True -> 1.0, False -> 0.0) because isinstance(True, int) returns True
in Python. This causes bugs when workflows with bool code inputs are
run via the API execution path (deployed context) since the backend
receives a number instead of a boolean.

Also adds venv to flake8 exclude list to fix pre-existing hook issue.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… nodes

In Python, bool is a subclass of int, so isinstance(True, int) returns
True. This caused _compile_code_inputs to convert boolean values to
NumberInput (True -> 1.0, False -> 0.0) instead of preserving them as
booleans via JsonInput. This affected the API execution path used when
packages, non-default runtimes, or secrets are present.

The fix adds a bool check before the (float, int) check in the type
dispatch chain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@awlevin awlevin requested a review from dvargas92495 February 16, 2026 23:25
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