Repository navigation
Closed
Labels
bugSomething isn't working
Description
Describe the bug
Crashing a moca harness/supervisor pod led to a an unrecoverable session and some status reporting differences:
- Session unrecoverable after supervisor restart. No failure result ever finalizes server-side.
mocactl get <sid>returns http_404 indefinitely (>3 min observed). Contrast:kubectl -n moca-sandbox delete pod ...eventually produces a responded session with an failure body. The sandbox-kill path reconciles, but the supervisor-kill path doesn't. mocactl getandmocactl sessionsdisagree. get → http_404. sessions → the same listed as state=active. Operator can't tell from the client surface whether the session is dead, running, or lost.- Ledger reports a client-side error as if server-side.
mocactl subagents --tag <tag>shows state=failed, detail="fetch failed (UND_ERR_SOCKET)". That's the detached spawn worker reporting its own severed POST /v1/runs connection, not a server status — but it reads to the operator as if the server declared the session failed. - Orphan cleanup is manual. The dead session row needs
mocactl sessions delete <sid>to free. Compounds with the related missing mocactl workloads list in feature:mocactl workloads listto enumerate caller's live workloads #552.
Steps To Reproduce
mocactl spawn --kind prompt --config DIGEST --workload WLID --tag …a leaf whose first tool call sleeps briefly.- After ~20s (leaf pinned to a sandbox pod),
kubectl -n moca delete pod -l app=moca-supervisor. - Supervisor pod respawns in ~10s. Sandbox pods never touched.
Expected Behavior
Supervisor crash mid-leaf should either:
- (a) reconcile the session on supervisor restart and finalize a failure result — same shape as the sandbox-pod-kill path (client observes responded with a server-written body), or
- (b) mark the session terminally failed server-side so mocactl get returns a legible terminal status (not 404) and mocactl sessions reflects the same state.
Moca Version
Tested on moca version edge-12536a6 (upstream/main as of 2026-10-20)
Additional Context
Potential fix: On supervisor startup, scan Redis for sessions in state=active with no live /v1/runs holder and finalize them. Mirrors the sandbox-pod-kill resilience that already exists. Fixes the get/sessions disagreement as a side effect.
Workaround today:
mocactl subagents --tag "$TAG" --json \
| jq -r '.subagents[] | select(.detail | test("UND_ERR_SOCKET"; "n")?) | .sessionId' \
| xargs -I{} mocactl sessions delete {}
# then re-dispatch under a fresh label
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
fix(harness): review follow-up - reaper must not overwrite a run's ow…
fix(harness): reconcile sync runs orphaned by a supervisor crash (#558)