diff --git a/cheap-worker/worker_service.py b/cheap-worker/worker_service.py index d56fb622..5b627842 100644 --- a/cheap-worker/worker_service.py +++ b/cheap-worker/worker_service.py @@ -138,6 +138,9 @@ def _default_run_fn(job: dict): import cheap_studio game_id = job.get("gameId") or job.get("job_id") + # 真后端来的 gameId 是 Java Long → JSON 数字 → Python int;cheap_run 的 subprocess shell-out(scaffold/build/stage/smoke/play) + # 与路径段都要求 str,int 会抛 TypeError(expected str, not int) → 生成静默判 llm_error。此处在 job 消费边界统一归一为 str。 + game_id = str(game_id) if game_id is not None else None brief = job.get("brief") or "" summary = asyncio.run(cheap_studio.run_studio(game_id, brief)) return summary, cheap_run.game_dir(game_id) @@ -257,6 +260,9 @@ def _process_modify_job(state: WorkerState, job: dict, modify: dict) -> dict: trace_id = job.get("traceId") or job.get("job_id") mode = modify.get("mode") game_id = job.get("gameId") or job.get("job_id") + # 真后端来的 gameId 是 Java Long → JSON 数字 → Python int;cheap_run 的 subprocess shell-out(scaffold/build/stage/smoke/play) + # 与路径段都要求 str,int 会抛 TypeError(expected str, not int) → 生成静默判 llm_error。此处在 job 消费边界统一归一为 str。 + game_id = str(game_id) if game_id is not None else None # A11 M4:模块重生成(改玩法)分流——有界单文件重写 game-logic.js,复用 cheap_studio resume + 三层校验。 if mode == "regenerate-module": @@ -346,6 +352,9 @@ def _process_regenerate_job(state: WorkerState, job: dict, modify: dict) -> dict """ trace_id = job.get("traceId") or job.get("job_id") game_id = job.get("gameId") or job.get("job_id") + # 真后端来的 gameId 是 Java Long → JSON 数字 → Python int;cheap_run 的 subprocess shell-out(scaffold/build/stage/smoke/play) + # 与路径段都要求 str,int 会抛 TypeError(expected str, not int) → 生成静默判 llm_error。此处在 job 消费边界统一归一为 str。 + game_id = str(game_id) if game_id is not None else None import cheap_run