Commit d47fe0b
committed
fix(cluster): rebase onto dev + address Kilo findings (1C/1W/2S) for worker drain
Rebased feat/worker-self-drain onto origin/dev, resolving conflicts in
manager.py, routes/cluster.py, and worker/agent.py from recently-landed
registration-drift refresh fields (#1538).
Kilo fixes:
- CRITICAL: Protect 'update-available' from status-less heartbeat reversion.
The periodic ~15s heartbeat with no status was silently flipping
update-available workers back to online, defeating the update signal.
Now 'update-available' is protected alongside 'draining' — only explicit
status transitions are honoured.
- WARNING: Handle 'updating' in _monitor_loop. A worker stuck/crashed in
'updating' state was never re-onlined or offlined, permanently excluded
from routing/catalog. Now they are force-offlined after HEARTBEAT_TIMEOUT.
- SUGGESTION: Validate status against allow-list and sanitize drain_reason
in notification block to prevent operator-facing UI injection.
- SUGGESTION: notify_drain_complete() now sends status='updating' heartbeat
so the controller transitions from 'draining' to 'updating'.
Test update: test_heartbeat_without_status_reonlines_update_available
renamed to test_heartbeat_without_status_preserves_update_available and
now asserts the corrected protection behavior.
72/72 targeted tests pass.1 parent 3e7e779 commit d47fe0b
3 files changed
Lines changed: 55 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
523 | | - | |
524 | | - | |
525 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
526 | 532 | | |
527 | 533 | | |
528 | 534 | | |
529 | 535 | | |
530 | 536 | | |
531 | 537 | | |
532 | | - | |
| 538 | + | |
533 | 539 | | |
534 | | - | |
535 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
536 | 546 | | |
537 | 547 | | |
538 | 548 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
235 | | - | |
236 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
237 | 240 | | |
238 | 241 | | |
239 | 242 | | |
| |||
306 | 309 | | |
307 | 310 | | |
308 | 311 | | |
309 | | - | |
310 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
311 | 317 | | |
312 | 318 | | |
313 | 319 | | |
| |||
824 | 830 | | |
825 | 831 | | |
826 | 832 | | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
827 | 857 | | |
828 | 858 | | |
829 | 859 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
720 | | - | |
721 | | - | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
722 | 723 | | |
723 | 724 | | |
724 | 725 | | |
725 | 726 | | |
726 | | - | |
| 727 | + | |
727 | 728 | | |
728 | 729 | | |
729 | 730 | | |
| |||
0 commit comments