Skip to content

feat: resilient Pulse registration with ServiceAPIKey#4

Merged
davidfic merged 1 commit intomainfrom
feat/resilient-pulse-integration
Apr 16, 2026
Merged

feat: resilient Pulse registration with ServiceAPIKey#4
davidfic merged 1 commit intomainfrom
feat/resilient-pulse-integration

Conversation

@davidfic
Copy link
Copy Markdown
Contributor

Summary

Switches from fire-and-forget `sdk.New()` to `sdk.NewWithRetry()` for Pulse registration. Haul now retries registration with exponential backoff (~2 min), then continues standalone if Pulse is unavailable. Also passes Haul's auto-generated API key as `ServiceAPIKey` so Pilot/Prism can discover and authenticate with Haul automatically via Pulse.

What changed

  • integration.go — `New()` accepts a `serviceAPIKey` parameter, uses `sdk.NewWithRetry()` instead of `sdk.New()`, passes `ServiceAPIKey` in the SDK config
  • main.go — Registration is no longer in a fire-and-forget goroutine. Blocks during the retry window, then continues regardless. Passes `cfg.Auth.APIKey.Value()` as the service API key
  • go.mod — Pins pulse SDK to v0.2.0 (adds `NewWithRetry`, `ServiceAPIKey`, resilient heartbeat)

End-to-end flow

  1. Haul starts, tries to register with Pulse for ~2 min
  2. If Pulse responds: registered with API key stored in Pulse's services table. Pulse auto-creates a download-client entry with Haul's URL and API key. Pilot/Prism pick it up via their existing `SyncDownloadClients()` loop.
  3. If Pulse doesn't respond: Haul logs a warning and runs standalone. Users configure download clients manually via the UI.

Test plan

  • Build + test pass locally
  • CI green
  • `docker compose up` with Pulse available → Haul appears as download client in Pilot/Prism within 30s
  • `docker compose up` without Pulse → Haul starts standalone after ~2 min of retries

Switches Haul's Pulse integration from fire-and-forget sdk.New() to
sdk.NewWithRetry() which retries registration with exponential backoff
over ~2 minutes. If Pulse is unreachable after all retries, Haul
continues in standalone mode with a clear log message.

Passes Haul's own auto-generated API key as ServiceAPIKey during
registration. Pulse stores it and auto-creates a download-client entry
with the key as the password, so Pilot/Prism can discover and
authenticate with Haul without any manual download-client setup in
their UIs.

The registration is no longer in a fire-and-forget goroutine — it
blocks during the retry window (up to ~2min), then the app continues
regardless of outcome. The heartbeat loop (inside the SDK) handles
reconnection if Pulse goes down and comes back.

Pins pulse SDK to v0.2.0 which includes NewWithRetry, ServiceAPIKey,
and the resilient heartbeat with re-registration on persistent failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@davidfic davidfic merged commit 1f33ea2 into main Apr 16, 2026
5 of 6 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