Skip to content

fix: add auto-refresh for headless scaling and convergence operations - #356

Merged
cebarks merged 2 commits into
mainfrom
worktree-agent-a427fbf533310efe2
Jul 29, 2026
Merged

fix: add auto-refresh for headless scaling and convergence operations#356
cebarks merged 2 commits into
mainfrom
worktree-agent-a427fbf533310efe2

Conversation

@cebarks

@cebarks cebarks commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Added HeadlessChanged SSE event variant
  • Broadcast event when headless operations complete (scale, converge, create, delete, rebuild, start, stop, restart, graceful-restart)
  • Wire up HTMX on scale/create/converge/rebuild forms in templates/headless.html
  • Added SSE listener in headless template to trigger client list refresh on headlessChanged events
  • Operation result template triggers client list refresh on successful completion

Test plan

  • Run dev server (just dev-serve)
  • Navigate to /quma/headless page
  • Scale headless clients and verify client list auto-refreshes without manual reload
  • Force converge and verify client list auto-refreshes without manual reload
  • Verify start/stop/restart actions also trigger auto-refresh
  • Verify non-HTMX form submission still works (fallback behavior)

Implemented with the help of Claude Code

cebarks and others added 2 commits July 28, 2026 21:51
Adds HeadlessChanged SSE event and broadcasts it when headless client operations complete (scale, converge, create, delete, rebuild, start, stop, restart, graceful-restart). The headless.html template now listens for headlessChanged events and auto-refreshes the client list. Operation forms use HTMX to submit asynchronously, and the operation_result template triggers a client list refresh on successful completion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix-ups for headless auto-refresh PR:

1. Broadcast HeadlessChanged from async operation completions:
   - Pass events sender to HeadlessService via new()
   - Broadcast on ops.complete() and ops.fail() in spawn_convergence()
   - Broadcast from delete() async task (all error + success paths)
   - Broadcast from rebuild() async task (all error + success paths)

2. Fix EventSource connection leak in headless.html:
   - Close existing EventSource before creating new one
   - Store in window.headlessEventSource for reuse
   - Prevents accumulation on HTMX soft-reload

3. Remove double-refresh from operation_result.html:
   - Drop hx-trigger="load" attribute
   - SSE HeadlessChanged is canonical refresh mechanism

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cebarks
cebarks enabled auto-merge (squash) July 29, 2026 04:31
@cebarks
cebarks merged commit 9097d77 into main Jul 29, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant