Skip to content

fix(discord): preserve realtime speaker and playback ownership - #137433

Merged
steipete merged 2 commits into
mainfrom
codex/discord-realtime-speaker-identity
Sep 3, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/discord-realtime-speaker-identity

Conversation

@steipete

@steipete steipete commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #137349. Related: #123243, #136982.

Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.

What Problem This Solves

Fixes an issue where users speaking in a shared Discord voice channel could have a delayed transcript dispatched as another participant, including that participant's owner/tool context. Later audio could also consume the earlier speaker's wake-name follow-up or leave a second final transcript without a reply.

The repaired flow also prevents one speaker's generated audio from replacing another answer on the room player, and prevents interrupted audio from restarting when late provider chunks arrive. Google Live now reports native response completion, so completed or interrupted replies release queued speech.

Why This Change Was Made

A realtime provider connection now belongs to one Discord speaker for its entire lifetime. Transcript and native-tool callbacks inherit that fixed principal; capture timing, text matching, and model-supplied names no longer determine identity. The room retains the existing shared OpenClaw agent route and owns one physical playback queue. Subscription replacements let old spoken replies drain while fencing transcript delivery; authority changes retire old connections; source failures stay local; idle connections are reclaimed.

The shared voice runtime admits explicit text and greeting requests before provider dispatch, allowing even an empty response from a provider without OpenAI-style lifecycle events to finish. Google maps turnComplete to the canonical completed/cancelled outcome; generationComplete alone does not finish a turn. Accepted interruptions discard remaining audio until the provider's terminal event. Each output owns its own PCM stream, room-player request, drain callback, and watchdog, so a later native continuation cannot inherit an ended stream. Normal player starvation allows the same response to resume; actual encoder failure fences its remaining audio. Reconnect uses each exact-speech request's recorded playback fact to avoid replaying speech already heard.

Alternatives considered: keeping a current-speaker/FIFO queue cannot distinguish delayed, missing, or multiple finals. OpenAI/xAI transcript item IDs do not establish which input principal owns a native tool call, and the inspected OSS Codex frameless contract exposes transcript text/delegation IDs without Discord-source ancestry. A separate connection per principal provides the common ownership boundary without inventing provider wire fields or switching to batch STT/TTS.

User Impact

Realtime voice remains enabled and agent-backed room conversation history remains shared. Direct bidi model history is scoped to each speaker's realtime connection; agent consults provide shared room history. Multiple speakers use more provider connections. The room retains at most eight connections and reports busy admission rather than transferring identity; provider account limits still apply. Existing voice configuration is preserved, with no new configuration keys, dependencies, database changes, or protocol version changes. The bounded connection policy and production growth were reviewed and retained in the capacity/rank-up decision.

Release-note context: Discord realtime voice preserves speaker identity across delayed transcripts and tool calls, serializes room playback, fences interrupted audio, and recovers failed speaker connections. Google Live correctly completes normal and interrupted replies, including empty host-requested responses.

Evidence

  • Exact baseline 907f6956ee5eae23d8a44fe224fd8bcd5faefefd: the guest/owner reproduction dispatches a delayed guest question with senderIsOwner: true; the repaired manager retains u-guest / false. Nine of ten new speaker lifecycle tests fail against the baseline; the roster-refresh preservation case passes both.
  • Real OpenAI GA audio and provider connections, the real Discord voice-manager ingress, and the real Discord AudioPlayer/Opus encoder reproduce the baseline error and verify both speakers' repaired dispatch and spoken completion (151,200 PCM bytes, two complete playback cycles, zero provider errors). All 14 copied source hashes matched the live-tested snapshot; subsequent changes use lint-required toReversed() and preserve fully idle speakers when another speaker stops the room. The final 28-case real-player suite covers both the active and pending control branches. Discord transport and agent replies are synthetic; this is not a live Discord socket/microphone-room claim.
  • Real Google Live baseline produced 103,682 PCM bytes and native turnComplete, but no canonical completion. Repaired live run produced 417,156 PCM bytes with outcomes completed, completed, cancelled, completed, including audio interruption and a subsequent reply; zero provider errors.
  • Twenty-eight real-player/Opus cases cover FIFO overlap, a long queued answer, isolated clear/close, stale terminal events, room controls, preroll interruption, player-start failure, suppression of interrupted audio before its first PCM, terminal callback reentry, native continuations before and during earlier playback, starvation recovery, encoder-error isolation, suppression of already-heard speech on reconnect, and room controls that preserve idle speakers' completed replies. Eventless-provider regression tests prove empty text/greeting completion and closed-session dispatch fencing.
  • Combined targeted suite: 538 passed across all Discord voice tests, the three Google realtime suites, and shared talkback/session/harness tests.
  • CI identified two transcript-tool integration expectations that still treated a speaker provider closing as the room ending. The corrected integration test proves the capture stays active through speaker recovery, accepts the recovered transcript into the same recording, fences retired callbacks, and finalizes on explicit room leave. All existing historical/replacement-capture checks remain. The lifecycle/provider/source suite passes 23 tests (source cases overlap the 538-test suite); changed-file format, typecheck, and lint checks pass. This follow-up changes tests only.

