Skip to content

fix(ios): avoid voice stalls when diagnostic output blocks - #150338

Merged
Patrick-Erichsen merged 1 commit into
mainfrom
codex/claw-860-ios-diagnostic-backpressure
Sep 16, 2026
Merged

Patrick-Erichsen merged 1 commit into
mainfrom
codex/claw-860-ios-diagnostic-backpressure

Conversation

@Patrick-Erichsen

@Patrick-Erichsen Patrick-Erichsen commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes iOS realtime Talk pausing before returning to Listening when developer diagnostic output is blocked. This surfaced as the repeated voice-test failure in #149286; both affected source files were already identical on current main.

User Impact

Diagnostic transport can drain in the background while Talk completes its tool result and resumes listening. No settings, protocol, credential, or persistence-format changes.

Why This Change Was Made

GatewayDiagnostics already owns a serial file-writing queue, but it logged to OSLog and resolved its cache directory synchronously first. Developer-mode OSLog can block in writev when its stderr transport is full. Move formatting, OSLog, cache-path resolution and the existing file work onto that queue, capturing the occurrence time at entry. Remove Talk's duplicate synchronous timeline sink; the canonical GatewayDiag timeline remains.

Logs remain best effort and may drain after session shutdown. Other direct start/error log calls are outside this change. Production delta: +10 / −10 (net zero) across two files; no new tests or timeout changes.

Evidence

Paired local runs use credential head e724660eda23 before and after the exact two-file patch in d50b2e2986d7. The complete apps/ios tree matches this PR base; shared generated plugin-inspection credential fields differ, so current-head hosted CI remains a separate gate. The original four-suite, 71-test XCTest run uses unchanged assertions, ordering and its existing five-second Listening deadline. A separate writer fills the xcodebuild output pipe when the existing tool-submit marker arrives, holds the reader for eight seconds, then resumes draining. Only the two production files differ between before and after.

Actual iOS Simulator run Before After
Normal output 71/71 pass; affected case 0.394s 71/71 pass; affected case 0.362s
Eight-second blocked output 70/71; same Listening assertion fails, case 8.696s 71/71 pass; affected case 0.355s

The repaired result-ready/send entries retain occurrence time inside the blocked interval; they are emitted after draining resumes. A separate probe compiling the actual GatewayDiagnostics enum against installed OSLog confirms the call returns before unblocking: 1.023s before → 0.000082s after, with the log persisted after drain in both cases. No production test seam or simulated Logger was used.

  • Built and ran the real iOS XCTest app on Xcode 26.6 / iOS Simulator 26.5. Hosted failing runs used iOS 26.4.1; no hosted blocked-thread sample was captured, so this proves the reproduced mechanism, not every hosted pause.
  • Installed OSLog source and a blocked-process sample confirm developer stderr mirroring is synchronous. The actual local and hosted XCTest launch records both specify OS_ACTIVITY_DT_MODE=YES.
  • SwiftFormat: 0/2 files need changes. SwiftLint: zero serious violations; two existing type-length warnings. Structured P0 review: no findings.
  • Existing regression case retained unchanged. Transport backpressure is exercised externally because an in-process logger mock or extra timeout would not reproduce this failure.
Reproduction and scope

Build the OpenClaw Debug XCTest app with signing disabled. Run xcodebuild test-without-building, -parallel-testing-enabled NO, selecting the existing TalkRealtimeVoiceSessionCleanupTests, TalkRealtimeConsultCancellationTests, TalkRealtimeTranscriptWriteQueueTests, and TalkModeManagerTests suites. Keep the same simulator runtime and retained products within each variant. Drain stdout normally for the control. For the stalled run, pipe combined output through a reader; after tool call submit start callId=call-1, have an independent blocking writer fill that same pipe, stop reading for eight seconds, then drain it. Do not change child descriptor flags, XCTest environment, source assertions, or the five-second expectation. Inspect the xcresult rather than interpreting delayed log arrival as application timing.

The existing testHistoryFallbackWaitsForTheAcknowledgedRunInsteadOfANewerForeignReply fails at its Listening assertion before this patch and passes afterward. The separate OSLog probe samples Logger.info → _os_log_impl → _os_log_impl_mirror_to_stderr → writev while developer output is stalled. Gateway scoped logging, bootstrap, file rotation and protection continue through the existing owner; no new queue, storage, or fallback path is added.

Punchcard-Session: crisp-summit-lantern-qk
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: ios App: ios size: XS maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 6:22 PM ET / 22:22 UTC.

ClawSweeper review

What this changes

Moves iOS diagnostic output onto its existing background queue and removes duplicate synchronous Talk timeline logging so blocked developer output does not delay voice progress.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main retains the synchronous logging path, and the supplied native backpressure evidence supports the repair. No actionable introduced defect was found.

Priority: P2
Reviewed head: d50b2e2986d7cb320e542a920b6db42185365f9d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow owner-level repair with strong, relevant native fault evidence and no identified correctness or security blocker.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied native before/after observations exercise Talk through its existing callback and actual GatewayDiagnostics/OSLog transport under externally injected output backpressure, showing timely Listening recovery and eventual log persistence. Mocked Gateway replies do not replace the real diagnostic transport being tested; hosted-runtime equivalence remains outside the stated claim.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied native before/after observations exercise Talk through its existing callback and actual GatewayDiagnostics/OSLog transport under externally injected output backpressure, showing timely Listening recovery and eventual log persistence. Mocked Gateway replies do not replace the real diagnostic transport being tested; hosted-runtime equivalence remains outside the stated claim.
Evidence reviewed 7 items Introduced change and merge scope: The verified merge-base-to-head diff changes only diagnostic scheduling and removes Talk's duplicate timeline sink. The verified test merge likewise changes only these two iOS files; project-related endpoint drift belongs to main.
Current main still contains the blocking path: Current main formats and emits OSLog synchronously before scheduling file work. The affected iOS tree is unchanged between the pinned merge base and fetched main.
Latest release check: The source retrieved for v2026.9.4 also emits OSLog before entering the background queue, so the latest supplied release does not contain this scheduling repair.
Findings None None.
Security None None.

