fix: sweep — 15 fixes across router, realtime, recorder, fal-audio, gemini-interactions, and drift infra#230
Merged
Merged
Conversation
commit: |
cad6cae to
f770b80
Compare
f770b80 to
c74a0f7
Compare
…ack, fixture detection guards Collapse dead exact-match branch in array systemMessage matching (both paths were identical). Add elevenlabs-tts and translation to endpoint compatibility filter. Change Content-Type ?? to || for empty-string fallback. Derive EndpointType from FixtureMatch (single source of truth). Add negative guards to Gemini Interactions outputs detection. Scope turnIndex/hasToolResult to chat endpoints only.
….send safety Complete session.update rollback with full snapshot instead of just model/type. Add missing Beta flat fields for noise reduction, transcription, and turn_detection. Join all text content parts in realtimeItemsToMessages. Wrap sendEvent in try-catch with debug logging for TOCTOU safety on WebSocket close races.
…age in Gemini Live
Replace deterministic call_gemini_${name}_${i} IDs with random
generateToolCallId() to prevent cross-turn collisions. Pre-compute
resolvedToolCalls so wire messages and conversation history share the
same IDs. Wrap ws.send in try-catch with debug logging for close race
safety. Add unrecognized-role warning to geminiTurnsToMessages. Add
two tests covering the random-ID fallback path for both toolResponse
and clientContent functionResponse without explicit id fields.
…ches warning Honor Gemini-native field names (promptTokenCount, candidatesTokenCount, totalTokenCount) in interactionsUsage fallback chain. Only count content.delta events for truncateAfterChunks — framing events should not consume chunk budget. Add webSearches warning to tool-call-only branch. Document why _endpointType stays "chat" for compatibility.
…venLabs
Use flattenHeaders(req.headers) in all journal entries instead of
empty {}. Add isJSONResponse branch to handleSyncRun for queue-walk
recordings that stored the final fal envelope as RawJSONResponse.
…aimock header Extend resolveUsage to accept Gemini-native token field names (promptTokenCount, candidatesTokenCount, totalTokenCount). Preserve error cause in resolveResponse factory rethrow. Accept optional usage in buildEmbeddingResponse. Escape regex metacharacters in extractFormField. Update types.ts header from LLMock to aimock.
…dening Add retry logging and body consumption in fetchWithRetry. Broaden redactUrl to cover api_key, apikey, token, access_token patterns. Thread URL into assertOk/parseJsonResponse for redacted error context. Fix parseDataOnlySSE [DONE] filter to avoid false positives on content containing [DONE]. Rewrite parseTypedSSE to handle multi-line data frames with proper null guards and error context.
…traces as infra errors Invoke vitest directly via npx instead of pnpm test:drift to avoid the pnpm prefix line that broke JSON parsing. Add stack trace patterns (Error:, file: frames, STACK_TRACE_ERROR) to infraIndicators so raw vitest failures from API/network issues are classified as infrastructure errors instead of crashing the collector.
6665ee4 to
28c4f22
Compare
3 tasks
jpr5
added a commit
that referenced
this pull request
May 21, 2026
## Summary - Wrap all 15 exported provider functions in `withInfraErrorTag()` so transient API failures (rate limits, network timeouts, auth errors) throw with a structured `INFRA_ERROR: <provider> — <message>` prefix instead of raw stack traces - Add `/^INFRA_ERROR:/m` to the collector's `infraIndicators` array so these are classified as infrastructure errors and don't crash the pipeline Follows up on PR #230 which fixed the collector's JSON parsing and added basic stack trace classification. This change moves the tagging upstream to the test layer so the collector never sees unparseable failures from transient errors. ## Test plan - [x] 3202 tests pass (90 files) - [x] Prettier clean - [x] ESLint clean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 15 pre-existing issues identified during CR of PRs #226 and #229, plus 3 additional improvements from post-CR review. Grouped by area:
Router + Recorder — systemMessage array exact-match logic bug (unsatisfiable for 2+ needles), missing elevenlabs-tts/translation in endpoint compatibility filter, Content-Type empty-string fallback (?? → ||), EndpointType derived from FixtureMatch, negative guards on Gemini Interactions outputs detection, turnIndex/hasToolResult scoped to chat endpoints
WS-Realtime — incomplete session.update rollback (now captures full snapshot), missing Beta flat fields for noise reduction, transcription, and turn_detection, join all text content parts in realtimeItemsToMessages, ws.send try-catch with debug logging for close races
WS-Gemini-Live — deterministic tool call IDs replaced with random generateToolCallId() to prevent cross-turn collisions, pre-computed resolvedToolCalls for wire/history ID consistency, unrecognized-role warning, ws.send try-catch with debug logging, two new tests covering the random-ID fallback path
Gemini Interactions — interactionsUsage honors Gemini-native field names (promptTokenCount/candidatesTokenCount/totalTokenCount), truncateAfterChunks only counts content.delta events, webSearches warning on tool-call-only branch, documented _endpointType = "chat" rationale
fal-audio + ElevenLabs — all journal entries now use flattenHeaders(req.headers) instead of {}, handleSyncRun accepts RawJSONResponse fixtures
Helpers, types, transcription — resolveUsage extended with Gemini-native token fields, error cause preserved in factory rethrow, buildEmbeddingResponse accepts optional usage, extractFormField escapes regex metacharacters, types.ts header LLMock → aimock
Drift test infra — retry logging with body consumption, broadened redactUrl to cover api_key/apikey/token/access_token patterns, URL threaded into assertOk/parseJsonResponse for redacted error context, parseDataOnlySSE [DONE] filter fix, parseTypedSSE multi-line data handling with null guards and error context
Test plan