The lead personally inspected OSS Codex 728cb12fe5794b0c3a8e776fb4994b1650b973a8, particularly codex-rs/codex-api/src/endpoint/realtime_websocket/protocol_frameless_bidi.rs:20,48,58,73, protocol_v2.rs, and protocol.rs. Provider contract evidence also includes Google Live's native server-content lifecycle.

Production LOC: +1,426/-883 (net +543), tests/support +1,691/-472 (net +1,219), docs +3/-2. The old room runtime moves into the speaker owner; most of that module is unchanged. Growth adds the per-principal connection/drain lifecycle, a single room playback owner, and generic request/terminal ownership. Redundant audio-admission state, retained roster copies, and the lane-wide shared stream/reset/watchdog path were removed. The response-owned playback refactor and idle-source control guard add 30 production lines. A net-neutral timing-queue patch cannot establish the missing source identity or arbitrate concurrent provider output. Discord no longer uses the old context tracker; its existing private runtime export is unchanged. This is not a typed public SDK compatibility promise: both stable v2026.8.2 and the merged package classify realtime-voice as private and exclude its declarations.

Remaining protocol limit: Google Live and the inspected Codex frameless protocol do not expose a response-start event before any automatic output. This repair tracks actual native starts where provided and host-requested speech; it does not invent starts from input transcripts or promise cancellation of an entirely unobserved automatic response. Retiring such a provider connection would be a separate lifecycle design.

Provenance: the affected shared-input/context-pruning path is reachable in stable v2026.8.2; the introducing commit has not been established. #123243 repaired a later await-order race, while this repair addresses source attribution before transcript delivery.

Named follow-up: #137417 records the pre-existing mismatch between the newest generated native audio item and the item currently audible. Baseline synthetic GA bridge proof rejects interruption using a short queued item; fixing heard-duration/truncation identity requires a separate provider/transport metadata contract. This PR does not override the provider's intentional echo-duration guard.

Validation commands: node scripts/run-vitest.mjs extensions/discord/src/voice extensions/google/realtime-voice-provider.test.ts extensions/google/realtime-voice-transcript-finality.test.ts extensions/google/realtime-voice-meeting.test.ts src/talk/agent-talkback-runtime.test.ts src/talk/session-runtime.test.ts src/talk/realtime-session-harness.test.ts; node scripts/check-changed.mjs; pnpm build. Independent Codex autoreview: full candidate, P0–P2, scoped-clean after repairing the accepted playback findings; fresh test-only follow-up review also scoped-clean through P2 at 565c8533bced0a6fbef8e87f90534739513282a4.

Build note: pnpm build exited successfully while emitting a UI startup gzip budget advisory (350,147 bytes versus the 350,141-byte enforcement limit). This change contains no UI source edits.

Private runtime contract: onResponseRequest synchronously admits supported host text/greeting requests before provider dispatch; it is skipped for blank text, unsupported methods, and inactive sessions. The session rechecks admission after the callback. The harness establishes turn ownership first, so synchronous empty responses can finish. This hook does not represent automatic provider response starts or tool-result continuations, and does not promote the existing private realtime runtime subpath into the typed public SDK.

Bind provider connections to one Discord principal so delayed transcripts
and native consultations cannot inherit another speaker's authority.
Keep the shared agent route and serialize response-owned audio on one
room player, preserving continuations and recovery after playback gaps.

Admit host-requested responses before dispatch and map Google Live turn
completion to canonical terminal outcomes so queued speech can finish.

