fix(pipeline): back-stamp served surface onto TurnEvent — close T13 telemetry-consistency red #101

Merged
core-labs merged 1 commit from fix/telemetry-serve-boundary into main 2026-07-23 04:58:03 +00:00

1 commit

Author SHA1 Message Date
Shay
5a343b49e9 fix(pipeline): back-stamp served surface onto TurnEvent — close T13 telemetry-consistency red
CognitiveTurnPipeline emits TurnEvent inside runtime.chat() and only THEN
applies the #96 fail-closed surface resolution (resolve_surface) and the #97
logos-morph override — so an overridden turn's telemetry recorded a surface
the user never saw. warmed_session_consistency telemetry_consistency_rate was
0.9444 on main (fast-lane red since #96 e0d1b475): an audit/replay trust break
(Absolute Provenance).

Add ChatRuntime.finalize_turn_surface, a sibling to finalize_turn_trace_hash:
the pipeline owns the final surface decision, so it back-stamps the resolved
surface onto turn_log[-1] immediately after the trace-hash back-stamp.
trace_hash byte-identity is preserved — it folds the pre-decoration surface,
not the served surface.

Scope: telemetry-consistency half of T13 only.
- Decision (2), the goldtether over-refusal, is orthogonal to the red and
  OPEN pending ruling (ledger) — recommend AGAINST a query-type cue bypass
  (fail-open / ADR-0252-retired cue-table pattern); prefer routing
  open-geometry-but-pack-grounded surfaces to the existing hedge arm.
- Durable-sink deferral tracked as R7.

telemetry_consistency_rate 0.9444 -> 1.0 (10/10 warmed_session tests green).

[Verification]: uv run core test --suite smoke -q in core-wt-t13serve @ HEAD — 180 passed in 133.17s, exit 0; warmed_session lane 10/10 green.
2026-07-22 21:28:39 -07:00