How this fits together

iOS Talk processes realtime voice events and Gateway tool results before returning to Listening. Its diagnostic logger sends timeline messages to OSLog and a local file; this change separates that output from the caller’s progress.

flowchart TD
  A[Voice events and tool results] --> B[iOS Talk session]
  B --> C[Resume Listening]
  B --> D[Capture diagnostic message and time]
  D --> E[Existing serial diagnostic queue]
  E --> F[OSLog output]
  F --> G[Local diagnostic file]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Other 0. Total 0 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 10 10 0
Total 2 10 10 0

Review metrics

Metric Value Why it matters
Recovery under blocked diagnostic output 8-second blockage: affected case 8.696s failing → 0.355s passing The supplied native comparison retains the existing five-second Listening deadline and isolates the production patch.

Technical review

Best possible solution:

Keep diagnostic I/O under the existing serial owner, preserve occurrence timestamps, and let Talk progress independently of developer-output backpressure.

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

Yes: source corroborates the supplied native reproduction that fills developer output during a consult and observes the unchanged Listening deadline fail. This read-only review did not independently execute it.

Is this the best way to solve the issue?

Yes: moving the blocking work to the existing diagnostic owner and removing the duplicate sink directly addresses the demonstrated cause without changing timeouts, settings, or voice semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b5eb58956fa1.

Labels

Label changes:

  • add P2: This repairs a concrete iOS Talk stall under developer diagnostic backpressure with a limited, demonstrated trigger.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied native before/after observations exercise Talk through its existing callback and actual GatewayDiagnostics/OSLog transport under externally injected output backpressure, showing timely Listening recovery and eventual log persistence. Mocked Gateway replies do not replace the real diagnostic transport being tested; hosted-runtime equivalence remains outside the stated claim.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied native before/after observations exercise Talk through its existing callback and actual GatewayDiagnostics/OSLog transport under externally injected output backpressure, showing timely Listening recovery and eventual log persistence. Mocked Gateway replies do not replace the real diagnostic transport being tested; hosted-runtime equivalence remains outside the stated claim.

Label justifications:

  • P2: This repairs a concrete iOS Talk stall under developer diagnostic backpressure with a limited, demonstrated trigger.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied native before/after observations exercise Talk through its existing callback and actual GatewayDiagnostics/OSLog transport under externally injected output backpressure, showing timely Listening recovery and eventual log persistence. Mocked Gateway replies do not replace the real diagnostic transport being tested; hosted-runtime equivalence remains outside the stated claim.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied native before/after observations exercise Talk through its existing callback and actual GatewayDiagnostics/OSLog transport under externally injected output backpressure, showing timely Listening recovery and eventual log persistence. Mocked Gateway replies do not replace the real diagnostic transport being tested; hosted-runtime equivalence remains outside the stated claim.

Evidence

What I checked:

  • Introduced change and merge scope: The verified merge-base-to-head diff changes only diagnostic scheduling and removes Talk's duplicate timeline sink. The verified test merge likewise changes only these two iOS files; project-related endpoint drift belongs to main. (apps/ios/Sources/Gateway/GatewaySettingsStore.swift:1289, d50b2e2986d7)
  • Current main still contains the blocking path: Current main formats and emits OSLog synchronously before scheduling file work. The affected iOS tree is unchanged between the pinned merge base and fetched main. (apps/ios/Sources/Gateway/GatewaySettingsStore.swift:1288, b5eb58956fa1)
  • Latest release check: The source retrieved for v2026.9.4 also emits OSLog before entering the background queue, so the latest supplied release does not contain this scheduling repair. (apps/ios/Sources/Gateway/GatewaySettingsStore.swift, 3a9d69db306c)
  • Production progress and existing regression assertion: Talk traces the ready result immediately before submitting it and later notifies Listening. The existing consult test enters through the realtime data-channel callback and requires Listening within five seconds; Gateway responses are mocked, while the diagnostic transport exercised by the supplied fault run is actual OSLog. (apps/ios/Tests/TalkRealtimeConsultCancellationTests.swift:50, d50b2e2986d7)
  • Native backpressure evidence: The complete supplied PR body, captured under source revision e2dc2fbc4fbf0058b4a3833b169f5024fc374ad257d1a0180e9006861d708cf9, reports paired Xcode 26.6/iOS Simulator 26.5 runs using e724660 plus the exact patch. With output blocked for eight seconds, the unchanged case changes from failure at 8.696s to success at 0.355s; all 71 cases pass afterward. A separate actual GatewayDiagnostics/OSLog probe reports return latency falling from 1.023s to 0.000082s and persistence after draining. This establishes the reproduced logging mechanism, not every hosted pause or a live provider conversation. No target code was executed during this review. (d50b2e2986d7)
  • Related work and inspected media: The supplied discussion connects this failure to validation of feat: inspect and edit plugin credentials in settings #149286, whose credential-settings feature is distinct. All four prepared images were inspected and show that settings feature; they are not used as voice-stall evidence.

Likely related people:

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

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.

@Patrick-Erichsen
Patrick-Erichsen merged commit c4db268 into main Sep 16, 2026
75 checks passed
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@Patrick-Erichsen
Patrick-Erichsen deleted the codex/claw-860-ios-diagnostic-backpressure branch September 16, 2026 22:47
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

1 participant