Closes #137349
Related: #136982, #123243
Follow-up: #137417
@steipete steipete self-assigned this Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord extensions: google size: XL maintainer Maintainer-authored PR labels Sep 3, 2026
@steipete
steipete marked this pull request as ready for review September 3, 2026 16:54
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 3, 2026, 1:28 PM ET / 17:28 UTC.

ClawSweeper review

What this changes

This PR gives each Discord realtime speaker a separate provider connection, retains shared agent routing and room playback, and completes Google Live responses at their native turn boundary.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep open for maintainer handling: this is a current, non-redundant fix for the linked Discord voice ownership bug. The implementation correctly moves principal binding to the speaker-owned provider connection and preserves one room player, but it adds a public plugin-SDK lifecycle callback that needs an explicit compatibility decision before merge.

Priority: P1
Reviewed head: 565c8533bced0a6fbef8e87f90534739513282a4
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The ownership and playback repair is well-covered and accompanied by detailed real-provider evidence, but the public SDK expansion remains an unconfirmed merge contract.
Proof confidence 🦞 diamond lobster (5/6) Not applicable: The contributor proof gate does not apply because repository state identifies this as a member-authored PR. Its body nevertheless supplies after-fix real OpenAI/Google provider and real Discord-player traces for the changed speaker and playback boundaries; those traces were not rerun in this read-only environment.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The contributor proof gate does not apply because repository state identifies this as a member-authored PR. Its body nevertheless supplies after-fix real OpenAI/Google provider and real Discord-player traces for the changed speaker and playback boundaries; those traces were not rerun in this read-only environment.
Evidence reviewed 9 items Speaker ownership implementation: The new room session creates or reuses a session by Discord user, retires it when owner status changes, and keeps the provider session associated with that user rather than a shared current-speaker queue.
Authority and stale-callback coverage: The new regression coverage exercises guest/owner ordering, preserves each speaker’s agent context and transcript label, and blocks callbacks from a retired admission before agent dispatch.
Playback owner boundary: The shared player retires the active request before synchronous Idle delivery and serializes queued output, while each lane owns its own output stream and completion callback.
Findings None None.
Security None None.

How this fits together

Discord voice captures speaker audio, sends it through a realtime provider connection, routes accepted transcripts to the OpenClaw agent, and plays replies through one Discord room player. The PR makes the provider connection the owner of a speaker’s identity while the room remains the owner of playback ordering.

flowchart LR
  Audio[Discord speaker audio] --> Lane[Speaker-owned provider connection]
  Lane --> Transcript[Transcript and tool callbacks]
  Transcript --> Agent[Shared OpenClaw agent route]
  Lane --> Output[Response-owned audio]
  Output --> Player[Shared room playback queue]
  Player --> Room[Discord voice room]
Loading

Decision needed

Question Recommendation
Should onResponseRequest become a supported public realtime-plugin lifecycle callback, or should synchronous response admission remain an internal harness detail? Accept and document the callback: Treat it as an additive supported plugin SDK lifecycle hook and document its ordering and lifecycle guarantees.

Why: The callback is added to an exported SDK type, while the visible capacity discussion does not decide that external plugin contract.

Before merge

  • Resolve merge risk (P1) - The introduced onResponseRequest field expands the exported realtime plugin SDK; without an explicit supported-contract decision and documentation, it creates an uncalibrated external compatibility commitment.
  • Resolve merge risk (P1) - Independent Google API type inspection and the required docs listing were unavailable in this read-only environment: @google/genai is declared at 2.18.0 but not installed locally, and Corepack/DNS could not obtain it. This is a reviewer limitation, not missing contributor proof.
  • Complete next step (P2) - Confirm whether onResponseRequest is a supported public realtime plugin SDK callback and document the chosen compatibility commitment before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +543, Tests +1219, Docs +1. Total +1763 across 27 files.

View PR surface stats
Area Files Added Removed Net
Source 11 1426 883 +543
Tests 15 1691 472 +1219
Docs 1 3 2 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 27 3120 1357 +1763

Review metrics

