myxce/src/frontend
lei.chen e505066162 fix(apiserver): auto-recover after full controller death+restart (task #12)
The apiserver stayed circuit-breaker-degraded after a full controller
restart until manually restarted. Two root causes:

1. Breaker recovery was decoupled from the breaker itself. The breaker can
   be tripped by a backend write failure (e.g. E_XCE_STANDBY -10014 while
   the controller is electing) with no heartbeat ever failing, but
   StartHeartbeat only recovered on a fail→success heartbeat transition
   (prevFailed), so the breaker stayed degraded forever.
   → extract needsRejoinAfterHeartbeat(hbOK, prevFailed): recover when
   prevFailed OR the breaker is currently tripped. 5 new unit tests.

2. The 30s heartbeat's fire-and-forget reconnect only fires when the lib's
   internal ctx state is XCE_CTX_ERR. After a controller restart whose
   election outlasts the FAILOVER_CALL retry budget, the retry loop's
   xcecli_ctx_recover leaves the ctx RUN on a half-open connection, so the
   FF path never reconnects and the client stays disconnected forever.
   → lib: new xcecli_force_reconnect() forces a rotate+recover regardless
   of state; apiserver: 2s recoveryLoop force-reconnects + rejoins while
   degraded.

Verified on cluster: after controller kill+restart, the apiserver logs
"backend re-joined controller after reconnect" and job submissions resume
without a manual restart; a fresh job runs to DONE. Controller, scheduler
(rejoin ok, bug-1513) and workers all auto-recover.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-14 08:01:35 +00:00
..
apiserver fix(apiserver): auto-recover after full controller death+restart (task #12) 2026-08-14 08:01:35 +00:00
docs Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00
mcp-server feat(mcp-server): advanced tools — wait/analyze/suggest/estimate (Phase 2) 2026-08-12 08:30:31 +00:00
schedulerclient feat(apiserver): surface human-readable job ID (fmt_jobid form) in responses 2026-08-13 02:01:52 +00:00
tests/regression Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00
xcecli fix(xcecli): restore dangling CA-cert cleanup misses, enable https support 2026-07-23 07:28:01 +00:00
CLAUDE.md docs(scheduler-agent): update design doc with cluster verification results 2026-08-01 09:54:49 +00:00
Makefile Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00
meson.build Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00