docs: research unified v1 LMCache observability for #141 - #156
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ebeee57480
ℹ️ 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".
| Both streaming and non-streaming Proxy responses expose exactly: `request_id`, | ||
| the entire mutable `trace` dictionary, `kv_ack`, `kv_ready_kids`, | ||
| `text_only_kids`, `miss_kids`, and `error`. Streaming inserts an |
There was a problem hiding this comment.
Correct the documented legacy metadata shape
The baseline proxy/proxy.py::build_cacheroute_meta returns only trace, kv_ack, the three KID lists, and error; request_id remains solely on ProxyTask and is not exposed in either response form. Calling it part of the existing compatibility contract, while later directing Phase 2 to leave that shape unchanged, will cause the rollout and its tests to assume a correlation field that clients never receive. Either remove it from this inventory or explicitly make adding it a documented wire-format change.
AGENTS.md reference: AGENTS.md:L255-L261
Useful? React with 👍 / 👎.
| Required: `context`, ordered tuple `stages`, `exported_at` UTC, `complete: bool`, | ||
| and schema version. Optional: `source_components`, sanitized top-level | ||
| `error_code`, `legacy_trace` (JSON-safe copy of current dictionary), and | ||
| `legacy_cacheroute_meta` during migration. Canonical ordering is |
There was a problem hiding this comment.
Deep-freeze legacy mappings in exported snapshots
These optional fields reintroduce mutable dictionaries into a snapshot that the proposal and test matrix require to be immutable. Pydantic's ConfigDict(frozen=True) prevents rebinding a model field but does not prevent mutations such as request_trace.legacy_trace["proxy_recv_ms"] = 0 (and nested values in legacy_cacheroute_meta have the same problem), so consumers can silently corrupt an exported research timeline. The contract needs to require a recursively immutable representation or an equivalent defensive export boundary rather than merely a JSON-safe dictionary copy.
Useful? React with 👍 / 👎.
| -> runtime_profile + created_at | ||
| -> targeted calls add compatibility_profile_id, endpoint_id, generation | ||
| -> Gateway responses preserve those fields |
There was a problem hiding this comment.
Use the actual versioned-message timestamp fields
The audited VersionedMessage contract has a timestamp field, not created_at, and GatewayAdapterBase._response constructs a fresh response without preserving the request timestamp. Thus this inventory both names a nonexistent envelope field and implies timestamp preservation that does not occur; instrumentation based on it may fail or incorrectly correlate request and response times. Document timestamp as a per-message timestamp and reserve created_at for nested domain objects that actually define it.
AGENTS.md reference: AGENTS.md:L273-L277
Useful? React with 👍 / 👎.
Motivation
Description
docs/research/issue-141-unified-observability.mdthat inventories request IDs and correlation fields, lists everyProxyTask.tracekey, documents separately stored prediction/state fields, queue timestamps/durations, KDN injection and fallback markers, first-token/prefill/decode/completion markers, LMCache/vLLM metrics usage, and places where context is currently lost.predicted,observed,actual,inferred,legacy-projected, orambiguous, and call out violations (e.g. overwritten predictions, mixed types intrace, and wall-clock-derived durations).core/observability/) and provide implementation-ready v1 model schemas forTraceContext,TraceStageName,TraceValueKind,TraceStageOutcome,TraceProvenance,TraceMeasurement,TraceStage,RequestTrace,CacheOperationTrace, and anOperationWaiterLinkcorrelation design.cacheroute_metaand existing trace dictionary shape for migration.Testing
ProxyTask.tracekeys inproxy/proxy.pyandproxy/queue/manager.pyand asserted they are documented in the new research file; the check succeeded.git diff --cached --checkand validated that the new file is staged cleanly and that the repository rootREADME.mdwas not modified; these checks passed.Codex Task