Metric Value Why it matters
Production versus test delta production +1,426/-883 (net +543); tests/support +1,691/-472 (net +1,219); docs +3/-2 The net production growth implements a new principal and room-playback ownership boundary, so its SDK contract needs explicit review.
Plugin SDK lifecycle surface 1 additive callback (onResponseRequest) The new exported lifecycle hook is a compatibility commitment independent of the Discord-only bug fix.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #137349
Summary: This PR is the active candidate fix for the canonical delayed-speaker-attribution report; the other linked items cover earlier timing work, adjacent playback work, and a separate interruption-identity follow-up.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Confirm the public lifecycle contract (recommended)
    Before merge, explicitly accept onResponseRequest as additive plugin SDK API and document its lifecycle semantics.
  2. Avoid expanding the SDK
    Keep synchronous response admission private to the shared harness if no supported external caller needs this callback.

Technical review

Best possible solution:

Keep the speaker-owned connection and shared-player design, then explicitly accept and document onResponseRequest as an additive realtime plugin SDK contract or refactor response admission behind a non-public harness seam.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: the new guest/owner ordering test drives distinct provider connections and verifies the delayed transcript reaches agent ingress with its original owner flag. The PR body also records a real-provider/real-player run, but it was not rerun in this read-only review.

Is this the best way to solve the issue?

Unclear: the per-speaker connection is the cleanest demonstrated fix for missing wire-level source ancestry, but the added exported callback needs a deliberate SDK-contract decision before this can be called the best complete solution.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 41344e0b7dbd.

Labels

Label changes:

  • add P1: The PR repairs potentially privilege-bearing speaker attribution and realtime reply delivery in an established Discord workflow.
  • add merge-risk: 🚨 compatibility: An additive callback is introduced through the public realtime plugin SDK type and needs an explicit contract decision.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The contributor proof gate does not apply because repository state identifies this as a member-authored PR. Its body nevertheless supplies after-fix real OpenAI/Google provider and real Discord-player traces for the changed speaker and playback boundaries; those traces were not rerun in this read-only environment.

Label justifications:

  • P1: The PR repairs potentially privilege-bearing speaker attribution and realtime reply delivery in an established Discord workflow.
  • merge-risk: 🚨 compatibility: An additive callback is introduced through the public realtime plugin SDK type and needs an explicit contract decision.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The contributor proof gate does not apply because repository state identifies this as a member-authored PR. Its body nevertheless supplies after-fix real OpenAI/Google provider and real Discord-player traces for the changed speaker and playback boundaries; those traces were not rerun in this read-only environment.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm and document the public onResponseRequest lifecycle contract, or keep response admission behind an internal harness seam.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-03T17:04:35.076Z sha 719713a :: blocked before merge. :: none

@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Resolving the capacity/rank-up decision for this requested fix-and-land workflow: retain the documented limit of eight retained speaker-owned provider connections per room. This is a resource bound, not a promise that every provider account permits eight sessions. Provider account limits still apply, and a failed source stays local. The pool reclaims idle connections, while busy admission is recorded rather than transferring one participant's identity to another.

The production growth is also accepted for the repaired ownership boundary: most of the old runtime moves unchanged into the speaker owner; the new code owns bounded connection generations, draining, room playback arbitration, and response completion. The old shared context queue and lane-wide stream/reset/watchdog path are removed. Item IDs/FIFO/text matching cannot recover authenticated speaker ancestry across the supported protocols, so a net-neutral timing guard would leave the underlying defect. No new config, dependency, schema, or protocol version is introduced.

CI found two transcript-tool integration expectations outside the voice suite that still treated one speaker's provider closure as the whole room ending. The follow-up test update will explicitly prove that the same recording survives source recovery and then finalizes on room leave, preserving all replacement-session and late-callback checks. Production behavior is unchanged by that test update.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 3, 2026
@steipete
steipete merged commit 85d510c into main Sep 3, 2026
188 checks passed
@steipete
steipete deleted the codex/discord-realtime-speaker-identity branch September 3, 2026 17:30
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

The refreshed review's public-SDK premise does not match the package contract. realtime-voice was already a private runtime subpath in stable v2026.8.2, and it remains private at the merge commit. Both versions list it in scripts/lib/plugin-sdk-private-local-only-subpaths.json, export only its JavaScript default, and explicitly exclude its .d.ts from the package. The export generator excludes that list from publicPluginSdkEntrypoints; the SDK subpath documentation identifies this helper as private-local for official runtime consumers. A TypeScript re-export inside the source tree does not promote it into the typed public SDK.

