From aebcf25bf47615bdb6198291798a91afc8ce5fff Mon Sep 17 00:00:00 2001 From: Fusion Date: Sat, 23 May 2026 07:29:56 +0200 Subject: [PATCH] fix: OpenCode instances fail with 'no port configured' error For terminal-only tools like OpenCode, default_port is 0 which is falsy in Python. The code incorrectly treated port 0 as 'not configured' and marked the instance as error. Now we only check if tool_type exists, and default to port 0. Terminal tools skip tunnel creation anyway. --- apps/api/src/api/tool_instances.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/api/src/api/tool_instances.py b/apps/api/src/api/tool_instances.py index 568e5fe..9b0d93c 100644 --- a/apps/api/src/api/tool_instances.py +++ b/apps/api/src/api/tool_instances.py @@ -736,17 +736,16 @@ async def start_instance( # Get tool type for default port tool_type = await session.get(ToolType, instance.tool_type_id) - if not tool_type or not tool_type.default_port: - logger.error("Tool type %s has no default_port configured. Cannot create tunnel.", - instance.tool_type_id) + if not tool_type: + logger.error("Tool type %s not found", instance.tool_type_id) instance.status = "error" await session.commit() return { "status": "error", - "error": f"Tool type '{tool_type.name if tool_type else 'unknown'}' has no port configured", + "error": f"Tool type '{instance.tool_type_id}' not found", } - instance_port = tool_type.default_port + instance_port = tool_type.default_port or 0 logger.info("Tool type for instance %s: name=%s, default_port=%s, interface_type=%s", instance.id, tool_type.name, instance_port, tool_type.interface_type)