Expand description
Task 10B: trace wiring for the Google Gemini Code Assist transport
(broker-proxied v1internal:streamGenerateContent) and the explicit
cloud-invoke routes (AWS Bedrock, Azure OpenAI, Google Vertex — all
broker-mediated). Mirrors the Anthropic/OpenAI seams:
- Exact bytes only. The Gemini transport serializes its envelope once
via
ProxyRequest::post_json_exact; on the local broker those very bytes go on the wire and are the digest preimage. On a remote broker the daemon re-serializes out of process, so records carrywire: NoneandTransportKind::CloudProxy— never a digest of bytes this process did not send. Cloud-invoke bodies are always serialized behind the broker boundary (provider-specific signing/shapes), so those records carrywire: Noneunconditionally. - One record per actual broker attempt. The Gemini 429 retry loop
emits one record per
proxy_streamcall; a cancellation observed during backoff sleep (no send in flight) emits no extra record. A tool-bearing cloud request fails §5.5 preflight before any broker or network work and emits no attempt record. - Honest translation reporting. The Gemini adapter’s known losses — dropped thinking/unknown blocks, dropped internal-only tools, merged text segments, synthesized function-response names — are reported as metadata-only entries (positional IDs, never content). Cloud-invoke routes flatten structured content to text and report the downgrade.
- Correctness firewall. Everything degrades to no-ops when tracing is disabled or identity is unrepresentable; provider-controlled error text never enters a record.
Constants§
- GEMINI_
INTERNAL_ TOOLS - Tool names the Gemini adapter drops as internal-only (never sent on the
Code Assist wire). Shared with
runtime::google_gemini::runtime’s wire filter so the trace report can never drift from the actual translation.
Functions§
- begin_
cloud_ invoke_ tracer - Begin tracing one explicit cloud invocation (AWS Bedrock, Azure OpenAI,
Google Vertex). Always
TransportKind::CloudProxywithwire: None: the provider body is serialized and signed behind the broker boundary, so this process never holds the exact bytes sent. ReturnsNonewhen tracing is disabled or identity is unrepresentable. - begin_
gemini_ tracer - Begin tracing one Gemini Code Assist request. Delegates to the shared
OpenAI-compatible builder (same normalized message walker, no cache
section, wire claimed only from
exact_sent_bytes). ReturnsNonewhen tracing is disabled or identity is unrepresentable. - cloud_
translation_ losses - Cloud-invoke translation report: the broker route is text-only, so any message whose content is not already a plain string is flattened to text (a structural downgrade), reported per message index.
- gemini_
translation_ losses - Metadata-only report of the rewrites the Gemini adapter performs on the
normalized (Anthropic-shaped) request. Element IDs are tool stable IDs or
positional paths (
messages[i],messages[i].blocks[j],tools[k]) — never content. - stop_
reason_ from_ gemini - Normalize a Gemini
finishReasoninto the trace enum. Unknown values collapse toOther— the raw string is never stored. - usage_
from_ cloud_ event - Provider-reported usage from a broker
CloudEvent::Usage. The broker event carries exactly input/output totals — nothing else is claimed. - usage_
from_ gemini - Provider-reported usage from a decoded Gemini stream chunk. Counts the
upstream did not report stay
None— never fabricated zeros.