-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
area:runtime-nodeArea: Node runtime bridgeArea: Node runtime bridgebugSomething isn't workingSomething isn't workingpriority:p1Priority P1 (high)Priority P1 (high)
Milestone
Description
Summary
json.dumps in python_bridge.py allows NaN/Infinity by default, producing invalid JSON tokens (NaN, Infinity). Node’s JSON.parse rejects these and triggers protocol errors, killing the bridge.
Failure mode
- Python function returns
float('nan')orfloat('inf')(or includes these values in a list/dict). json.dumpsserializes them toNaN/Infinity.- Node side fails to parse and treats it as a protocol error.
Evidence
runtime/python_bridge.pyencode_response()usesjson.dumps(out)withoutallow_nan=False.
Proposed fix
- Use
json.dumps(..., allow_nan=False)and surface a clear error when NaN/Infinity is encountered. - Optionally sanitize to strings if a safe mode is configured.
Acceptance criteria
- NaN/Infinity in responses produce a clear, explicit error payload instead of invalid JSON.
- Node side does not receive malformed JSON for these values.
- Add tests with functions returning NaN/Infinity.
Metadata
Metadata
Assignees
Labels
area:runtime-nodeArea: Node runtime bridgeArea: Node runtime bridgebugSomething isn't workingSomething isn't workingpriority:p1Priority P1 (high)Priority P1 (high)