Decision: retain onResponseRequest as a synchronous private runtime admission hook. This does not introduce a supported third-party lifecycle callback or widen the public SDK boundary. Its current contract is:

  • It runs before provider dispatch for a supported, nonblank host sendUserMessage, or a supported triggerGreeting (including the automatic ready greeting).
  • It runs only while the session admits work. Admission is checked again after the callback, so closing the session there prevents provider dispatch.
  • The shared harness establishes the response's turn before forwarding the optional callback. A provider may then finish synchronously, including with no audio, without losing completion ownership.
  • It does not announce arbitrary provider-generated responses, audio-VAD starts, or tool-result continuations. Native provider lifecycle events retain those responsibilities.

Source evidence at the merged commit: private entrypoint classification, public/private export generation, package exports, request admission, and harness turn ownership.

The review also records that its own environment could not install the Google SDK or list docs. Those are reviewer-environment limitations: the implementation work inspected the installed SDK and native lifecycle contract, ran the docs listing, and completed the recorded live Google interruption/completion proof. The merged voice dependency versions and all 27 changed file blobs match the final reviewed candidate. The refreshed review reports no concrete code or security findings.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
…law#137433)

* fix(discord): preserve realtime speaker and playback ownership

Bind provider connections to one Discord principal so delayed transcripts
and native consultations cannot inherit another speaker's authority.
Keep the shared agent route and serialize response-owned audio on one
room player, preserving continuations and recovery after playback gaps.

Admit host-requested responses before dispatch and map Google Live turn
completion to canonical terminal outcomes so queued speech can finish.

Closes openclaw#137349
Related: openclaw#136982, openclaw#123243
Follow-up: openclaw#137417

