Skip to content

Record stream ownership and log diagnostic restart verdicts - #48

Merged
pjeweb merged 4 commits into
osb/integrationfrom
osb/pr/stream-continuity-records
Nov 15, 2026
Merged

pjeweb merged 4 commits into
osb/integrationfrom
osb/pr/stream-continuity-records

Conversation

@pjeweb

@pjeweb pjeweb commented Nov 12, 2026 •

Copy link
Copy Markdown

Why

When the box's backend restarts in the middle of a stream (after a crash or an update), it stops the running sender, so the stream drops even if nothing about it changed. Keeping an unchanged stream alive across a restart would need the new backend to know exactly what the old one started. Today it has no record of that at all.

What

  • The backend now writes small private records of the sender it starts: the process, the link map it published, the network interfaces at that moment and the latest link report. Arguments are only stored as a digest; credentials and stream settings are left out.
  • At startup it logs a diagnostic result, "adopt" or "tear down", with a reason for each piece of evidence. It never acts on it, and with today's evidence the answer is always "tear down".
  • Streams start exactly as before, with the sender's usual file paths. If a record can't be written, the stream still starts and a fixed warning is logged.
  • Link telemetry writes are bounded: one write at a time plus only the newest pending report.

How: each record is a versioned file with private permissions, written to a temporary file, flushed and renamed, and tagged with the boot identity so it's never reused after a reboot. A pure check compares the records with current evidence without stopping, signalling or adopting anything; the existing shutdown and orphan cleanup stay in charge. apps/backend/docs/agents/stream-continuity-records.md describes the contract.

This is evidence-gathering only; stream behaviour doesn't change.

How to verify

Run apps/backend/src/tests/continuity-records.test.ts, continuity-observer.test.ts and latest-report-writer.test.ts. Start and stop a stream on a dev box and check the startup log line with the "tear down" result and its reasons.

Testing and limits
  • The focused tests, the privileged tests (records stay outside the production runtime directory) and the full backend suite pass, along with lint, type checks, the production build and the sender tests.
  • The tests cover Stop racing a deferred start, a newer start fencing an older one, a stalled disk, a burst of 10,000 reports and recovery after a failed write.
  • Before adoption could ever be switched on, the box still needs proof of native-host ownership and of what the sender actually applied, monotonic timing, and records refreshed on any future sender respawn. None of that exists yet, so adoption is always refused.
  • Not tried on hardware.

Risks

Low: a few small files per stream and one log line at startup. Nothing reads the records to make decisions yet.


Checklist

  • Docs updated if behavior or structure changed (Rule A: AGENTS.md within budget, README, docs/, versions.yaml)
  • User docs (Rule G): no user-visible change, OR ceralive-docs PR updates English and Spanish, plus ceralive-website PR if a landing claim changed
  • Started from updated main; branch rebased on latest canonical branch (Rule B)
  • Rule D local-scratch reference check passes for tracked files
  • Tests pass; QA evidence attached or linked

@pjeweb
pjeweb marked this pull request as ready for review November 14, 2026 08:22
@pjeweb
pjeweb merged commit 1ca252b into osb/integration Nov 15, 2026
3 checks passed
@pjeweb pjeweb added the upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal. label Nov 16, 2026
@pjeweb

pjeweb commented Nov 25, 2026

Copy link
Copy Markdown
Author

Still carried in the integration train and not upstream, so it continues as #248.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal.

Development

Successfully merging this pull request may close these issues.

1 participant