Skip to content

TAM-6867: Seedling x Canopy status channel — STA spec#354

Closed
dannash100 wants to merge 8 commits into
mainfrom
feature/tam-6867-seedling-x-canopy-establish-implement-the-connection-channel
Closed

TAM-6867: Seedling x Canopy status channel — STA spec#354
dannash100 wants to merge 8 commits into
mainfrom
feature/tam-6867-seedling-x-canopy-establish-implement-the-connection-channel

Conversation

@dannash100

@dannash100 dannash100 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Foundation for Seedling talking to Canopy (TAM-6867): the STA spec plus its device-facing implementation.

The problem: on a Tamanu host, Seedling and the bestool alert daemon share one device identity, so both would report to Canopy as the same server — colliding status streams, with no way to direct a response at just one of them.

Spec

STA (.workhorse/specs/public-server/status.md): each heartbeat is attributed to a named client (defaulting to bestool, so existing agents keep working unchanged), status is kept per (server, client), and the response is scoped to the reporting client.

Implementation

  • Health authority — issues derive from the bestool stream only: another client's checks are stored and answered (severities included) but never open or close issues.
  • Storageadd_client_to_statuses migration (client column, default bestool, + (server_id, client, created_at desc) index); client on the status types and threaded through both insert paths; the heartbeat body takes an optional client field.
  • Scoped responsebackup_now is sent only to bestool (the client that runs backups) and omitted entirely for others; check_severities goes to every health-reporting client; each client gets its own stored record echoed back.
  • Down-detection — a server is not treated as down while any of its clients is still reporting (last_report_for_servers, used by the reachability sweep and the group archive check). Canopy's own views (status board, versions, MCP) keep reading the bestool stream, so another client's sparse heartbeat never masks the authoritative health/version.
  • Client staleness — the flip side: when the server is still reporting but the bestool stream (the health authority) has gone quiet past the down threshold, canopy files a distinct client-stale/bestool issue and resolves it when the client returns — so a dead health reporter isn't masked by another agent keeping the server "up".

Endpoint + DB tests cover attribution/defaulting, response scoping, stream separation, and the any-client-up rule.

@dannash100
dannash100 force-pushed the feature/tam-6867-seedling-x-canopy-establish-implement-the-connection-channel branch 2 times, most recently from 0512a5b to f8bfb59 Compare July 7, 2026 00:51
Comment thread .workhorse/specs/public-server/status.md Outdated
@dannash100
dannash100 force-pushed the feature/tam-6867-seedling-x-canopy-establish-implement-the-connection-channel branch from f8bfb59 to 00eda70 Compare July 7, 2026 01:33
Establish the contract for more than one agent (bestool, seedling)
reporting status under one server identity. A heartbeat is attributed to
a named client (default `bestool` for back-compat); status is kept per
(server, client) so streams and reachability don't collide; the response
is client-scoped so Canopy can direct each agent over the same return
channel. Foundation for the Seedling x Canopy channel (TAM-6867).
@dannash100
dannash100 force-pushed the feature/tam-6867-seedling-x-canopy-establish-implement-the-connection-channel branch from 00eda70 to 411a7d2 Compare July 7, 2026 01:54
@passcod passcod changed the title TAM-6867: Seedling × Canopy status channel — STA spec TAM-6867: Seedling x Canopy status channel — STA spec Jul 7, 2026
@passcod

passcod commented Jul 9, 2026

Copy link
Copy Markdown
Member

fyi #362

@dannash100

Copy link
Copy Markdown
Contributor Author

Superseded by #362.

@dannash100 dannash100 closed this Jul 9, 2026
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.

2 participants