* test(discord): preserve room capture across speaker recovery
RomneyDa added a commit that referenced this pull request Sep 19, 2026
* feat(meta): add Muse Spark 1.3 models (#136553)

* feat(meta): add Muse Spark 1.3 models

* docs(meta): cite Muse Spark 1.3 recommendation

Co-authored-by: Tharun Tej Tammineni <[email protected]>

---------

Co-authored-by: Dallin Romney <[email protected]>
(cherry picked from commit 194b7f2)

* feat(anthropic): support Fable 5.1 from shared model metadata (#135638)

* feat(anthropic): support Fable 5.1 from shared model metadata

* test(anthropic): keep alias coverage within the file limit

* fix(media): decouple image limits from catalog augmentation

(cherry picked from commit 0a9b08c)

* feat(openai): support GPT Image 2.5 variants (#143068)

* feat(openai): support GPT Image 2.5 variants

* docs(openai): correct GPT Image 2.5 section link

(cherry picked from commit f93881f)

* feat(fal): support GPT Image 2.5 variants (#143069)

* feat(fal): support GPT Image 2.5 variants

* test(agents): restore Windows media fixture isolation

(cherry picked from commit a57c799)

* fix(bedrock): preserve images returned by tools (#149336)

## What Problem This Solves
Tool-returned images make the next request fail with `ValidationException` on affected Bedrock routes. Fixes #149332.

## Why This Change Was Made
The serializer generates image labels from each tool-call ID; input images need no labels. All consecutive tool results come first, followed by image groups in the same tool order. Request state has one writer. `stream.runtime.ts`: +28/−1 for this conversion.

Growth accepted under the owner's standing acceptance (2026-09-15).

## User Impact
Image-reading turns can finish without losing image bytes, tool associations, or error status.

## Evidence
Authenticated `chat.send` → registered `read` on a synthetic PNG: main sent a nested image and failed; candidate sent a sibling image and completed with the scripted “Red square; blue circle.” Our run used a recording HTTP transport.

The [contributor's real two-tool run](#149336 (comment)) confirms image interpretation and association.

## Compatibility
Concrete route identities select the conversion. Opaque aliases keep their layout. The general schema permits nested images for some routes; this repair addresses the affected route’s observed rejection. No config or public interface changes.

## Consumers
All clients use the existing Bedrock serializer.

## Invalidation
Conversion is request-local. Stored transcript rows and original image bytes remain unchanged.

## Tests
`node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-providers.config.ts extensions/amazon-bedrock`: 289 tests across 12 files passed on a fresh merge with main. Types, lint, formatting, file-size and assertion limits, and unused-export checks passed.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 115522a)

* fix: preserve Ultra across model runtime boundaries (#135397)

* fix: preserve Ultra across model runtime boundaries

Keep native Codex Ultra as a runtime mode instead of clamping it against
physical Responses effort tiers. Share the selected collaboration effort
between turn fields and remove the redundant forwarding wrapper.

Carry the active parent thinking level through existing spawn context so
one-shot overrides reach native subagents without changing saved preferences.
Keep explicit child overrides and configured child defaults authoritative.

Scope Control UI thinking catalog fallback to the selected runtime, sharing
one prepared entry for picker options and the inherited default. Document
the native orchestration/budget boundary and active-turn inheritance.

* refactor: simplify Ultra reasoning fixtures

* fix: preserve active thinking across shared tool contexts

* docs: clarify Off thinking for side questions

(cherry picked from commit ee9e22b)

* fix(anthropic): Fable 5.1 sessions lose reasoning after model switches and runtime events (#136782)

* fix(anthropic): keep Fable 5.1 thinking valid across model switches and runtime context

Claude Fable 5.1 binds each thinking block to the producing model and to the
exact request prefix that preceded it. Three harness behaviors conflicted with
that contract on Anthropic-family routes:

- Moving a session onto Fable 5.1 (from Opus 5, Sonnet 5, Opus 4.8, Fable 5)
  dropped readable reasoning client-side; the replay contract now preserves it
  while leaving Fable 5.1 still drops.
- The per-turn runtime-context carrier was injected transiently after the
  active user turn, stripped on the next request, relocated inside tool loops,
  and removed by the context-engine assembly. It is now persisted right after
  its user turn and replayed in place; inline inbound metadata stays in place
  too, and consecutive user turns are no longer merged at load for the
  Messages API because the merged form lost the second turn's timestamp stamp.
- Direct API-key requests with adaptive thinking send the
  thinking-binding-controls beta with prefix_mismatch_behavior=drop_block, so
  a residual mismatch degrades to a server-side unbilled drop with a warning
  listing the dropped paths instead of a 400, a duplicate request, and a
  transcript-wide thinking wipe. OAuth, proxies, Bedrock, Vertex, and Foundry
  keep the existing strip-and-retry recovery.

Live-verified against api.anthropic.com: nine-request Fable/Opus/Fable session
with tool loops and carriers reports input_transformations: [] on every
request with four retained thinking blocks; a /think change on the direct API
yields a logged server-side drop and no retry.

* fix(anthropic): limit the preserved-thinking replay target to Fable 5.1

Mythos 5.1 is not registered in the bundled catalog and has no cross-model
replay proof, so unregistered Mythos targets keep the existing drop path.

(cherry picked from commit 30837ae)

* feat(openai): support GPT-6 Astra (#137550)

* feat(openai): support GPT-6 Astra

* fix(models): preserve declared pricing tiers during catalog refresh

(cherry picked from commit eb72093)

* fix(openai): require discovery before offering Astra for OAuth (#137561)

(cherry picked from commit 8b1add5)

* fix(diagnostics-prometheus): reject unauthorized metric scrapes (#140903)

* fix(diagnostics-prometheus): require operator.read for metric scrapes

The Prometheus scrape route registers under the trusted-operator runtime
scope surface, so the Gateway authenticates the caller and applies its
named-role scope ceiling before dispatch. The handler never consulted
those scopes, so an authenticated identity whose role grants no operator
scopes still received the full diagnostics document with 200, while the
same caller was correctly refused on equivalent read operations.

Check the runtime request scopes inside the handler and fail closed with
403 "missing scope: operator.read" unless the caller holds operator.read,
operator.write, or operator.admin, mirroring the Gateway read implication
set. The guard runs before rendering so HEAD probes cannot disclose the
document size either.

* test(diagnostics-prometheus): prove role-limited scrape denial

(cherry picked from commit 0c9330b)

* fix(discord): enforce sender media policy on guild asset uploads (#140334)

The Discord emoji-upload, sticker-upload, and event-create branches dropped
the sender-scoped media access options before dispatching the action, so the
guild runtime loaded the requested host-local path with only a byte limit. A
sender permitted to run those actions could therefore place bytes from a file
outside their allowed media roots into an outbound Discord emoji, sticker, or
event-cover request.

Forward the resolved action options from all three branches, carry
mediaAccess/mediaLocalRoots/mediaReadFile through the guild runtime, and load
upload sources through buildOutboundMediaLoadOptions like every other outbound
Discord media path. Adds regression coverage that a source outside the sender
roots is rejected before any request is issued, with an in-roots control.

(cherry picked from commit e5e7764)

* fix(discord): preserve realtime speaker and playback ownership (#137433)

* fix(discord): preserve realtime speaker and playback ownership

Bind provider connections to one Discord principal so delayed transcripts
and native consultations cannot inherit another speaker's authority.
Keep the shared agent route and serialize response-owned audio on one
room player, preserving continuations and recovery after playback gaps.

Admit host-requested responses before dispatch and map Google Live turn
completion to canonical terminal outcomes so queued speech can finish.

Closes #137349
Related: #136982, #123243
Follow-up: #137417

* test(discord): preserve room capture across speaker recovery

(cherry picked from commit 85d510c)

* fix(doctor): preserve enabled skills during automatic updates (#138730)

Use runtime-repair approval for optional skill disabling. Keep standalone explicit repair and required config migrations unchanged.

(cherry picked from commit acc9a65)

* fix: generated images disappear after failed tool calls (#131226)

## What Problem This Solves

WebChat drops generated media when a later tool failure is the turn's only reply payload.

## Root cause

The embedded-run terminal projection assigned successful tool media to the first non-reasoning payload. A later error warning could become that owner. Gateway error projection then discarded the attached media.

## Fix

- Attach tool media only to a successful, non-reasoning reply.
- Emit a separate media-only payload when the turn has no successful reply.
- Preserve the newer host-owned and automatic-delivery media paths from current `main`.
- Keep regression coverage at the payload owner and physical-delivery boundaries.
- Remove the mocked browser test that manually inserted its expected result.

## Evidence

- Baseline: current `main` at `8544aed05a5dbffb871483be781f71351203319e`.
- Real path: branch-built Control UI → real Gateway → mock OpenAI Responses provider → successful image tool → later failing tool → terminal WebChat event.
- Red: current `main` rendered zero generated images.
- Green: `d2a10d40c633bfe796ad4ab19222aa831184a327` rendered one generated image.
- Anti-cheat: the proof recorded `image-success` before `later-failure` and verified that Chromium loaded the exact Gateway-served asset from the branch build.

## Validation

- Focused unit and integration tests: 19 passed across 2 Vitest shards.
- Real Gateway and built Control UI proof: passed on current `main` and the candidate head with opposite image assertions.
- Targeted format, Oxlint, conflict-marker, max-lines, assertion-safety, and diff checks passed.
- Type checks run in continuous integration because repository policy forbids them on this host.

Production change: `+3/-3`, net zero. Test change: `+23/-1`, net `+22`.

Co-authored-by: A28Hui <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 88be1b8)

* fix(matrix): refresh verification status before reporting device trust (#136226)

* fix(matrix): refresh verification status before reporting device trust

Refresh own-device keys after crypto preparation and before the authoritative trust read. Keep the missing-device preflight and use the Matrix SDK’s existing query contract.

* test(slack): remove core-coupled threading duplicate

---------

Co-authored-by: Dallin Romney <[email protected]>
(cherry picked from commit a812054)

* chore(release): prepare extended-stable 2026.8.33

* fix(release): integrate model and Discord security backports

* docs(release): clarify extended-stable workflow baseline

* fix(release): complete stable-line backport integration

* fix(ios): restore dependency resolution with WebRTC 152 (#134942)

* fix(release): repair frozen validation inputs

* fix(discord): stop error replies after voice consult cancellation (#135380)

* fix(discord): stop error replies after voice consult cancellation

Treat host-cancelled Discord realtime consults as terminal cancellation, preserve late-call dedupe, and wait for every native delivery before returning forced playback ownership. Timeouts and genuine errors retain their normal handling.

Closes #135340. Related phone cancellation helper: #134924.

* test(acp): run CLI lifecycle checks against prepared runtime

* test(cli): cover selective runtime build admission

* test(ci): account for ACP runtime preparation

* fix(release): complete Discord cancellation backport

* test(release): keep candidate fixtures current

* test(update): isolate frozen release version

---------

Co-authored-by: tharuntejmeta <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: dclosefuturex <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: Pavan Kumar Gondhi <[email protected]>
Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: CGlashu <[email protected]>
Co-authored-by: A28Hui <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord docs Improvements or additions to documentation extensions: google maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord realtime voice can attribute delayed transcripts to another speaker

1 participant