Repository navigation
fix(stt): sanitise provider error logs without echoing context - #20421
Conversation
Failure-Class: none Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Independent security review of added/modified lines found no MEDIUM+ issues: sanitize_provider_error does not copy provider/user text (numeric allowlist + canonical phrases only), and new log interpolations use that primitive or closed-set death reasons.
Sent by Cursor Security Agent: Security Reviewer
There was a problem hiding this comment.
7 issues found across 10 files
Confidence score: 3/5
- In
streaming.py, rejection errors can still emit rawdeath_reason, so the sanitization claim inlisten_pusher_pipeline.mdxis overstated. Sanitize this path or narrow the claim. - In
streaming.py, the pump now swallows its exception without recording a traceback, making crashes harder to diagnose. Keep traceback logging for this failure path. - In
safe_socket.py, transport failures can be reduced to[redacted]and lose their exception class, making websocket closures and timeouts hard to distinguish. Preserve a safe transport category and exception type. - In
log_sanitizer.py, an unusableerror_codecauses the sanitizer to skip a validstatus_code, losing useful diagnostic data. Continue checking keys until one yields a valid code.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/utils/stt/soniox.py">
<violation number="1" location="backend/utils/stt/soniox.py:144">
P3: `_rate_limit_persistent_error` is also called at soniox.py:584 with an internal constant ('429 responses continued through the bounded connect retry window'), which is not provider-supplied text. The new sanitizer reduces it to `code=429 diagnostic=[redacted]`, erasing the connect-window context the on-call log used to identify connect-time escalations. Sanitize only provider-supplied messages (e.g., keep the internal constant out of the sanitizer or add a flag/parameter), or reorder the call so the internal context survives.</violation>
</file>
<file name="backend/utils/log_sanitizer.py">
<violation number="1" location="backend/utils/log_sanitizer.py:84">
P3: `'invalid api key'` or `'rate limit exceeded'` (space-separated prose) never matches the underscore phrases `invalid_api_key`/`rate_limit_exceeded`, so these common provider errors log as `[redacted]` — hiding exactly the 429/limit signals this PR wants queryable. Normalize the scanned text (strip underscores or collapse whitespace) before phrase matching, or add space-form variants to the allowlist.</violation>
<violation number="2" location="backend/utils/log_sanitizer.py:125">
P2: When a provider mapping contains an unusable `error_code` before a valid `status_code`, this returns early and loses the validated status in the log. Continue to the next key until `_provider_code(candidate)` accepts a value.</violation>
<violation number="3" location="backend/utils/log_sanitizer.py:161">
P3: Phrase matching runs only on the first 2000 chars, so a canonical phrase at the tail of a long payload falls to `[redacted]` (verified: `'a'*1990 + ' request_timeout'` → `diagnostic=[redacted]`). Also scan the tail window so diagnostics past 2000 chars are still matched; the output is capped anyway by `[:_PROVIDER_ERROR_MAX_LENGTH]`.</violation>
</file>
<file name="backend/docs/listen_pusher_pipeline.mdx">
<violation number="1" location="backend/docs/listen_pusher_pipeline.mdx:169">
P2: This claim is overstated: raw `death_reason` text can still reach emitted log lines. In `backend/utils/stt/streaming.py`, `_primary_is_serving()`/`fallback_socket_is_serving()` rejection raises `RuntimeError(f'{service.value} rejected the stream: {detail}')` with the raw `detail = death_reason` embedded in the exception message. Callers catch the generic exception and log with traceback: `logger.exception('STT failover connect raised')` (backend/routers/listen/receiver.py:1234) and `logger.exception('transcribe-stream: STT failover connect raised')` (backend/routers/chat.py:1636), so the provider text surfaces in the emitted traceback. Either qualify the doc sentence to exclude the connect-rejection raise path (or fix the leak by sanitizing `detail` at the raise site in streaming.py:357) so operators' trust in the sanitization guarantee is not misplaced.</violation>
</file>
<file name="backend/utils/stt/streaming.py">
<violation number="1" location="backend/utils/stt/streaming.py:1841">
P2: Switching `logger.exception("Parakeet pump loop error")` to this line removes the only traceback recorded for a pump crash: `_pump` swallows the exception (sets `_dead`/`_dead_reason`, never re-raises) and `drain_and_close` treats the completed task as a normal close. For internal bugs (exceptions from `_flush`/`_transcribe_chunk` that are not provider-HTTP failures) the output collapses to `code=unknown diagnostic=[redacted]` with no exception type and no stack, leaving this backend-listen signature unactionable. Keep at least the bounded exception class alongside the sanitized message, e.g. `logger.error('Parakeet pump loop error (%s): %s', type(e).__name__, sanitize_provider_error(e))`. The same `logger.exception` → `logger.error` change on the drain path (line ~1824) loses the traceback for the pump task as well.</violation>
</file>
<file name="backend/utils/stt/safe_socket.py">
<violation number="1" location="backend/utils/stt/safe_socket.py:103">
P2: This line drops `type(e).__name__` that the old message included, and `sanitize_provider_error` cannot represent transport failures: `str(e)` for websockets `ConnectionClosed`, `TimeoutError`, or `OSError` matches none of the canonical phrases and exposes no `.status_code`, so the output is the constant `code=unknown diagnostic=[redacted]`. The keep-alive/send/finalize logs are henceforth identical for every failure class, so on-call can no longer distinguish a connection close from a timeout at this socket. Keep the bounded exception class name while sanitizing only the message: `logger.warning('DG keep_alive exception, connection dead: %s: %s', type(e).__name__, sanitize_provider_error(e))`. The same drop occurs on the `send` and `finalize` warning lines.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| typed death/close classification are unchanged — only the free-text payload | ||
| is withheld, since provider bodies can carry account details, signed URLs, | ||
| paths, or transcript text even when purely alphabetic. Raw provider text | ||
| stays latched on `death_reason` for classification and failover, but does |
There was a problem hiding this comment.
P2: This claim is overstated: raw death_reason text can still reach emitted log lines. In backend/utils/stt/streaming.py, _primary_is_serving()/fallback_socket_is_serving() rejection raises RuntimeError(f'{service.value} rejected the stream: {detail}') with the raw detail = death_reason embedded in the exception message. Callers catch the generic exception and log with traceback: logger.exception('STT failover connect raised') (backend/routers/listen/receiver.py:1234) and logger.exception('transcribe-stream: STT failover connect raised') (backend/routers/chat.py:1636), so the provider text surfaces in the emitted traceback. Either qualify the doc sentence to exclude the connect-rejection raise path (or fix the leak by sanitizing detail at the raise site in streaming.py:357) so operators' trust in the sanitization guarantee is not misplaced.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/docs/listen_pusher_pipeline.mdx, line 169:
<comment>This claim is overstated: raw `death_reason` text can still reach emitted log lines. In `backend/utils/stt/streaming.py`, `_primary_is_serving()`/`fallback_socket_is_serving()` rejection raises `RuntimeError(f'{service.value} rejected the stream: {detail}')` with the raw `detail = death_reason` embedded in the exception message. Callers catch the generic exception and log with traceback: `logger.exception('STT failover connect raised')` (backend/routers/listen/receiver.py:1234) and `logger.exception('transcribe-stream: STT failover connect raised')` (backend/routers/chat.py:1636), so the provider text surfaces in the emitted traceback. Either qualify the doc sentence to exclude the connect-rejection raise path (or fix the leak by sanitizing `detail` at the raise site in streaming.py:357) so operators' trust in the sanitization guarantee is not misplaced.</comment>
<file context>
@@ -158,6 +158,18 @@ transition metrics, classified outcome counters and static/proposed pairs are
+typed death/close classification are unchanged — only the free-text payload
+is withheld, since provider bodies can carry account details, signed URLs,
+paths, or transcript text even when purely alphabetic. Raw provider text
+stays latched on `death_reason` for classification and failover, but does
+not reach emitted log lines. The Deepgram SDK's own private logging is
+outside this change.
</file context>
There was a problem hiding this comment.
Confirmed. The guide now limits its guarantee to adapter log statements routed through sanitize_provider_error; it explicitly retains the router rethrow/logging gap. The task forbids changes to the #20391-owned receiver/recovery boundary and restricts streaming.py to logging expressions, so the raw death_reason rethrow is deferred rather than represented as fixed. Follow-up 5e059e6 is publishing next.
| pass | ||
| except Exception as e: | ||
| logger.exception("Parakeet pump loop error") | ||
| logger.error('Parakeet pump loop error: %s', sanitize_provider_error(e)) |
There was a problem hiding this comment.
P2: Switching logger.exception("Parakeet pump loop error") to this line removes the only traceback recorded for a pump crash: _pump swallows the exception (sets _dead/_dead_reason, never re-raises) and drain_and_close treats the completed task as a normal close. For internal bugs (exceptions from _flush/_transcribe_chunk that are not provider-HTTP failures) the output collapses to code=unknown diagnostic=[redacted] with no exception type and no stack, leaving this backend-listen signature unactionable. Keep at least the bounded exception class alongside the sanitized message, e.g. logger.error('Parakeet pump loop error (%s): %s', type(e).__name__, sanitize_provider_error(e)). The same logger.exception → logger.error change on the drain path (line ~1824) loses the traceback for the pump task as well.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/utils/stt/streaming.py, line 1841:
<comment>Switching `logger.exception("Parakeet pump loop error")` to this line removes the only traceback recorded for a pump crash: `_pump` swallows the exception (sets `_dead`/`_dead_reason`, never re-raises) and `drain_and_close` treats the completed task as a normal close. For internal bugs (exceptions from `_flush`/`_transcribe_chunk` that are not provider-HTTP failures) the output collapses to `code=unknown diagnostic=[redacted]` with no exception type and no stack, leaving this backend-listen signature unactionable. Keep at least the bounded exception class alongside the sanitized message, e.g. `logger.error('Parakeet pump loop error (%s): %s', type(e).__name__, sanitize_provider_error(e))`. The same `logger.exception` → `logger.error` change on the drain path (line ~1824) loses the traceback for the pump task as well.</comment>
<file context>
@@ -1825,7 +1838,7 @@ async def _pump(self) -> None:
pass
except Exception as e:
- logger.exception("Parakeet pump loop error")
+ logger.error('Parakeet pump loop error: %s', sanitize_provider_error(e))
self._dead = True
self._dead_reason = f'parakeet pump crashed: {e}'
</file context>
| logger.error('Parakeet pump loop error: %s', sanitize_provider_error(e)) | |
| logger.error('Parakeet pump loop error (%s): %s', type(e).__name__, sanitize_provider_error(e)) |
There was a problem hiding this comment.
Implemented a bounded exception_type field in the shared diagnostic primitive (follow-up 5e059e6, publishing next). Pump and drain now distinguish an allowlisted TypeError/ValueError/etc.; unknown class names map to other. Real pump/drain regressions verify the category and absence of raw exception context. Raw logger.exception tracebacks remain intentionally disabled because their formatted exception text can echo provider context.
| if self._death_reason is None: | ||
| self._death_reason = f'keep_alive {type(e).__name__}: {e}' | ||
| logger.warning('DG keep_alive exception, connection dead: %s: %s', type(e).__name__, e) | ||
| logger.warning('DG keep_alive exception, connection dead: %s', sanitize_provider_error(e)) |
There was a problem hiding this comment.
P2: This line drops type(e).__name__ that the old message included, and sanitize_provider_error cannot represent transport failures: str(e) for websockets ConnectionClosed, TimeoutError, or OSError matches none of the canonical phrases and exposes no .status_code, so the output is the constant code=unknown diagnostic=[redacted]. The keep-alive/send/finalize logs are henceforth identical for every failure class, so on-call can no longer distinguish a connection close from a timeout at this socket. Keep the bounded exception class name while sanitizing only the message: logger.warning('DG keep_alive exception, connection dead: %s: %s', type(e).__name__, sanitize_provider_error(e)). The same drop occurs on the send and finalize warning lines.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/utils/stt/safe_socket.py, line 103:
<comment>This line drops `type(e).__name__` that the old message included, and `sanitize_provider_error` cannot represent transport failures: `str(e)` for websockets `ConnectionClosed`, `TimeoutError`, or `OSError` matches none of the canonical phrases and exposes no `.status_code`, so the output is the constant `code=unknown diagnostic=[redacted]`. The keep-alive/send/finalize logs are henceforth identical for every failure class, so on-call can no longer distinguish a connection close from a timeout at this socket. Keep the bounded exception class name while sanitizing only the message: `logger.warning('DG keep_alive exception, connection dead: %s: %s', type(e).__name__, sanitize_provider_error(e))`. The same drop occurs on the `send` and `finalize` warning lines.</comment>
<file context>
@@ -99,7 +100,7 @@ def _send_keepalive_locked(self):
if self._death_reason is None:
self._death_reason = f'keep_alive {type(e).__name__}: {e}'
- logger.warning('DG keep_alive exception, connection dead: %s: %s', type(e).__name__, e)
+ logger.warning('DG keep_alive exception, connection dead: %s', sanitize_provider_error(e))
self._dg_dead = True
</file context>
| logger.warning('DG keep_alive exception, connection dead: %s', sanitize_provider_error(e)) | |
| logger.warning('DG keep_alive exception, connection dead: %s: %s', type(e).__name__, sanitize_provider_error(e)) |
There was a problem hiding this comment.
Implemented in follow-up 5e059e6: exception inputs append a closed-set exception_type field within the same 160-character cap. TimeoutError, OSError, ConnectionClosedError, RuntimeError and other allowlisted transport types remain distinguishable; arbitrary class names become other. SafeDeepgramSocket tests assert the category without restoring raw exception strings or tracebacks.
| if code is None: | ||
| code = _provider_code_candidate(value) | ||
| code_text = _provider_code(code) or 'unknown' | ||
| text = _provider_diagnostic_text(value)[:_PROVIDER_TEXT_SCAN_LENGTH].lower() |
There was a problem hiding this comment.
P3: Phrase matching runs only on the first 2000 chars, so a canonical phrase at the tail of a long payload falls to [redacted] (verified: 'a'*1990 + ' request_timeout' → diagnostic=[redacted]). Also scan the tail window so diagnostics past 2000 chars are still matched; the output is capped anyway by [:_PROVIDER_ERROR_MAX_LENGTH].
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/utils/log_sanitizer.py, line 161:
<comment>Phrase matching runs only on the first 2000 chars, so a canonical phrase at the tail of a long payload falls to `[redacted]` (verified: `'a'*1990 + ' request_timeout'` → `diagnostic=[redacted]`). Also scan the tail window so diagnostics past 2000 chars are still matched; the output is capped anyway by `[:_PROVIDER_ERROR_MAX_LENGTH]`.</comment>
<file context>
@@ -77,6 +77,92 @@ def sanitize_validation_error(error: _ValidationErrorLike) -> str:
+ if code is None:
+ code = _provider_code_candidate(value)
+ code_text = _provider_code(code) or 'unknown'
+ text = _provider_diagnostic_text(value)[:_PROVIDER_TEXT_SCAN_LENGTH].lower()
+ diagnostic = next((phrase for phrase in _PROVIDER_DIAGNOSTIC_PHRASES if phrase in text), '[redacted]')
+ return sanitize(f'code={code_text} diagnostic={diagnostic}')[:_PROVIDER_ERROR_MAX_LENGTH]
</file context>
| text = _provider_diagnostic_text(value)[:_PROVIDER_TEXT_SCAN_LENGTH].lower() | |
| text = _provider_diagnostic_text(value) | |
| text = (text[:_PROVIDER_TEXT_SCAN_LENGTH] + text[-_PROVIDER_TEXT_SCAN_LENGTH:]).lower() |
There was a problem hiding this comment.
The 2,000-character input scan is intentional. A canonical phrase outside that bounded window is redacted by default while the validated code and typed serving reason remain available. I am not expanding the scan to unbounded/tail payload text in this patch; a regression now pins late-phrase redaction with the status intact. The 160-character output limit is a separate contract.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05b4e97086
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| candidate = getattr(value, 'status_code', None) | ||
| if candidate is not None: | ||
| return candidate | ||
| response = getattr(value, 'response', None) | ||
| return getattr(response, 'status_code', None) |
There was a problem hiding this comment.
Read allowlisted fields from provider response objects
When an SDK callback supplies a response object whose status is exposed as .code rather than .status_code (as WebSocket close/error objects commonly do), _provider_code_candidate ignores it and emits code=unknown; _provider_diagnostic_text similarly discards allowlisted .message/.description attributes for non-exception objects. Consequently the newly sanitized Deepgram callback logs can collapse every such event to code=unknown diagnostic=[redacted], removing the status needed to distinguish normal closure, auth failure, and provider failure. Safely inspect the same allowlisted fields on objects without echoing their raw representation.
AGENTS.md reference: backend/AGENTS.md:L191-L195
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in follow-up 5e059e6: the same allowlisted scalar fields are inspected on SDK objects and mappings, without object str/repr. Code extraction handles .code and bounded response fields; diagnostic extraction handles .message/.description and skips blank defaults so a Deepgram message="" does not hide a populated description. Raising properties are ignored at the logging boundary. Object, blank-field, and hostile-representation regressions pass.
| logger.error( | ||
| 'Modulate streaming error: reason=%s %s', | ||
| typed, | ||
| sanitize_provider_error(err, code=msg.get('error_code') or msg.get('code')), |
There was a problem hiding this comment.
Prevent fallback exhaustion from re-logging raw error frames
When a legacy fallback socket receives this sanitized Modulate error and is the final candidate, the same raw err is still stored in death_reason; _connect_serving_fallback embeds that value in a RuntimeError, the final-candidate branch re-raises it, and routers/chat.py logs the exception verbatim at lines 1871-1873. Thus a /transcribe-stream session whose primary fails and whose Modulate fallback rejects after upgrade still writes the provider's account details, URL, or echoed transcript to an Omi-owned log despite this safe immediate log. Propagate only the typed reason or sanitize the terminal logging boundary while retaining the raw value solely for classification.
AGENTS.md reference: backend/AGENTS.md:L191-L196
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed: _connect_serving_fallback can rethrow raw death_reason, and receiver.py:1234 / chat.py:1636,1872 can log it. This task explicitly excludes router/recovery changes owned by #20391 and limits streaming.py to logging expressions; changing the raise or terminal boundary would cross that contract. I am recording this as an unresolved scope deferral in the guide, PR body, and final report, not claiming a complete provider-log fix.
Keep adapter log-safety regressions beside the shared sanitizer tests without adding an entry to the index-sharded test file list. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64a4ba5cac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| number = int(candidate) | ||
| else: | ||
| return '' | ||
| if 100 <= number <= 599 or 1000 <= number <= 1015: |
There was a problem hiding this comment.
Preserve application-defined WebSocket close codes
For provider events that supply a close code through a mapping or the explicit code= argument, this range check rejects the standard application/private WebSocket close-code ranges (3000–4999). A provider close such as 4001 therefore becomes code=unknown, even though retaining status codes is part of the logging contract; accept valid application-defined close codes while continuing to reject reserved/invalid values.
AGENTS.md reference: backend/AGENTS.md:L191-L195
Useful? React with 👍 / 👎.
Keep safe status and exception categories useful without reintroducing provider text or raw tracebacks, and make adapter regressions hermetic. Failure-Class: none Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>


Summary
Fix independent-review finding 12 at Omi-owned logging sites. Soniox and Modulate error frames, Deepgram callbacks, and Parakeet/auxiliary exceptions previously emitted provider-supplied text that can echo request context. Use a shared strict diagnostic primitive rather than token masking: arbitrary text (including purely alphabetic user text), domains, signed URLs, paths, and unknown provider code strings never enter these log messages. Emit only validated numeric status and constant canonical diagnostics, capped at 160 characters.
Failure-Class: none
Line-Count-Exception: backend/utils/stt/streaming.py | 2188 -> 2205 | Minimal logging-only replacements need multiline bounded code/reason diagnostics; sanitisation is extracted into the shared log_sanitizer primitive, while moving adapter/transport code would conflict with #20391's ownership.
The registry's nearest logging definition,
FC-secret-printed-to-plugin-logs, is specifically the plugin/OAuth stdout contract and guard. No existing definition exactly owns backend STT provider diagnostics; no.github/registry changes are made under this task's scope. The reusable primitive and behavioral adapter regressions are the prevention surface, not a new source-string guard.Serving behaviour changes
backend/utils/log_sanitizer.py:189sanitize_provider_error: HTTP 100–599 or WS 1000–1015 status, otherwiseunknown; bounded canonical phrase or[redacted], and an optional closed-setexception_typefor exception objects; max 160 output characters and 2,000 input characters scanned. Validated scalar fields work on mappings and SDK objects, skip unusable codes/blank diagnostics, and never stringify arbitrary objects. Matching normalizes case/underscores/whitespace but emits only constants. Existing sanitizers unchanged.backend/utils/stt/soniox.py:144,:373,:383backend/utils/stt/streaming.py:1057–1224backend/utils/stt/streaming.py:1557–1574backend/utils/stt/streaming.py:1823–2155backend/utils/stt/safe_socket.py:103,:140,:169backend/utils/stt/pre_recorded.py:984backend/utils/stt/speaker_embedding.py:187,:215backend/utils/stt/vad.py:227,:256,:386No provider order, allocation, charts, runtime env, metric schema, or
.github/changes. Production remainsSTT_ROUTING_MODE=shadow,STT_ROUTING_ON_PERCENT=0. No send, recovery, replay, retry-policy, or classification changes;soniox.py/streaming.pychanges are imports and logging expressions only (one exception binding solely to provide a safe diagnostic).Test plan
origin/main: 13 failing adapter-log tests, plus sanitizer import errors before the primitive existed.cd backend && mkdir -p ../.pytest-tmp && TMPDIR=$PWD/../.pytest-tmp .venv/bin/python -m pytest -q -p no:cacheprovider tests/unit/test_stt_provider_error_logs.py tests/unit/test_log_sanitizer.py tests/unit/test_soniox_typed_rejections.py tests/unit/test_modulate_serve_error_deaths.py tests/unit/test_soniox_rate_limit.py tests/unit/test_streaming_deepgram_backoff.py --durations=8: 256 passed.test.shrunner: 245 passed. Itsnot integration and not slowfilter excludes 11 existing marked cases; direct pytest above included them.tests/unit/test_log_sanitizer.py, removing the task-created new file. At consolidation that suite had 95 tests, all passing through prescribed pytest and isolatedtest.sh, with no CPU-guard findings. All assertions are preserved; no skips or threshold changes. The review follow-up adds diagnostic-field/category regressions: a helper + Deepgram checkpoint passed 203 tests (192 through the normal marker-filtered runner), and finaltests/unit/test_log_sanitizer.pypasses 115 tests through both prescribed pytest and isolatedtest.sh.other..invaliddial and was replaced before final verification.test-preflight.sh: 18 passed, 0 failed; async blocker scans: 0 findings;scripts/typecheck.sh: 0 errors;make preflight: 30 checks passed. Final committed metadata/source gate runs before push..local/f12/.CI record
Initial head
05b4e97086passed all test assertions and the other checks, but backend shard 4 exceeded the 600-second wall budget twice: 636s, then 601s on a failed-jobs rerun (37106032979). Main runs at both7a58c973and61f889624bpassed, so the overruns were not excused as pre-existing. The runner slices a sorted file list by index (backend/scripts/run-unit-ci.sh:48–51,89–94); the task's new test file shifted later suites between shards. The follow-up test-only consolidation keeps all 16 adapter regressions alongside the shared primitive's existing tests, removes that file-list insertion, and leaves production code and CI configuration/budgets unchanged. This structural correction does not prove that the earlier timing variance had only one cause. Final head5e059e68e547be457a15807aae26f12f63fac3c4is CI-green: backend unit run37110162396succeeded (all four shards, guardrails and aggregate); Hermetic Backend E2E/Merge Gate, CodeQL, Hygiene, Formatting and source closure passed. GitHub reportsmergeStateStatus=CLEANand no failing checks. Scope-skipped image/stack/client jobs are not claimed as executed. Nothing was merged or deployed.Conflict / ownership note
Possible conflicts with PR #20391: it edits
soniox.py/streaming.pysend paths and alsosafe_socket.pyand pipeline documentation. This PR changes logging expressions/imports only; preserve both patches if nearby lines conflict. No files in the receiver/recovery/replay/send-queue ownership area are edited.Remaining gaps (explicitly deferred)
Router-boundary rethrows can still log raw provider context. Confirmed during PR review:
backend/utils/stt/streaming.py:352–357embeds rawdeath_reasonin a fallback-rejectionRuntimeError;backend/routers/listen/receiver.py:1234andbackend/routers/chat.py:1636,1872can emit it via traceback/direct error logging. The brief excludes the receiver/recovery owner and restricts streaming changes to logging expressions. Changing the raise/classification/terminal router boundary requires coordination with #20391; it is not silently changed here. The guide and this PR deliberately guarantee only the adapter log statements actually hardened, not every Omi-owned log. This confirmed gap remains unresolved.This is not a claim that all Deepgram SDK output is safe. The installed Deepgram 4.8.1 SDK constructs private
VerboseLoggerobjects with their ownStreamHandlerand a direct root parent (clients/listen/v1/websocket/client.py:75–77,clients/common/v1/abstract_sync_websocket.py:79–81,utils/verboselogs/__init__.py:147–148). Those bypass Omi's existing nameddeepgramcapture handler. Fixing SDK-internal stderr needs logger-filter setup at SDK construction, beyond this task's logging-expression-only boundary. That expansion was offered but not approved; it is deferred, and the existing capture handler remains unchanged. Do not treat synthetic named-logger tests as proof of SDK stderr suppression.Deployment / scope
Ships in the existing backend images that import these shared adapters (not the separate Parakeet GPU image). Deploy/merge is not performed here. Verify with synthetic provider error fixtures on the deployed backend image: bounded
reason/code/diagnostic, same severity and failure counters, no sentinel context in Omi-owned adapter logs. The independent cancelled-GPU-work fix is local onfix/parakeet-cancelled-workat43d72c78c03bb24e2084075fe10579080bdf5a58: two permitted pushes failed an unchanged window test CPU guard; clean main reproduces it at 0.34s against 0.30s. No hook bypass or owned recovery-test change was made.Generated with Devin