Repository navigation
TC-1176: Write Probe signed-in reads, Better Stack heartbeat /fail, dense promote watch - #294
Merged
Merged
Conversation
…tbeat /fail, dense promote watch Extends the TC-313 Write Probe instead of adding a second probe. Signed-in KV and SQL reads of fixed targets with a hard 20 s deadline per stage; a good read pings the Better Stack heartbeat, the 2nd failed read in a row POSTs /fail with a one-line body (stage, outcome, duration, node build, UTC). Cron */5. workflow_dispatch mode=dense runs the promote watch (30 s for 5 min, then 5 min for 60 min, 5 s threshold), dispatched by docker.yml after every Phala deploy. force_failure exercises the alert path. Refs TC-1176, TC-959.
…ecked reports, heartbeat ownership handoff between normal and dense
Contributor
Author
|
Astra security review (gpt-6-astra): APPROVE. That's after three rounds. Fixed: separate KV/SQL failure counts (a healthy SQL read no longer hides a broken KV read); only a 2xx counts as delivered, and a rejected Live proof on this branch (UTC 2026-10-15):
Heartbeat 509295 is paused until this merges, because main's old probe doesn't ping. Resume it in the Better Stack UI after the merge. The first scheduled run on main will then ping. |
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.
Refs TC-1176 (incident 2026-10-14: signed-in KV reads and SQL 504 after ~62 s while
/healthzstayed green) and TC-959 (Better Stack as code).Holden's direction is one probe, not two, so this extends the TC-313 Write Probe instead of adding a host-timer probe. It already did a signed-in read-back, and it failed at 23:36Z and 23:50Z during TC-1176. But it ran only every 15 minutes with no per-stage deadline, and a red scheduled run only e-mails whoever last edited the cron line, so nobody was paged.
What changes
Reads, the paging signal.
signin,space, then akvread of the fixed keyread-probe/fixedand asqlselect of the fixed rowread_probe.id=1. Each stage has a hard 20 s client deadline. The probe writes the fixed key and row itself, once, the first time they're missing.509295; managed as code in tinycloud-devops/betterstack/uptime.json, in the companion PR).<heartbeat>/failwith one line, e.g.TC-1176 node read probe FAIL (2 in a row, normal): stage=kv outcome="timeout >=20s" duration_ms=20004 build=1.20.6 host=node.tinycloud.xyz at=2026-10-15T01:05:07ZThe outcome is
timeout >=20s,HTTP <code>,connection refused,DNS, and so on, so Amos can tell a read hang (restart) from the node being down (rollback). One failure alone never pages, so a ~60 s deploy restart is absorbed. Per Amos, there is no pause for deploys.Writes, TC-313's round-trip (
put -> get -> delete). These keep their thresholds and now also have the 20 s deadline. A breach still fails the job but doesn't touch the heartbeat. ThePROBE_THRESHOLD_SIGNIN_MSoverride is removed: sign-in is now a read stage under the 20 s deadline.Cadence
*/5(the repo is public, so Actions minutes are free). Heartbeat period 5 min plus 55 min grace, so it pages after 60 min with no ping. I measured this workflow's actual schedule over 600 runs (2026-10-06..14, cron*/15): the gap between runs was p50 19 min, p99 48 min, max 54 min. A shorter window would page falsely whenever GitHub drops runs. Failed reads don't wait for the grace: they alert through/fail.Dense promote watch.
workflow_dispatchmode=densereads every 30 s for 5 min (alternating KV and SQL, so each endpoint gets at most 1 request per 30 s), then every 5 min for 60 min. A read over 5 s counts as a failure; 2 in a row POST/fail. The job summary lists every sample's latency. The newdocker.ymljobpromote-watchdispatches it after every Phala deploy attempt. It's a separate job, so the job holding production secrets never getsactions: write. While a dense watch runs, scheduled runs skip themselves, so only one probe owns the heartbeat.force_failuredispatch input: points the run athttps://read-probe-forced-failure.invalid(fails at DNS), to exercise the alert path.Secrets: the probe never prints
PROBE_PRIVATE_KEYor the newBETTERSTACK_HEARTBEAT_URL. Errors are reduced to a classified outcome, raw details are redacted, the heartbeat URL is never logged, and it must be a Better Stack heartbeat URL.Tests
test/probe/probe-core.test.ts(12, stub client, mocked timers; newWrite Probe testsworkflow): hung read →timeout >=20sat the deadline, and the next stages are skipped; 504, connection refused and DNS outcomes from SDK-shaped errors; the slow threshold; the 2-in-a-row rule and its rate limit; corrupt state; the/failbody format; ping GET vs/failPOST; result lines and redacted logs that never contain the key or URL; dense alternation and schedule; dense 2-slow →/fail→ ping.DNSandnode /info not OK(the SDK's sign-in pre-check gives no status); the 2nd run decidesheartbeat_action=failwith the expected body.actionlintis clean onwrite-probe.yml,write-probe-tests.ymlanddocker.yml.QA / Amos:
gh workflow run write-probe.yml -R TinyCloudLabs/tinycloud-node --ref main -f mode=dense. The run is titledWrite Probe (dense promote watch);conclusion=successmeans every sample was under 5 s.