fix(pipeline): back-stamp served surface onto TurnEvent — close T13 telemetry-consistency red #101
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/telemetry-serve-boundary"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes the T13 fast-lane red on
main(weekly audit 2026-07-22). Telemetry half only — the goldtether over-refusal (decision 2) and the durable-sink deferral (R7) are ledgered for separate treatment (see below).Defect (Absolute Provenance break)
CognitiveTurnPipeline.run()callsruntime.chat()(pipeline.py:287), which seals + emitsTurnEventwith the runtime-owned surface. The pipeline then applies the #96 fail-closedresolve_surface(:470) and the #97 logos-morph override (~:517). An overridden turn therefore serves a surface telemetry never recorded —TurnEvent.surface != pipeline.run().surface.warmed_session_consistencytelemetry_consistency_rate= 0.9444 (17/18) on unmodifiedmain.e0d1b475(#96). Verified pre-existing (fails plain AND state-isolated; unrelated to the #100 isolation fix).TurnEventcarried the pack-grounded surface ("To doubt means to think maybe not. pack-grounded (en_core_meta_v1).") while the pipeline returned the typed refusal ("I cannot certify an answer: the geometric coherence contract is open (goldtether_residual).").Nothing gated this: smoke does not cover the lane, and GitHub Actions are dead signals.
Fix (TDD)
bf80bc7f):telemetry_consistency_rate0.9444.ChatRuntime.finalize_turn_surface— a sibling to the existingfinalize_turn_trace_hashback-stamp. The pipeline owns the final surface decision, so it back-stamps the resolvedsurface/articulation_surfaceontoturn_log[-1]immediately after the trace-hash back-stamp (pipeline.py, right after:809). Operates on the most-recentTurnEvent(main or refusal-stub path); no-ops when unchanged or when no turn exists.trace_hashfolds the pre-decoration surface, not the served surface, so re-stampingTurnEvent.surfacecannot movetrace_hash.Diff: +57 / −0 across 2 code files + the ledger. No control-flow change; mirrors an established pattern.
Scope boundaries (deliberately NOT in this PR)
chat/refusal.py; already mutually exclusive with refusal —verdicts.py:42"refusal supersedes hedge"), discriminated by grounding provenance (structural), not question type. Own PR + real-data validation.finalize_turn_trace_hashalready carries; default sink isNone, so no live consumer is affected). A single deferred emission at the pipeline serve boundary would repair surface +trace_hashtogether. Ledgered.Validation
tests/test_warmed_session_lane.py: 10/10 passed (telemetry_consistency_rate0.9444 → 1.0).[Verification]:
uv run core test --suite smoke -qin worktreecore-wt-t13serve@5a343b49— 180 passed in 133.17s, exit 0.Merge on your authorization (no-merge-automation doctrine).