089d802f1d
- Add final get_container_status check in start_tool_instance before writing status=running; mark as error and return logs if container stopped - Treat restarting as error in HealthMonitor when DB status was already running, so crash loops are surfaced instead of preserved - Disable auto-restart (restart: unless-stopped -> restart: no) for tool instances in manifest compiler, legacy dockerfile path, and built-in seeds Quality gates: - pytest tests/unit: 210 passed - ruff: clean on changed files - mypy: clean on changed files
1.6 KiB
1.6 KiB
Fix: failed containers shown as running on dashboard
Problem
Containers that fail during startup (e.g. ln: failed to create symbolic link '/workspace': Permission denied) are still displayed as "Running" on the web dashboard and session list.
Root cause
start_tool_instanceinapps/api/src/services/tool/instance_service.pysetsinstance.status = "running"after post-start setup without verifying the container is still up.- Generated compose files use
restart: unless-stopped, so Docker immediately restarts a crashed container, putting it into therestartingstate. - The background
HealthMonitortreatsrestartingas a transient state and preserves the current DB status (running).
Fix
- Add a final
get_container_statuscheck instart_tool_instanceimmediately before writingstatus = "running". If the container has stopped/exited, mark it aserrorand return the logs. - Update
HealthMonitor._derive_statusso that when the DB status isrunningand Docker reportsrestarting, the instance is marked aserror. - Disable auto-restart for tool instances by changing
restart: unless-stoppedtorestart: "no"in:apps/api/src/services/build/manifest_compiler.pyapps/api/src/services/tool/instance_service.py(legacy dockerfile path)apps/api/src/seeds/builtin_tool_types.py
Affected files
apps/api/src/services/tool/instance_service.pyapps/api/src/services/instance/health_monitor.pyapps/api/src/services/build/manifest_compiler.pyapps/api/src/seeds/builtin_tool_types.py
Verification
pytest apps/api/tests/unitruff,mypyon changed files