fix: tool start hanging + SSE 429 errors

1. Remove Docker build from create_instance for manifest types — the build
   was blocking the HTTP request for several minutes, causing frontend
   timeouts and retries. Image is now built lazily on start (via the
   existing _prepare_manifest_instance path in start_instance).

2. Increase MAX_CONNECTIONS_PER_USER from 5 to 20 for SSE endpoint —
   aggressive reconnect loops from the frontend were exhausting the limit
   and causing 429 errors unrelated to tool starting.

Quality gates: ruff clean, tsc --noEmit clean, pytest workspaces (9 passed)
This commit is contained in:
2026-06-01 23:29:28 +02:00
parent 8837031fd2
commit 56dd7d3fd3
3 changed files with 14 additions and 46 deletions
+12 -8
View File
@@ -91,14 +91,18 @@ class TerminalManager:
"""
try:
async with SessionLocal() as db_session:
stmt = pg_insert(TerminalSessionModel).values(
id=uuid.UUID(session_id),
instance_id=instance_id,
name=name,
status="active",
created_at=datetime.now(timezone.utc),
last_activity_at=datetime.now(timezone.utc),
).on_conflict_do_nothing(index_elements=["id"])
stmt = (
pg_insert(TerminalSessionModel)
.values(
id=uuid.UUID(session_id),
instance_id=instance_id,
name=name,
status="active",
created_at=datetime.now(timezone.utc),
last_activity_at=datetime.now(timezone.utc),
)
.on_conflict_do_nothing(index_elements=["id"])
)
await db_session.execute(stmt)
await db_session.commit()
logger.debug(