ADR 0019: A Transport Reports Its Connection's Health
Status: accepted, 2026-11-29, by the owner's approval of the twin fallback design (option A); built with it.
Status: accepted, 2026-11-29, by the owner's approval of the twin fallback design (option A); built with it.
Context
The Feishu digital twin answers /dt from the owner's account over the web client's protocol. When that session stops working, through risk control, a protocol change or an expired login, /dt silently reaches nobody in the chats the bot is not in. The owner asked to be told, once, through a connection that still works, and once again when the twin is back.
A Transport cannot send: sending belongs to the Delivery stage, and one plugin instance calling another's API would bypass presentation, receipts and retries. The Host already sends notices to admins (NotifyAdmins, used for a rejected configuration). What is missing is a way for a Transport to say that its connection is up or down.
Decision
- A new optional contract,
plugin.HealthReporter, on theTransportHost:ReportHealth(ctx, Health{State, Key, Params, Reason}), withStateupordown,KeyandParamsa message of the reporting plugin's own locale files, andReasonan optional shorter message key of the same files (with the same parameters): why it is down, asorquelo statusshows it. - The Transport decides when it is down. The Host times nothing; each Transport applies its own policy (the twin: at once for a needed login, after
fallback_after, default 5 minutes, of reconnecting). - The Host tells the admins of the other connections, once a change. It keeps each connection's last state in memory. On a change to
down, and on a change back toup, it renders the plugin's message in each admin's connection locale and queues it as a Host notice to their direct chat, presented and delivered as any notice. The reporting connection's own admins are skipped: it is the one that cannot deliver. A repeated state, and a firstup(a connection starting), tell nobody; the admins' notices of a change are queued in one transaction, and when that fails the change is not taken, so the next report of the same state sends them all, once (Feishu #287, 2026-11-30). - The state does not outlive the Host. A Host that starts with a connection down is told once more. For
orquelo status(2026-11-30, the owner), the running Host writes each reporting connection's state, its reason rendered in the Host's locale, and since when tohealth.jsonin its state directory on every change, including a new reason while it stays down (the since is kept; Feishu #288), and drops a connection a reload removed, so one added back is new (Feishu #289), andorquelo serveremoves the file when it starts, so the record needs no expiry of its own (AGENTS.md section 11).orquelo statusprints a line per reporting connection only while a Host runs, such astwin: down since 09:55 (login required: /login feishu.cn): the time in the local zone, its month and day when not today. A connection that never reported, such as the bot, the console and the HTTP API today, prints none.
Consequences
- ◆New public contract:
plugin.HealthReporterandplugin.Health(pkg/plugin/health.go); the Host renders a plugin's message by key through its instance (registry.Instance.Message), so it holds no channel text of its own. - ◆Only in-process (builtin) Transports can report for now; the process protocol gets a
host.report_healthcallback when an external Transport needs it. - ◆The log records
connection.healthon every change,connection.health_record_failedwhen the record cannot be written or cleared, andadmin.notice_failedas for any admin notice. - ◆
internal/host/connhealthholds the record's format, which the Host writes and the CLI reads. - ◆Any channel can use it; the Host has no Feishu branch.
- ◆Amended 2026-12-04 (Feishu #357): the Host also watches the parts every instance reports (
plugin.StatusReporter, such as an MCP bundle's servers) once a minute; one unavailable for 5 minutes on end is down, and the admins are told once and once again when it works, in the Host's own words (host.instance_down,host.instance_up), recorded in the samehealth.jsonasinstance/partand shown byorquelo status(instance health). No plugin contract is added.