Repository navigation
Protect carried client streams during idle admission - #69
Merged
Merged
Conversation
This was referenced Nov 13, 2026
This was referenced Nov 13, 2026
This was referenced Nov 15, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 16, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 17, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 17, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 18, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 18, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 19, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 21, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 22, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 23, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 24, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 24, 2026
Author
|
Still carried in the integration train and not upstream, so it continues as #238. |
pjeweb
added a commit
that referenced
this pull request
Nov 25, 2026
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.
Why
A phone can stream through the box while the box's own encoder is idle. Before this PR, the box could treat that moment as idle and allow an update that is only meant to run when nothing is streaming, cutting off the phone's stream.
What it adds
Screenshots
Mock data; the same state at the PR base and head.
How
Carrying evidence (upload rate on the client-facing side, SRT connection events and RTMP publisher polling) now feeds the box's existing liveness answer and idle clock. It also shares ownership of the OTA marker, the flag file the image's update activator checks before it switches to a new system copy: the marker stays set while either the encoder or a carried stream is live. A shared idle-action policy is added for later automations (home AP pause, home cellular exclusion, heat idle rest); those are separate topics and are not enabled here.
Targets the fork integration branch. #70 builds on this PR.
Technical detail
A phone can stream through a box whose own encoder is idle. Previously that box could grant idle-only update admission. Client carrying now contributes to the existing liveness answer and the idle clock, with shared ownership of the OTA activation marker.
Client-facing upload above 1 Mbit/s for 20 seconds qualifies, followed by a two-minute hold. SRT connection events and RTMP publisher polling protect immediately; unreadable evidence withholds idle permission. Notices explain why updates and link changes wait. Large local uploads can conservatively hold idle actions too.
The shared idle-action policy covers home AP pause, home cellular exclusion and heat idle rest. Those automation implementations are separate topics and are not enabled by this change. Future independent sender/relay owners must report their session through the supplied evidence seam. Emergency thermal safety limits retain authority.
The own-stream idle explanation uses an additive key, preserving the immutable catalog oracle.
Review fixes
A brief sample at or below 250 kbit/s no longer opens an idle admission window during qualification: entry-level evidence withholds idle for 20 seconds. Repeated 0/200 kbit/s dips every 10–15 seconds remain protected; a lone burst still expires without claiming carrying.
Startup uses its own fixed 120-second checking deadline and reports unknown until real evidence exists. Ambient keep-level traffic cannot extend it. The idle clock still includes the startup boundary.
Manual refusals now say the action was not run and ask for a new attempt, in all ten locales. They neither queue the action nor assert that any stream ended. Power and SSH use the backend’s named refusal notification without an additional frontend toast; add-on/display refusals use the same corrected copy in their existing frontend feedback. Transport and execution failures retain their feedback.
A refused loopback connection or an absent legacy RTMP statistics resource reports no legacy RTMP session. Malformed replies, server errors and timeouts remain distinct: they withhold idle for up to 120 seconds of consecutive failures, then release this optional source. The full request/body budget is two seconds, with overlapping polls suppressed. Other carrying owners remain authoritative; this is not MediaMTX session discovery.
Upload entry still begins above 1 Mbit/s with a 20-second qualification. A 250 kbit/s keep threshold tolerates adaptive dips during qualification and refreshes an established hold. Only real session or qualified-upload protection can be extended by this traffic. Qualification activity contributes to the idle clock, which ages from the final hold boundary.
Every backend startup seeds a fresh 120-second protection window, covering a restart that loses the prior in-memory hold. A quiet box subsequently reaches idle; updates, reboot and power-off cannot use the first sample as an admission gap.
Client-aware refusal copy no longer directs a phone stream to the box's Stop button. Notices explicitly cover restart and power-off, with translations in all ten catalogs. Existing refusal tokens and admission checks are retained.
The OTA marker changes only when protection changes; failed writes remain retryable. Notices remain deduplicated by state.
The typed
carryingstatus field, independent forwarding-sender reporter and HUD rendering belong to the sender/status follow-up. This PR deliberately leaves those fields and the primary HUD label to that owner; the HUD limitation remains until the follow-up lands.New regressions cover a real refused loopback endpoint, genuine/malformed/absent HTTP responses, a stalled body, overlapping polls, threshold dips and sustained lower bitrate, cold startup/restart, marker write deduplication, and idle-clock aging after the hold. The initial regression run failed before implementation.
Second-review regressions were written and observed failing before implementation: deep/stalled qualification dips, startup/restart state and ambient upload expiry, truthful refusal copy, and duplicate frontend refusal feedback. Existing burst-boundary expectations now include the bounded checking window. Startup publication is checked for the unknown notice, with OTA protection retained.
Validation
Validation includes the engine-less boot regression, counter and hold boundaries, OTA-owner interleavings and a veth phone uploading through a shaped forwarding path. No hardware qualification is claimed. Initial validation receipts (superseded by the review-fix validation below):
After the copy correction, the complete i18n package passes 808/808; focused HUD and locale-parity tests pass 45/45. The full frontend suite was not repeated after these corrections. No browser E2E or hardware continuity test was run.
Review-fix validation: backend 12,672 passed / 20 skipped / 0 failed across 1,104 files; frontend 7,650/7,650 across 459 files plus four preflight tests; i18n 819/819; RPC 827/827; sender helpers 123/123. The final focused regression run passed 11/11. Lint, all type checks, technical-debt and workspace checks passed. Bun 1.4.4 used explicit
--parallel=1 --max-concurrency=1; frontend tests used Node 24 with--maxWorkers=1. Gates ran sequentially in transient units with UMask 0022, Nice 10, CPUWeight 50, C locale and the PID namespace wrapper. No browser E2E, new forwarding-namespace run or hardware test was performed for this revision.Second-review validation: backend 12677 passed / 20 skipped / 0 failed; frontend 7662/7662 across 459 files plus 4 preflight tests; i18n 820, RPC 827, sender helpers 123. Final focused backend regressions 24/24; final focused frontend 110/110. Lint, types, technical-debt and workspace checks passed. Bun 1.4.4 suites used --parallel=1 --max-concurrency=1; frontend used Node 24 and --maxWorkers=1. All authoritative gates ran in transient units with UMask 0022, Nice 10, CPUWeight 50, C locale and the PID namespace wrapper. No browser E2E, hardware test, deployment or upstream write was performed.
The explicit one-worker preflight clears Bun’s inherited JEST_WORKER_ID before spawning the separate Playwright inventory command; the unmodified package invocation also passes. No tests or production source were changed for this runner-environment adjustment.