Skip to content

fix(home): realistic heartbeat timeout so "· Online" stops flickering to "couldn't confirm" - #358

Merged
LukasWodka merged 1 commit into
developfrom
fix/home-heartbeat-timeout
Jul 21, 2026
Merged

fix(home): realistic heartbeat timeout so "· Online" stops flickering to "couldn't confirm"#358
LukasWodka merged 1 commit into
developfrom
fix/home-heartbeat-timeout

Conversation

@LukasWodka

@LukasWodkaLukasWodka commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Fixes#357 · epic backend#1142.

The bug (Lukas hit it live)

tb flickered Online → couldn't confirm → Online on three identical back-to-back runs against a healthy cluster.

Root cause

The home heartbeat probe (realHeartbeatGetClient) is a backend round-trip, capped at homeProbeTimeout=1200ms (budget 1500ms). Every tb invocation is a fresh process → cold DNS+TCP+TLS handshake to api.tracebloc.io each time, which alone can approach ~1s. When the cold round-trip overran 1.2s → beatUnknown → the alarming "couldn't confirm it's connected." A flicker (sometimes Online) proves it's a timeout, not a persistent client-id/404 issue.

Fix

Raise homeProbeTimeout3s and homeDetectBudget3.5s. The fast path is unchanged (collectProbes returns as soon as both probes report), so a quick probe still renders instantly; only a genuinely slow/unreachable backend waits longer — and then "couldn't confirm" is accurate.

Note (follow-up, not here)

The same 1.2s cap also bounds the env probe's k8s round-trip (home.go:496,542) — fine for local k3d, but could false-offline a remote customer cluster. Worth a separate look.

gofmt/vet clean; full cli package tests green.


Note

Low Risk
Bounded timeout tuning and a file-budget ratchet bump; no auth or data-path changes, worst case slightly slower home screen when the backend is slow.

Overview
Fixes cli#357: the bare tb home screen could alternate · Online with couldn't confirm it's connected on healthy clusters.

homeProbeTimeout goes from 1.2s → 3s and homeDetectBudget from 1.5s → 3.5s, so a cold backend heartbeat (fresh process, DNS+TCP+TLS) can finish before the probe falls back to beatUnknown. Comments in home.go document that these floors must not be lowered again. collectProbes behavior is unchanged—fast probes still return as soon as both complete.

scripts/file-budget.sh raises the internal/cli/home.go line ceiling 850 → 855 for the added comment block.

Reviewed by Cursor Bugbot for commit 70f9f0c. Bugbot is set up for automated code reviews on this repo. Configure here.

@LukasWodkaLukasWodka self-assigned this Jul 20, 2026
@LukasWodka
LukasWodka requested a review from saadqbalJuly 20, 2026 13:57
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

@BugBot run

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 901550a. Configure here.

… flickering
`tb`/`tracebloc` flickered between "· Online" and "running — couldn't confirm
it's connected to tracebloc" on identical back-to-back runs against a healthy
environment. The home heartbeat probe (realHeartbeat -> GetClient) is a backend
round-trip, and every invocation is a fresh process, so it pays a cold
DNS+TCP+TLS handshake each time — which alone can approach a second. At the old
homeProbeTimeout=1200ms / homeDetectBudget=1500ms caps the cold round-trip
sometimes overran, yielding beatUnknown -> the alarming "couldn't confirm" even
though the client was online. (A flicker proves a timeout, not a persistent
client-id/404 issue.)
Raise homeProbeTimeout to 3s and homeDetectBudget to 3.5s. The fast path is
unchanged — collectProbes returns as soon as both probes report, so a quick
probe still renders immediately; only a genuinely slow/unreachable backend
waits longer, and then "couldn't confirm" is accurate.
home.go was at its 850-line file-budget ceiling, so bump it to 855 for the
added rationale comment (home.go is a split candidate — cli#282 pattern).
Fixes#357. Part of epic tracebloc/backend#1142.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

@BugBot run

@LukasWodka
LukasWodkaforce-pushed the fix/home-heartbeat-timeout branch from 901550a to 70f9f0cCompareJuly 20, 2026 14:03

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 70f9f0c. Configure here.

@LukasWodka
LukasWodka merged commit 8af20eb into developJul 21, 2026
20 checks passed
@LukasWodka
LukasWodka deleted the fix/home-heartbeat-timeout branch July 21, 2026 08:01
@saadqbal

Copy link
Copy Markdown
Collaborator

/fr-pass

Sign up for freeto 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.

3 participants

@LukasWodka@saadqbal@aptracebloc