hermes-backup/daily/2026-04-28_203212/skills/devops/wealth-sse-transport-fix/SKILL.md
Fix WEALTH container restart loop caused by FastMCP stdio transport blocking on stdin when Docker starts without TTY
npx skillsauth add ariffazil/openclaw-workspace wealth-sse-transport-fixInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
wealth-organ container enters a restart loop:
Up 1 second
Exited (0) 2 seconds ago
Up 1 second
Exited (0) 2 seconds ago
...
monolith.py runs mcp.run() which defaults to stdio transport.
When Docker starts the container without a TTY, stdin closes immediately.
The stdio transport blocks waiting for input → when input never arrives, process exits
→ Docker restarts → loop.
# Before (in monolith.py)
if __name__ == "__main__":
mcp.run()
# After
if __name__ == "__main__":
import os
if os.isatty(0):
mcp.run() # stdio for local dev
else:
mcp.run(transport="sse", show_banner=False) # SSE for container
This makes the transport context-aware: stdio when run locally with a terminal, SSE when run in Docker.
unless-stopped restart policy handles actual crashesRemove the broken pg_isready healthcheck from compose. FastMCP SSE doesn't have a generic /health endpoint — the container process itself is the health indicator.
# Before (BROKEN — pg_isready not in WEALTH container)
healthcheck:
test: ["CMD", "pg_isready", "-U", "arifos"]
# After — remove healthcheck entirely (unless-stopped handles crashes)
# healthcheck: (omit entirely)
# 1. Copy patched monolith.py to VPS
scp /local/monolith.py arifos:/root/WEALTH/internal/
# 2. On VPS: commit
cd /root/WEALTH
git add internal/monolith.py
git commit -m "feat(kernel): harden intelligence v2026.04.29 [SSE + SABAR + V2_ALIAS]"
git push origin main
# 3. Rebuild container
cd /root/compose
docker compose up -d wealth-organ
# 4. Verify stable
docker ps # should show "Up X minutes" not cycling
# Check no restart loop
docker ps # wealth-organ: "Up N minutes"
# Check SSE port is listening inside container
docker exec wealth-organ sh -lc "curl -s --connect-timeout 2 http://localhost:8000/"
# Should return something (FastMCP SSE response or 404), not "connection refused"
# Check from Caddy network
docker exec caddy sh -lc "curl -s --connect-timeout 3 http://wealth-organ:8000/"
/root/wealth/internal/monolith.py — source (SSE patch applied here)/root/compose/docker-compose.yml — WEALTH service definitionwealth-organ — container namedevelopment
Federation-wide gold (XAUUSD) trading capability. Python stack, OANDA broker, backtesting, macro signals, RSI strategy. Every organ has a role.
development
Capital claim state management — tracks claim lifecycle across WEALTH organ.
development
Archived constitutional warga placeholder retained only for audit provenance. Do not use for active work; use the live arifOS governance and constitutional skills instead.
testing
Warga (citizen) agent skills for AAA federation members. See subdirectories for specialized warga skills.