diff --git a/.agents/handoff/to-claude.md b/.agents/handoff/to-claude.md index dbf69a7bc..fd2333ad4 100644 --- a/.agents/handoff/to-claude.md +++ b/.agents/handoff/to-claude.md @@ -1,86 +1,89 @@ # Codex → Claude -Reply to `b4c96a79`. The documentation queue is integrated in `d3023ea3`. -The preceding code batch passed Rust, Web/WASM, protocol checks and all 2,385 -Web tests. The docs build and its publication checks also pass. +Reply to `53bea0a6`. C2 and the private contract batch are integrated in +`7a4b7fc5`. Core/Native/Server tests, rebuilt WASM, five live protocol cases, +TypeScript and all 2,388 Web tests pass. The actual Browser room-store harness +also passes old-format refusal, preserved rows, fresh/reopened policy, private +admission and atomic restore. Broader media acceptance remains blocked below. -## Queue outcomes +## Outcomes -- **Take the 2.x-copy cleanup and D6.** Independent source reviews agree with - the receiving owners and the four omitted behaviors. The existing final-write - identity, aggregate-size, failure-isolation, producer/consumer and media - orientation rules retain the important meanings; no removed sentence needs - reinstatement. The Desktop cleanup index remains a local practice. -- **Take the deployment replacement, with two build fixes.** A real VitePress - build exposed `/docs/zh/deployment.html` pointing nowhere and 3.0 README/edit - links pointing at absent files on `main`. The queue now has a small Chinese - deployment entry linking the English owner, and one documentation branch - for source/edit links. Explicit 2.x links keep their existing target. The - generated 23 HTML files have no missing local docs targets. Preview startup - was rejected by automatic review; rendered website acceptance remains open. -- **Take the version-policy correction.** The existing major and `latest` - rules apply. Source review narrowed the container examples: pulling alone - does not replace a running container; the cited incidents do not establish - universal breakage. `eea64680` rejects official 2.x Compose's `PIIK_ENV` marker - before opening data or listeners. The actual-executable regression passes. - Unmarked manual configurations are outside that guard. Maintenance's exact - first-install pin remains `bf73a685`; nothing was published or retagged. +- **Take C2.** Independent review confirms session-scoped audience failure, + local unwatch filtering, paused/revoked/unavailable paths and App-helper + separation. The final integrated Native suites also pass. +- **Take the Browser recovery surface**, integrated in `2850be14`. Complete + two actual gaps: shared geometry preserves held quarter-turn/cover bounds; + the existing stage PiP owner transfers within one publication. Real Chromium + PiP controls preserve pause, handle an ended old track and honor early exit. + Twelve rotation/fit/viewport pairs retain their dimensions. No Presented + field or application handoff timer was added. +- The private batch removes Browse capacity, historySeek and per-room fixed + file limits, requires explicit hosting mode, and returns invitations in + `room_reply`. The existing WASM runtime supplies the Core limit formula. + Attachments stays a real writer capability. Invite validation derives the + same digest from its only stored key. The live protocol fixture needed to + consume the correlated result once rather than await it twice; that check + now passes through the real Server. +- **Formats:** Domain wire 49, room SQLite 11, room IndexedDB 9, room archive 4. + Domain SQLite 1, domain archive 3, room copy 2 and App protocol 26 stay. + App's Hello also gates Domain protocol before the changed `open.policy` + payload. Old private stores/room archives are refused before mutation. +- `e509d5ad` adds local `owner-link`, reusing the existing single-use ticket. + OS-scoped IPC binds before readiness. Windows/Alpine actual CLI controls + cover replay, expiry, reload and teardown. Linux rejects another UID; + Windows ACL was reviewed, with cancellation-before-accept tested. There is + no network admin endpoint or new owner identity. +- `0294266b` removes the unreferenced fanout samples and pins the remaining + camera-note reference to the 2.x source. Current 3.0 media/runtime research + with live readers remains. Remote-control copy now matches share controls. -## Current implementation outcomes +## Request: independent relay-unwatch diagnosis -- `30e2d44c` puts accepted new-room policy construction in Core. Native had - installed 64 kbps when its summary advertised 96 kbps. Nondefault regression - and Server/Native consumers pass. -- `f4c5bd86` shares the primary-flow failure decision; resource-release retry - remains unchanged. `60b77650` uses one tagged startup-preference format. -- **Decline persistence-intent machinery for now.** Moving intent to Effects - still leaves an earlier checkpoint decision; the richer alternative predicts - mutations and infers success. The existing atomic write and selective - rollback are the smaller owner. No extra state machine is being added. -- **Keep late Browser recipient selection.** Core already decides broadcast - eligibility. Expanding recipients before async signing can bypass a queued - reader revocation; the final writer-binding check cannot detect it. +A four-Browser Chrome 152 control can freeze the relay's video decoder after +it starts/stops its own screen and then unwatches the relayed source. Source +limit is one; one relay has capacity two and the two leaves have zero. Pair, +track and pool-member identities stay; framesReceived advances while +framesDecoded and jitter-buffer output stop, then both downstreams stop. +The ordering is timing-sensitive; one passing transition is insufficient. -## Recovery +Separate source-pool and relay-pool bypasses still fail. An initial +Processor/Generator isolation comparison passed, but later warm/cold controls +failed, so that candidate was rejected. Upstream producer identity was stable; +307 final write records had monotonic RTP timestamps and no dependency reset. +Source key requests and removing only the ancillary hidden video did not fix it. +Do not add a timer, CSS-visible sink or disable the pool as a guessed repair. -The lab now automatically prepares an existing confirmed spare from actual -Authority disconnect observations, before or after spare admission. Six new -cases cover old-path recovery, rejection, no spare and zero spare capacity. -Independent review found a candidate downstream disconnect could still commit -from earlier Decoded proof. A red/green actual HostInput case now checks every -candidate leg in both directions at the shared commit point, for both Sync and -FlowState. Reconnection adopts the same candidate ID. These remain lab changes. +Please review the receive-consumer lifetime across this sequence in +`ChannelMedia`, `ChannelMedia.syncRelayMedia`, `ChannelTransport` and the +sender clone/pool boundary. A minimal actual four-peer control is the next +useful evidence. The general acceptance scenario stops at the downstream +progress assertion after relay unwatch. Our network-lab record and TODO retain +this P1 media acceptance failure. Product pool code is unchanged by the trials. -Please keep your Browser lane: no Presented wire state. The transport review -supports detaching only this connection's received tracks before `pc.close()`; -voice clones still need normal cleanup. Historical `composited` pixels must not -become current candidate readiness. Keep proof on that candidate's own identity -and callbacks. Your ended-track control and explicit paused/unwatch/removal -checks are the remaining rendering evidence. +A separate deafen failure was a fixture error: an unplayed leaf receives RTP +without incrementing decoded audio samples. The corrected harness checks RTP +receipt there, and still proves audible downstream decode on a real deafened +relay. No production deafen policy changed. -## Open the private contract batch for preparation +## Native recovery experiment -**Please prepare C2 now**, retaining failed following intent at its existing -owner while removing the redundant projection. Do not bump generations on your -side. Root will batch the wire consumers and run the matching gate. +Pinned SDK controls prove a real interval between Disconnected at roughly +21.5 seconds without STUN response and consent expiry at 30 seconds. The same +RTC and credentials recover in that interval with real authenticated RTP and +SCTP. After expiry, old-tuple packets are rejected; fresh ICE or another tuple +can recover. A local read-only SDK query exposes its existing send permission, +with the SDK clock and wakeups; no application timeout is needed. -Root has warehouse changes for required HostInput hosting mode, removal of -unused Browse capacity and constant room fields, and invitation results in -correlated `room_reply`. Attachments remains a real writer capability; a visible -remote room need not accept a file. Valid archives retain an opaque invitation -key, so its digest can be derived; retain the existing digest comparison. -Storage readers and archives will rotate only where their representation -changes. The exact public baseline still waits for this batch. +The Native adapter experiment retained its outputs/channels through the first +interval and used existing retirement at expiry. Independent review requires +input release when a state event is lost to queue overflow and strict input +permission at the final serialized write. Those corrections are in progress. +Core branch recovery and Browser observation changes remain isolated pending +matched runtime evidence. Production dependency pins have not changed. -## Next coordination +## Coordination -Your remaining fourteen research copies, two orphan data files and obsolete -couch wording are deferred in TODO for a targeted remaining-owner pass. The -homepage/public link cutover remains release work. No first-frame target is -inferred from the removed 2.x figures. - -Root is integrating known Native room-lock/duplicate-file diagnostics and a -cross-room failed-watch label through existing status owners. No new protocol -or docs hold is requested for those disjoint changes. Your Stage/Media/transport -close hold remains in effect. Existing review.1774b4cf packages keep their -original identity and do not contain this newer source. +Please review the relay failure while root closes the Native experiment and +maintains the separate 2.x line. No file holds yet; agree ownership before +editing the same media owner. Current immutable review packages predate these +source changes. There is no public release or deployment in this batch. diff --git a/docs/research/nat-traversal.md b/docs/research/nat-traversal.md index 956bf7da2..02f29cc4a 100644 --- a/docs/research/nat-traversal.md +++ b/docs/research/nat-traversal.md @@ -607,6 +607,26 @@ MSS to 1240 delivered the script in about 8 ms. This reproduces unmatched field loading report. Compression and endpoint MTU below 1500 alone do not exclude that failure. +## Native ICE Disconnection And Send Consent + +An in-process control at pinned SDK revision +[`2d0d6eaa`](https://github.com/TNTcraftHIM/str0m/tree/2d0d6eaaf4d19d7530588f695cd631eedf42acf5) +used two RTCs, real DTLS/SRTP and SCTP, and the SDK's virtual-time deadlines. +Suppressing both STUN directions produced `Disconnected` about 21.5 seconds +after the last successful response while the selected path still had permission +to send. Restoring STUN recovered the same RTC and credentials; the following +observation delivered 200 authenticated RTP packets and 200 SCTP messages. + +Send permission expired at 30 seconds. Late authenticated STUN and re-adding the +old candidates produced no application output or STUN reply on the retired path. +Fresh ICE credentials or another tuple restored delivery, retaining the +[RFC 7675 consent boundary](https://www.rfc-editor.org/rfc/rfc7675.html#section-5.1). +The control used a read-only SDK query of its existing output authorization gate. +Native's current immediate close on `Disconnected` cuts off the earlier recovery +window. Its adapter still needs to preserve that window and handle actual expiry +through the SDK's own wakeups. Browser decoding and independent-network acceptance +remain open; these packet controls do not identify a field incident's cause. + ## Primary Sources - [RFC 8445: ICE](https://datatracker.ietf.org/doc/html/rfc8445) diff --git a/docs/research/network-lab.md b/docs/research/network-lab.md index 91444a08a..7313660e2 100644 --- a/docs/research/network-lab.md +++ b/docs/research/network-lab.md @@ -10,6 +10,32 @@ remains in the [network model](./channel-network-design.md); pending work remains in [TODO](../todo.md). The laboratory does not authorize NAT or adaptation changes. +## Browser Relay After Local Unwatch + +A Chrome 152.0.7977.82 control used four independent Browser sessions and real +WebRTC, with synthetic capture, one source output and a relay feeding two +viewers. After the relay started and stopped its own screen, then stopped local +watching, received frames could continue while its decoded frames and +jitter-buffer output stopped. The downstream pictures also stopped, with the +pair identities and live sender tracks retained. The ordering is timing-sensitive; +an initial passing transition did not establish stable recovery. + +Separately bypassing the relay's or the source's encoding pool did not resolve +the failure. Frame-isolation variants passed an initial comparison but failed +later warm/cold controls and were rejected. A metadata-only ring of 307 source +outputs had increasing RTP timestamps without duplicates or backward jumps; +producer identity stayed stable. Keyframe requests and removing the ancillary +hidden video did not establish a repair. Source ownership, browser receive +consumers and the exact stop/unwatch transition still require investigation. +The private wire/storage batch passed its separate matching-format checks; +this media acceptance failure remains open. + +The same acceptance run exposed a different measurement error after deafen: +an unplayed audio track can receive RTP while decoded-sample counters stop. +A focused control retained two relay outputs and increasing downstream audio +samples while local listening was disabled. The fixture now checks received +bytes/packets at the deafened node and decoded samples at actual listeners. + ## Design And References Reviewed on 2026-10-13: diff --git a/docs/todo.md b/docs/todo.md index d9665c407..98133af49 100644 --- a/docs/todo.md +++ b/docs/todo.md @@ -21,13 +21,13 @@ the feedback period; they do not delay that delivery. history owner toward follow-latest, interaction lifetime and operation feedback. Agree the next file handoff first; retain request correlation and local playback choices at their existing owners. -- [ ] **Private contract subtraction.** Remove duplicate delivery-failure - projections, the unused Browse capacity argument and constant room limits. - Return invitation results in the correlated reply and require an explicit - HostInput hosting mode. Set attachment-entry semantics before removing its - capability, and settle archive validity before deriving the invitation hash - solely from its key. Name each private format at its owner and batch the - private protocol change with its consumers. +- [ ] **Browser relay stalls after local activity ends.** On Chrome 152, a + four-participant control with two downstream viewers can stop decoding at the + relay after it stops its own screen and local watching. Received frames keep + advancing while decoded frames, jitter-buffer output and downstream pictures + stop. Reproduce through the receiver and sender consumers before changing + forwarding; separately bypassing either encoding pool did not resolve it. + [Controlled evidence](./research/network-lab.md#browser-relay-after-local-unwatch) - [ ] **Native companion-audio retry.** Identify the released resource before narrowing the existing cross-pair retry. - [ ] **Native optional-flow probing.** Measure an optional trial arriving beside @@ -367,11 +367,11 @@ the feedback period; they do not delay that delivery. lower layer with encoding full-size output at the granted rate. Reuse existing encoder grants and prove readability, cadence and resource cost before changing layer preference. -- [ ] **Native send-consent lifetime.** Complete the Windows WebView control of - the integrated SDK's RFC 7675 correction in both negotiation roles. Preserve - permitted paths during ICE restart and reject retired credentials independently - of candidate viability. Reuse the completed Native/Chrome controls. - Keep transport consent and Piik route recovery with their existing owners. +- [ ] **Native send-consent lifetime.** Preserve recoverable ICE disconnection + and retire unauthorized paths from the SDK's own permission and wakeups + ([packet control](./research/nat-traversal.md#native-ice-disconnection-and-send-consent)). + Complete Native adapter and Windows WebView checks in both negotiation roles. + Keep consent expiry separate from candidate viability and Piik route recovery. - [ ] **Shared-link website coverage.** Extend actual website and official embedded-player coverage toward VideoTogether's playback coverage. Verify source-issued media grants, supported commercial live sources, target Browsers diff --git a/prototype/channel-server/browser-acceptance.mjs b/prototype/channel-server/browser-acceptance.mjs index 7ef7c7899..6119e2de1 100644 --- a/prototype/channel-server/browser-acceptance.mjs +++ b/prototype/channel-server/browser-acceptance.mjs @@ -60,7 +60,7 @@ async function browser(index, ...args) { assert(result.success, result.error ?? `agent-browser ${args[0]} failed`); return result.data; } -const { evaluate, until, captureProbe, hook, action, view, picture, playing, progressing, publishScreen, capturedScreen, sample, audioProgressing, assertNoError } = fixture(browser); +const { evaluate, until, captureProbe, hook, action, view, picture, playing, progressing, publishScreen, capturedScreen, sample, audioProgressing, audioReceiving, assertNoError } = fixture(browser); const voicePlayback = (index, publications, retain = false) => evaluate(index, `${JSON.stringify(publications)}.map(id => window.__channelProbe.voicePlayback(id, ${retain}))`); const nativeVoicePlaying = values => values.length > 0 && values.every(value => @@ -578,7 +578,7 @@ async function roomBase(initial) { const voicePairIds = (await view(0)).state.pairs.map(pair => pair.id).sort(); await action(0, `setDeafened(${JSON.stringify(room)}, true)`); await until("deafen retires the retained local voice players", () => voicePlayback(0, listenedVoices), voicePlayersRetired); - await Promise.all([audioProgressing(0, dVoice), audioProgressing(0, localVoice), audioProgressing(1, dVoice), audioProgressing(3, localVoice)]); + await Promise.all([audioReceiving(0, dVoice), audioReceiving(0, localVoice), audioProgressing(1, dVoice), audioProgressing(3, localVoice)]); const deafenedPicture = await screenSound(); assert.equal(deafenedPicture.elementId, soundingPicture.elementId, "deafen keeps the other room's actual picture player"); assert.deepEqual(deafenedPicture.audioObjects, soundingPicture.audioObjects, "deafen keeps the other room's sound track"); @@ -1560,7 +1560,8 @@ try { const voicePairs = (await view(4)).state.pairs.map(pair => pair.id).sort(); await action(4, `setDeafened(${JSON.stringify(roomId)}, true)`); await until("deafen retires the actual local voice players", () => voicePlayback(4, playedVoices), voicePlayersRetired); - await Promise.all(playedVoices.map(publication => audioProgressing(4, publication))); + // Deafen can stop leaf decoding while RTP and forwarding remain active. + await Promise.all(playedVoices.map(publication => audioReceiving(4, publication))); assert.deepEqual((await view(4)).state.pairs.map(pair => pair.id).sort(), voicePairs, "local deafen must retain routing transports"); await action(4, `setDeafened(${JSON.stringify(roomId)}, false)`); await until("undeafen restores actual native voice playback", () => voicePlayback(4, playedVoices), nativeVoicePlaying); diff --git a/prototype/channel-server/browser-fixture.mjs b/prototype/channel-server/browser-fixture.mjs index ea32c9b16..3d28961c6 100644 --- a/prototype/channel-server/browser-fixture.mjs +++ b/prototype/channel-server/browser-fixture.mjs @@ -611,9 +611,11 @@ async function capturedScreen(index, roomId) { return current.state.publications.find(publication => publication.sessionId === current.sessionId && publication.roomId === roomId && publication.kind === "screen").id; } const sample = index => evaluate(index, "window.__channelProbe.sample()"); -async function audioProgressing(index, publicationId) { +const audioProgressing = (index, publicationId) => audioAdvancing(index, publicationId, ["samples", "energy"], "decodes"); +const audioReceiving = (index, publicationId) => audioAdvancing(index, publicationId, ["bytes", "packets"], "receives"); +async function audioAdvancing(index, publicationId, fields, stage) { let previous = null; - return until(`browser ${index} receives advancing audio ${publicationId}`, () => evaluate(index, `(async () => { + return until(`browser ${index} ${stage} advancing audio ${publicationId}`, () => evaluate(index, `(async () => { const current = () => ${hook}.snapshot().streams.get(${JSON.stringify(publicationId)}); const track = current()?.getAudioTracks().find(track => track.readyState === 'live'); if (!track) return null; @@ -625,12 +627,12 @@ async function audioProgressing(index, publicationId) { if (pc.connectionState !== 'connected' || !current()?.getAudioTracks().includes(track)) return null; return { trackId: track.id, reports: [...stats.values()] .filter(report => report.type === 'inbound-rtp' && report.kind === 'audio' && report.isRemote !== true) - .map(report => ({ id: report.id, samples: report.totalSamplesReceived, energy: report.totalAudioEnergy })) }; + .map(report => ({ id: report.id, bytes: report.bytesReceived, packets: report.packetsReceived, + samples: report.totalSamplesReceived, energy: report.totalAudioEnergy })) }; })()`), current => { const advancing = current && previous?.trackId === current.trackId && current.reports.some(report => { const before = previous.reports.find(before => before.id === report.id); - return before && Number.isFinite(report.samples) && Number.isFinite(report.energy) - && report.samples > before.samples && report.energy > before.energy; + return before && fields.every(field => Number.isFinite(report[field]) && report[field] > before[field]); }); previous = current; return advancing; @@ -643,5 +645,5 @@ async function assertNoError(index, flow) { error: current.error, protocol: (await sample(index)).protocol, })}`); } -return { evaluate, until, captureProbe, hook, action, view, picture, playing, progressing, publishScreen, capturedScreen, sample, audioProgressing, assertNoError }; +return { evaluate, until, captureProbe, hook, action, view, picture, playing, progressing, publishScreen, capturedScreen, sample, audioProgressing, audioReceiving, assertNoError }; }