myxce/docs
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
..
superpowers/plans claude skills 2026-05-29 15:00:06 +08:00
aibot_poc_investiagting.md docs: mark PEND reason end-to-end done (bug-1513), note main_reason follow-up 2026-08-13 09:16:49 +00:00
Job-Finish-Robustness-设计文档.md fix(controller,worker): dual-state worker loss + resend actual job state (bug-1509 P3) 2026-08-06 06:49:24 +00:00
left_scheduler_work.md fix(apiserver): auto-recover after full controller death+restart (task #12) 2026-08-14 08:01:35 +00:00
pend-reason-investigation-design.md docs: PEND reason investigation + classification design (LSF-aligned) 2026-08-13 10:24:32 +00:00
Scheduler-Agent-设计文档.md docs: update status — Phase 2 done, human jobid, priorities (2026-08-13) 2026-08-13 03:35:00 +00:00