spec+plan(slice-4): barge-in / VAD-driven playout kill on dedicated media thread #6

Merged
alee merged 5 commits from slice-4-barge-in-design into main 2026-07-03 03:07:00 +00:00
Owner

What lands

  • spec: docs/superpowers/specs/2026-07-01-slice-4-barge-in-design.md (613 lines)
  • plan: docs/superpowers/plans/2026-07-01-slice-4-barge-in.md (1601 lines, 10 TDD-stepped tasks)

What slice-4 builds

The FOB reflex loop (spearhead step 4 of 6): on brain speech_started advisory, kill playout from the core-authoritative buffer; resume on first fresh audio_out post-barge. Graduates the 20ms media loop off the tokio pool onto a dedicated std::thread (ARCHITECTURE.md mandate, deferred from slice-1 loop_driver.rs:18-23). Reflex<P: AudioPipe> wrapper in rutster-media (FOB) decorates the pipe — loop_driver.rs + rtc_session.rs stay byte-identical (the §8.5 #6 seam gate, restated).

Merge instructions

  • squash-merge
  • Companion PR for docs/pm-discipline (#5) lands independently
## What lands - spec: docs/superpowers/specs/2026-07-01-slice-4-barge-in-design.md (613 lines) - plan: docs/superpowers/plans/2026-07-01-slice-4-barge-in.md (1601 lines, 10 TDD-stepped tasks) ## What slice-4 builds The FOB reflex loop (spearhead step 4 of 6): on brain speech_started advisory, kill playout from the core-authoritative buffer; resume on first fresh audio_out post-barge. Graduates the 20ms media loop off the tokio pool onto a dedicated std::thread (ARCHITECTURE.md mandate, deferred from slice-1 loop_driver.rs:18-23). Reflex<P: AudioPipe> wrapper in rutster-media (FOB) decorates the pipe — loop_driver.rs + rtc_session.rs stay byte-identical (the §8.5 #6 seam gate, restated). ## Merge instructions - squash-merge - Companion PR for docs/pm-discipline (#5) lands independently
alee added 2 commits 2026-07-02 00:08:11 +00:00
Spearhead step 4 of 6. The FOB reflex loop: on brain speech_started
advisory, kill playout from the core-authoritative buffer; resume on
first fresh audio_out post-barge. Graduates the 20ms media loop off
the tokio pool onto a dedicated std::thread (ARCHITECTURE.md mandate,
deferred from slice-1 loop_driver.rs:18-23). Reflex<P: AudioPipe>
wrapper in rutster-media (FOB) decorates the pipe — loop_driver.rs +
rtc_session.rs stay byte-identical (the §8.5 #6 seam gate, restated).

Decisions (brainstorming 2026-07-01):
- Trigger: advisory-only (brain speech_started/stopped); local VAD deferred
- Resume: first fresh audio_out; SpeechStopped observational only
- Thread: single dedicated std::thread; per-session/threadpool deferred
- Approach C: B's thread model + reflex.rs module (per user selection)

Out-of-scope (§1.2): local VAD, per-session threads, min-mute floor,
brain-side input_audio_buffer.interrupt, TLS, authn, spend cap.

Depends on: slice-1 (media loop + seam), slice-2 (tap + playout buffer),
slice-3 (brain + speech_started/stopped advisory, S4 turn-ownership lock).
plan(slice-4): barge-in implementation plan (10 tasks, TDD-stepped)
All checks were successful
CI / fmt (pull_request) Successful in 1m38s
CI / clippy (pull_request) Successful in 2m30s
CI / test (1.85) (pull_request) Successful in 5m28s
CI / test (stable) (pull_request) Successful in 6m7s
CI / deny (pull_request) Successful in 2m6s
69d5feef59
Structured for multi-agent dispatch per AGENTS.md 5-rule parallelism:
Task 1 = critical-path foundation (AdvisoryEvent + ReflexMetrics +
barge_in_flush trait) — nothing else parallelizes until it lands.
Tasks 2-5 depend on Task 1 (Reflex state machine, barge_in_flush
override, advisory_tx threading, spawn_tap_engine return). Task 6 =
MediaThread (depends on 2+5). Task 7 = session_map rewire (depends on
6). Task 8 = MockRealtimeBrain schedule (parallelizable after 5).
Task 9 = barge e2e (depends on 6+7+8). Task 10 = CI seam gate.
alee added 1 commit 2026-07-02 00:22:01 +00:00
spec+plan(slice-4): revise trigger source — local VAD primary, advisory secondary
All checks were successful
CI / fmt (pull_request) Successful in 1m40s
CI / clippy (pull_request) Successful in 2m31s
CI / test (1.85) (pull_request) Successful in 5m28s
CI / test (stable) (pull_request) Successful in 6m34s
CI / deny (pull_request) Successful in 2m9s
9600839bf7
Responds to the 2026-07-01 adversarial review's load-bearing finding:
advisory-only puts the brain round-trip in the barge-in trigger path,
contradicting wedge #1 (README:98-100, ARCHITECTURE.md:79-81).

Spec changes:
- §1.1: LocalVadReflex<P> added to scope as primary trigger
- §1.2: local VAD tuning framework deferred (the VAD itself in scope)
- §3.4: new — LocalVadReflex design (RMS, debounce, observe-then-delegate)
- §5.1: data flow shows local VAD as primary (≤80ms, zero brain round-trip);
  brain advisory as secondary (confirms ~300ms later)
- §6.1: 'Why advisory-only' → 'Why both, local VAD primary' (revised rationale)
- §7: done-criteria 5-12 (added LocalVadReflex unit tests + two e2e paths)

Plan changes:
- Task 2b: new — LocalVadReflex<P> + 6 unit tests
- Task 5: spawn_tap_engine signature revised (takes advisory_tx parameter;
  media thread owns the channel; two senders via tokio mpsc Sender Clone)
- Task 6: Connected spawn site wires LocalVadReflex<Reflex<TapAudioPipe>>
- Task 9: two e2e cases — PRIMARY (kill WITHOUT brain, wedge #1 proof) +
  SECONDARY (advisory backstop)
- Self-review: wedge-#1 audit line added — Task 9 step 1 is the proof

DCO signoff added per AGENTS.md (commit -s).

Signed-off-by: opencode controller <controller@local>
alee added 1 commit 2026-07-02 14:00:51 +00:00
kickoff(slice-4): PM + dev-a + dev-b prompts for multi-agent execution
All checks were successful
CI / fmt (pull_request) Successful in 1m31s
CI / clippy (pull_request) Successful in 2m20s
CI / test (1.85) (pull_request) Successful in 5m15s
CI / test (stable) (pull_request) Successful in 5m50s
CI / deny (pull_request) Successful in 2m17s
aa9b1be4f0
One plan, two devs, critical-path partition:
- dev-a: Tasks 1 (foundation) → 2 (Reflex) → 2b (LocalVadReflex) → 6 (MediaThread) → 7 (rewire)
- dev-b: Tasks 3 (barge_in_flush) → 4 (advisory_tx) → 5 (spawn_tap_engine sig) → 8 (MockBrain)
- Shared: Tasks 9 (e2e) + 10 (CI seam gate), PM assigns

Relay on localhost:7110 (already running). Roles pm/dev-a/dev-b registered
in ~/Sources/relay/queue.ts. DCO baked into every commit instruction.
Wedge-#1 audit surfaced to PM (Task 9 step 1 must kill WITHOUT brain advisory).

Signed-off-by: opencode controller <controller@local>
alee added 1 commit 2026-07-03 02:44:35 +00:00
spec(slice-4): epoch is load-bearing, not forward-compat
All checks were successful
CI / fmt (pull_request) Successful in 1m44s
CI / clippy (pull_request) Successful in 2m34s
CI / test (1.85) (pull_request) Successful in 5m42s
CI / test (stable) (pull_request) Successful in 6m34s
CI / deny (pull_request) Successful in 2m16s
86b7460586
Propagate the 2026-07-01 two-sender revision (local VAD primary + brain
advisory secondary) into the epoch-rationale sections. §2.1, §3.2, §6.1,
§6.4 previously described barge_epoch as a forward-compat seam for a
deferred local-VAD wrapper; with LocalVadReflex in-scope this slice, the
epoch disambiguates the local-VAD primary trigger from the slower brain
advisory landing on the same event (~300 ms later).

Refs slice-4 spec §3.2, §6.1. DCO-signed.

Signed-off-by: opencode controller <controller@local>
alee merged commit 3f494cb919 into main 2026-07-03 03:07:00 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: alee/rutster#6