Two issues in the voice/STT WebSocket proxy:
1. The established proxy never watched c.Request.Context().Done(), so
server.requestTimeout had no effect on a quiet, already-admitted
session: the account lease, concurrency slot, and upstream connection
stayed open past the configured deadline until a transport error
occurred on either side. Added a watcher that closes the session once
the request context is canceled, extracted as watchRequestTimeout so
it is unit-testable without a real WebSocket upgrade.
2. STT billing was gated on the downstream client closing cleanly
(successful == ErrorCode == ""), even though the cost is already
incurred the moment the upstream sends a confirmed transcript.done
duration. A client that received a complete transcription and then
disconnected abnormally left EstimatedCostInUSDTicks at zero,
understating usage against the key's billing limit. Billing is now
keyed on having a confirmed duration, not on how the transport ended.
requestRetry still leaked grok-4.6 dumps after the short-usage patch:
fake-enc/burst required visible >= minOutput, plaintext thinking vetoed
the dump detectors, and chat usage.completion inflated visible tokens.
Withhold when reasoning>=80 or ciphertext meets the floor and the visible
flush is <2s. Plaintext thinking still withholds if flush<2s and
reasoning/output >= 0.8. Cipher-only HasThinking waits until visible text
has streamed for 2s, or the stream ends. Visible tokens come from
streamed content only.
Does not enable requestRetry and does not change lab Docker/VERSION
defaults.
- support pipe-delimited call_id lookup (callId|itemId) for pi coding agent
- automatically backfill missing reasoning blocks before function_call in normalizeInputItems
- fallback to recent reasoning proof in conversation history when cache is cold
- prevents tool call deadlocks and infinite repetition in long-running agent loops
- recursively collect properties and required fields across $defs branches in root oneOf/anyOf
- eliminate root-level union rejections from strict upstream validators
- preserve compatibility with single nullable $ref roots
- completely delete anyOf/oneOf keys from root parameter schema
- merge all properties, required fields, and definitions into root object
- guarantees xAI upstream receives clean type=object schema, eliminating 'root schema is an anyOf/oneOf union with a non-object branch' rejection
- normalizeBuildFunctionParametersRoot now discards non-object branches (e.g. string/null) in anyOf/oneOf roots
- hoists single remaining object branch as clean object root with explicit type=object
- fixes xAI 400 rejection: 'tool parameter root must be an object type (root schema is an anyOf/oneOf union with a non-object branch)' on Codex/MCP tools