Skip to content

Pass the schema default for optional inputs a prompt leaves out - #15740

Open
christian-byrne wants to merge 3 commits into
masterfrom
feat__optional-input-schema-defaults
Open

Pass the schema default for optional inputs a prompt leaves out#15740
christian-byrne wants to merge 3 commits into
masterfrom
feat__optional-input-schema-defaults

Conversation

@christian-byrne

@christian-byrne christian-byrne commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

An API-format prompt saved before an optional input was added does not carry it, and get_input_data only passes the keys the prompt has, so the node is called without the argument and raises TypeError. INPUT_TYPES defaults are never injected, so the value has to come from a default in the entry function, and 75 optional inputs in core do not have one. This fills those from the schema default, which makes "optional with a default" mean the input simply does not have to be provided. It only applies where the parameter has no default of its own, so a node using a sentinel to detect a missing input, like SoftSwitchNode with MISSING, still sees it missing — and a node whose schema default disagrees with its signature default keeps using the signature. Optional inputs with no schema default are untouched; those are nullable values, and the sibling PR #15739 lints that their parameter carries a default.

Reproduced against a running server with a real API-format prompt. TestOmittedOptionalInput.scale is optional with {"default": 0.5} in the schema and no default in process(), and the prompt omits it:

{"prompt": {
  "1": {"class_type": "StubImage", "inputs": {"content": "WHITE", "height": 64, "width": 64, "batch_size": 1}},
  "2": {"class_type": "TestOmittedOptionalInput", "inputs": {"image": ["1", 0]}},
  "3": {"class_type": "SaveImage", "inputs": {"images": ["2", 0], "filename_prefix": "e2e"}}
}}

Before, validation accepts it and execution dies:

$ curl -s -X POST -d @prompt.json http://127.0.0.1:8291/prompt
{"prompt_id": "75a9a821-...", "number": 1, "node_errors": {}}

[ERROR] !!! Exception during processing !!! TestOmittedOptionalInput.process() missing 1 required positional argument: 'scale'
  File "execution.py", line 306, in process_inputs
    result = f(**inputs)
TypeError: TestOmittedOptionalInput.process() missing 1 required positional argument: 'scale'

After, it runs and the default arrives — a white image scaled by 0.5 is 127:

$ curl -s -X POST -d @prompt.json http://127.0.0.1:8291/prompt
{"prompt_id": "689703ba-...", "number": 0, "node_errors": {}}
[INFO] Prompt executed in 0.01 seconds

$ python -c "import numpy; from PIL import Image; a=numpy.array(Image.open('e2e_00001_.png')); print(a.min(), a.max())"
127 127

Tests

tests/execution/test_omitted_optional_input.py covers that over HTTP: the omitted input gets its schema default, a provided value still wins, and a connected nullable socket is still delivered. Reverting only the execution.py hunk fails 2 of the 3.

$ pytest tests/execution/test_omitted_optional_input.py -q --port 8399   # without the change
2 failed, 1 passed

$ pytest tests/execution/test_omitted_optional_input.py -q --port 8399   # with the change
3 passed

$ pytest tests/execution -q --port 8399
277 passed, 7 skipped in 92.08s

$ pytest tests-unit -q
1257 passed, 10 skipped

tests-unit/execution_test/omitted_optional_input_test.py adds the unit-level cases, including that a V3 node resolves through execute rather than the EXECUTE_NORMALIZED trampoline.

An API-format prompt saved before an optional input existed does not carry
it, and get_input_data only passes the keys the prompt has, so the node is
called without the argument and raises TypeError. 75 optional inputs in core
are in that state today.

Only fill in inputs whose function parameter has no default of its own, so
nodes that use a sentinel default, like SoftSwitchNode, still see the input
as missing.
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your current included review allowance is based on your included PR review attempts over the past 7 days.

Next review available in: 4 minutes

Limit details: You’ve used all 2 included reviews currently available. Your 80 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1b3c6b65-3a33-42c3-94ff-daac0d63f07c

📥 Commits

Reviewing files that changed from the base of the PR and between 5ab2f7a and fd68491.

📒 Files selected for processing (4)
  • execution.py
  • tests-unit/execution_test/omitted_optional_input_test.py
  • tests/execution/test_omitted_optional_input.py
  • tests/execution/testing_nodes/testing-pack/specific_tests.py

Comment @coderabbitai help to get the list of available commands.

@christian-byrne

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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