feat(daemon): surface backend connectivity in daemon status#1910
Open
wingtonrbrito wants to merge 1 commit intomultica-ai:mainfrom
Open
feat(daemon): surface backend connectivity in daemon status#1910wingtonrbrito wants to merge 1 commit intomultica-ai:mainfrom
wingtonrbrito wants to merge 1 commit intomultica-ai:mainfrom
Conversation
When the Multica server is unreachable (network down, server crashed,
Docker stack stopped on a self-host install), the daemon stays
"running" — process is alive, listener is bound, the health endpoint
returns 200 — but it can't actually poll for assignments. From the
caller's perspective this looks identical to a fully-healthy daemon,
which makes diagnosing "my issues are stuck in todo" harder than it
needs to be.
This patch adds a `BackendConnectivity` field to the daemon's
HealthResponse with three states:
- "connected" — server responded with 2xx on /health
- "unreachable" — request failed (refused, DNS, TLS, timeout, non-2xx)
- "unknown" — daemon has no ServerBaseURL configured
The probe is synchronous in the hot path of `multica daemon status`,
with a 1500ms timeout. In the failure case it adds at most ~1.5s of
latency, which is acceptable for an ergonomic / observability addition.
A follow-up could move the probe to a background goroutine that
updates a cached value every N seconds if maintainers find the
synchronous cost too high under load.
The CLI surfaces the field as a "Backend:" line in `multica daemon
status` output, only when the value is "connected" or "unreachable".
"unknown" (empty ServerBaseURL) and absent (older daemons not yet
running this code) are both treated as "don't print", so existing
output stays unchanged for those cases.
Tests:
- probeBackendConnectivity returns "connected" / "unreachable" /
"unknown" across all four paths (httptest.Server up, server down,
server closed, empty ServerBaseURL)
- the JSON wire-level `backend_connectivity` key appears in the
/health response and round-trips through the typed struct
go test, gofmt, go vet all clean on changed files.
|
@wingtonrbrito is attempting to deploy a commit to the IndexLabs Team on Vercel. A member of the Team first needs to authorize it. |
wingtonrbrito
added a commit
to wingtonrbrito/multica
that referenced
this pull request
May 1, 2026
…backend connectivity in daemon status)
wingtonrbrito
added a commit
to wingtonrbrito/multica
that referenced
this pull request
May 1, 2026
This branch now carries the two open upstream PRs (multica-ai#1805 and multica-ai#1910) merged on top of upstream/main, making it the single consumable branch for the fork. Updated quickstart, sync recipe, and patch log to reflect the new shape.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
backend_connectivityfield to the daemon'sHealthResponsesomultica daemon statuscan surface whether the daemon can actually reach the configured Multica server. Three states:connected,unreachable,unknown.Why
When the Multica server is unreachable (network down, server crashed, Docker stack stopped on a self-host install), the daemon stays "running" — process is alive, listener is bound,
/healthreturns 200 — but it can't poll for assignments. From the caller's perspective this looks identical to a fully-healthy daemon, which makes diagnosing "my issues are stuck intodo" harder than it needs to be.I hit this directly while running self-host Multica during testing — Docker Desktop hung, the daemon kept reporting
running, and there was no signal that work wasn't actually flowing through.What changes
HealthResponse:probeBackendConnectivity(ctx, serverURL)does a 1500ms-timeoutGET <serverURL>/health(the unauthenticated liveness endpoint). Returns one of:connected— 2xx responseunreachable— request failed (refused, DNS, TLS, timeout, non-2xx)unknown— emptyServerBaseURLhealthHandlercalls the probe and includes the result in the response.runDaemonStatus(CLI) surfaces it as aBackend:line, only when the value isconnectedorunreachable. Older daemons (no field) andunknownboth keep existing output unchanged.Backward compatibility
Fully compatible. The new key uses
omitempty, so consumers parsing into untyped maps don't see it for older daemons or whenServerBaseURLis empty. The CLI only adds output when the value is meaningful.Performance
The probe is synchronous in the hot path of
multica daemon status, with a 1500ms timeout. In the failure case it adds at most ~1.5s of latency — acceptable for an ergonomic / observability addition. If maintainers prefer, a follow-up can move the probe to a background goroutine that updates a cached value every N seconds.Tests
TestProbeBackendConnectivity— 4 sub-tests covering all branches: server up, non-2xx response, server closed, empty ServerBaseURLTestHealthHandlerSurfacesBackendConnectivity— verifies thebackend_connectivityJSON wire key appears + round-trips through the typed structgo test ./internal/daemon/(full suite),go vet,gofmt -lall clean on changed files.