From ca718bcfe240227c193e26147112fbcd682e0bb6 Mon Sep 17 00:00:00 2001 From: octo-patch Date: Sun, 19 Apr 2026 09:05:06 +0800 Subject: [PATCH] fix(coderunner): define null/true/false aliases in Python sandbox prefix When a workflow code node receives a parameter with a null value, the Python sandbox crashes with NameError: name 'null' is not defined. Root cause: json.dumps() serializes Python/Go nil values as JSON literal 'null', which is then embedded directly into generated Python code. But Python does not recognise 'null' (or 'true'/'false') as keywords. Fix: add `null = None`, `true = True`, `false = False` to the generated code prefix so that JSON-serialized parameter dicts evaluate correctly as Python literals. Fixes #2618 --- backend/infra/coderunner/impl/script/sandbox.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/infra/coderunner/impl/script/sandbox.py b/backend/infra/coderunner/impl/script/sandbox.py index 28ee898bd1..d61ebc01f7 100644 --- a/backend/infra/coderunner/impl/script/sandbox.py +++ b/backend/infra/coderunner/impl/script/sandbox.py @@ -165,6 +165,9 @@ def execute( import json import sys import asyncio +null = None +true = True +false = False class Args: def __init__(self, params): self.params = params