Repository navigation
Description
Capture consented, redacted HTTP/API failures in product Analytics so v1/v2 protocol issues are visible in Firebase without USB logs or Diagnostic Logs export.
Today Crashlytics is fatals only. Product Analytics (product_user_action) has a few outcome=failure events (connect, rename, fork) and no method/path/status. Handled 4xx/5xx, transport, and decode errors never leave the device.
Triggered by live validation of OPE-146 (#172): wrong v2 routes and projector/stream failures will not show in Crashlytics. (The v2 archive 404 is now produced on the device and is excluded below.)
What to build
One new consented product event, fired from the HTTP/repository seam (not Screen Models), on iOS and Android:
| Event | Purpose |
|---|---|
product_api_error |
A product-used API call failed (HTTP 4xx/5xx, transport, or decode) |
Required params (enums / bounded strings only):
protocol—v1|v2method—GET|POST|PUT|PATCH|DELETEroute— normalized template, never a live URL. Example:/api/session/{id}/prompt,/session/{id}/prompt_async. Strip host, query (directory,location), and ids.status_code— numeric string (404,500) or0for transport/decode with no HTTP statuserror_class—http|transport|decoding
Optional:
duration_bucket— coarse enum only (lt_1s,lt_5s,lt_30s,gte_30s) if cheap; skip if not
Wire through existing OpenCodeReleaseObservability.logProductEvent (consent + Debug no-op). Feature UI still must not import Firebase.
Instrument at the shared HTTP clients / domain error adapters so every product-used remote is covered (session, message, event subscribe open, permission, question, command, agent, model, project, filesystem, vcs). Do not wait for a user tap.
Privacy (hard bans)
Same contract as OPE-124 / OPE-125:
- No host, server URL, worktree, query string, request/response body, prompt text, session/message ids, credentials
routeis a static template map (or path-id scrubber with tests). If a path cannot be mapped, sendroute=unknown— do not send the raw path- No Crashlytics
recordExceptionfor these (noise + easier to leak). Analytics only - Respect product-Analytics consent (OPE-129)
Do not fire
Expected client-side skips: V2SessionRemote (iOS and Android) throws a synthetic 404 without a network call for these v2 operations. Skip them by error origin, not by status code, so a real 404 from the server still emits:
- session todos (event-only seed)
- session message diff (last-turn capability gate)
- session archive
- session init
- session share / unshare
Also skip: HTTP 2xx, SSE idle disconnects that reconnect cleanly, probe failures already covered by connection-setup outcome=failure (optional: include probe HTTP failures if they are not already distinct).
Throttle: at most one event per {protocol, method, route, status_code} per process minute so a reconnect loop cannot flood Firebase.
Out of scope
- Logging successes / latency histograms
- Expanding Diagnostic Logs retention
- Crashlytics non-fatals for API errors
- Store privacy form rewrite (operator follow-up only if Firebase event volume/disclosure needs a second pass)
Acceptance criteria
- Shared
product_api_errorname + params on iOS and Android via the observability seam - Product-used remotes emit on real HTTP/transport/decode failure
- Route templates never include host, ids, or query; unit tests cover scrubbing
- v2 synthetic 404s (todos, message diff, archive, init, share/unshare) do not emit; a real server 404 on the same route still does
- Debug builds never send; Release requires Analytics consent
- Throttle documented and tested
- Event name, params, and privacy rules recorded on this issue and in code comments next to the
ProductAnalyticsconstants (docs/features/release-observability/no longer exists)
Related: OPE-124 taxonomy, OPE-146 server API v2.
Imported from Linear OPE-157. Linear status: Backlog. Priority: Medium. Created 2026-08-13.
Related: OPE-124, OPE-125, OPE-129, OPE-146.
Activity