fix(tunnels): skip tunnel creation for terminal-only tools
This commit is contained in:
@@ -437,9 +437,11 @@ async def start_instance(
|
|||||||
}
|
}
|
||||||
|
|
||||||
instance_port = tool_type.default_port
|
instance_port = tool_type.default_port
|
||||||
logger.info("Tool type for instance %s: name=%s, default_port=%s",
|
logger.info("Tool type for instance %s: name=%s, default_port=%s, interfaces=%s",
|
||||||
instance.id, tool_type.name, instance_port)
|
instance.id, tool_type.name, instance_port, tool_type.interfaces)
|
||||||
|
|
||||||
|
# Only create Cloudflare tunnel for web-enabled tools
|
||||||
|
if "web" in tool_type.interfaces:
|
||||||
# Create temporary Cloudflare tunnel for public access
|
# Create temporary Cloudflare tunnel for public access
|
||||||
try:
|
try:
|
||||||
logger.info("Creating temporary tunnel for instance %s (container=%s, port=%d)",
|
logger.info("Creating temporary tunnel for instance %s (container=%s, port=%d)",
|
||||||
@@ -475,6 +477,12 @@ async def start_instance(
|
|||||||
"status": "error",
|
"status": "error",
|
||||||
"error": f"Failed to create tunnel: {error_msg}",
|
"error": f"Failed to create tunnel: {error_msg}",
|
||||||
}
|
}
|
||||||
|
else:
|
||||||
|
# Terminal-only tool - no tunnel needed
|
||||||
|
logger.info("Instance %s is terminal-only (no web interface), skipping tunnel creation", instance.id)
|
||||||
|
instance.url = None
|
||||||
|
instance.public_url = None
|
||||||
|
await session.commit()
|
||||||
|
|
||||||
return {"status": instance.status, "url": instance.url}
|
return {"status": instance.status, "url": instance.url}
|
||||||
|
|
||||||
@@ -597,6 +605,8 @@ async def restart_instance(
|
|||||||
|
|
||||||
instance_port = tool_type.default_port
|
instance_port = tool_type.default_port
|
||||||
|
|
||||||
|
# Only create tunnel for web-enabled tools
|
||||||
|
if "web" in tool_type.interfaces:
|
||||||
# Create new temporary tunnel
|
# Create new temporary tunnel
|
||||||
try:
|
try:
|
||||||
tunnel_info = start_cloudflared_tunnel(
|
tunnel_info = start_cloudflared_tunnel(
|
||||||
@@ -624,6 +634,10 @@ async def restart_instance(
|
|||||||
"status": "error",
|
"status": "error",
|
||||||
"error": f"Failed to create tunnel: {exc}",
|
"error": f"Failed to create tunnel: {exc}",
|
||||||
}
|
}
|
||||||
|
else:
|
||||||
|
# Terminal-only tool
|
||||||
|
instance.url = None
|
||||||
|
instance.public_url = None
|
||||||
|
|
||||||
await session.commit()
|
await session.commit()
|
||||||
return {"status": instance.status, "url": instance.url}
|
return {"status": instance.status, "url": instance.url}
|
||||||
|
|||||||
Reference in New Issue
Block a user