core/docs
Shay bb95dfbe67 fix(runtime): defer the turn-event sink emission to the serve boundary (R7)
Audit-ledger R7, implementing docs/handoff/curriculum-license-loop-2026-07/
E1-R7-ASSERTION-SPEC.md. `ChatRuntime.chat` seals a TurnEvent before the
surface authority is known; `CognitiveTurnPipeline` back-stamps the resolved
surface and canonical trace_hash onto `turn_log[-1]` after `chat` returns. So
the in-memory log ended up correct and the DURABLE stream carried the
pre-override record — the thing that persists was the wrong one.

Mechanism, per the spec's M1-M3:

- M1 — stage an INDEX into `turn_log`, never the TurnEvent. The flush re-reads
  the log, so every back-stamp is picked up by construction and the staged
  record cannot go stale. Capturing the event object would be the original
  defect with extra steps.
- M2 — `attach_telemetry_sink` does NOT flush a staged turn event, the
  opposite of what it correctly does for `_pending_reboot_payload`. The reboot
  payload is final when buffered; a staged turn event is mid-flight. Flushing
  on attach would silently restore the defect.
- M3 — deferral is opt-in. The pipeline wraps the runtime rather than the
  reverse, so the runtime cannot detect whether a pipeline will run. A runtime
  used directly (eval and demo paths) emits inline, byte-identically and at
  the same moment as before.

The `finally` at the serve boundary is load-bearing (I5): a pipeline that
raises after `chat` returns must still flush, or an error path silently
swallows a telemetry record — worse than the staleness being fixed.

TWO CORRECTIONS TO MY OWN SPEC, reported rather than quietly absorbed:

1. I2 bullet 3 and I3 assert on an emitted `trace_hash`. There is no such
   field — `chat/telemetry.py` never serializes `TurnEvent.trace_hash`, so the
   sink never carried a trace_hash, stale or otherwise. R7 repairs the SURFACE
   only. Pinned by `test_trace_hash_is_not_in_the_wire_format_at_all` so the
   claim cannot be re-asserted; the replay-not-recomputation ruling is kept on
   the object that does carry the hash.
2. The surface divergence is unreachable under the DEFAULT config:
   `finalize_turn_surface` is a no-op on all 36 turns probed, because the
   runtime's own surface already wins the resolver. It fires under
   `realizer_grounded_authority` — 24 divergences over 84 turns. A test on the
   default config would have passed while proving nothing, exactly as the spec
   warned, so the fixture pins that flag and asserts the pre-fix divergence
   exists before asserting it is gone.

[Verification]: in-worktree on canonical CPython 3.12.13 with `uv sync
--locked`: smoke 591 (569 + 22), deductive 291 (unchanged). All seven existing
sink test files pass UNCHANGED (80 tests). warmed_session_consistency
telemetry_consistency_rate = 1.0. Mutation-checked all three mechanisms:
staging the event instead of the index -> 3 I2 tests red; flushing on attach ->
the M2 test red; dropping the `finally` -> the I5 test red. Registered in
`smoke` and `cognition`.
2026-07-26 10:56:03 -07:00
..
adr test(reliability): volume-honesty invariant + distinct-evidence audit 2026-07-25 16:03:10 -07:00
agents/grok
analysis feat(coherence): grounded-open hedge arm — serve pack surfaces honestly hedged instead of over-refusing (ADR-0254) 2026-07-23 01:27:17 -07:00
architecture
audit
benchmarks
briefs
curriculum
decisions
evals
examples
handoff docs(handoff): E1/R7 assertion spec + arc status after Phases A and B 2026-07-25 16:11:33 -07:00
handoffs
implementation
issues
lab
outreach
paradigm-archive
plans docs(handoff): E1/R7 assertion spec + arc status after Phases A and B 2026-07-25 16:11:33 -07:00
research test(reliability): volume-honesty invariant + distinct-evidence audit 2026-07-25 16:03:10 -07:00
sessions
specs fix(runtime): defer the turn-event sink emission to the serve boundary (R7) 2026-07-26 10:56:03 -07:00
workbench docs(governance): weekly-audit rulings T1/T7/T8/T9 — INV-32/33/34 registration, ADR-0243 fold, residual escalation, path sweep, prune ledger 2026-07-22 19:18:59 -07:00
zig chore: Refactor CLI and Governance Anchors (#926) 2026-07-03 12:34:56 -07:00
3lang-depth-pr-plan.md
admissibility-exemplars.md
ci-optimization.md
core-rd-base-prompts.md
ethics_packs.md chore: Refactor CLI and Governance Anchors (#926) 2026-07-03 12:34:56 -07:00
EVAL_AUDIT_2026-05-20.md
eval_methodology.md
frontier_baselines.md
gaps.md
handoff_template.md
hitl-backpressure.md
holdout_recipients.txt
identity_packs.md chore: Refactor CLI and Governance Anchors (#926) 2026-07-03 12:34:56 -07:00
master-plan-post-substrate-audit.md
memo.html
model_dependency_size_tally.md
pack_inventory_2026-05-21.md
position_paper.md
PROGRESS.md
README.md
recognizer-registry.md
refusal-taxonomy.md
reviewers.yaml
RUST.md
safety_packs.md
sponsors.md
teaching_order.md chore: Refactor CLI and Governance Anchors (#926) 2026-07-03 12:34:56 -07:00
test-debt-quarantine.md
testing-lanes.md
Whitepaper.md
Yellowpaper.md Lane 4: Registry Consolidation (language_packs to packs) 2026-07-04 15:11:28 -07:00

CORE Documentation Index

This is the central index for all documentation in the CORE project.

Canonical Root Documents

Directories

Architecture & Design

  • adr/ - Architecture Decision Records (ADRs). The canonical history of all ratified engineering choices.
  • architecture/ - High-level architectural documents (e.g., pipelines, schemas).
  • analysis/ - Deep dives and master plans for structural changes.
  • specs/ - Detailed technical specifications and invariants.

Planning & Progress

  • plans/ - Capability roadmaps and implementation plans.
  • briefs/ - Project briefs and scoping documents for upcoming work.
  • issues/ - Detailed issue analyses and technical reproductions (not standard trackers).
  • audit/ - Audit reports and claims ledgers.

Operations & Usage

  • examples/ - Usage examples and reference integrations.
  • workbench/ - Documentation for the CORE workbench UI and related tooling.
  • agents/ - Agent-specific operational guides.

    Note regarding agents/grok/: Operational guide for using Grok 4.3 + Grok Build with CORE. This is not architecture documentation.

Learning & Evaluation

  • curriculum/ - Documentation on the teaching/learning order and knowledge progression.
  • evals/ - Evaluation methodology and performance criteria documentation.
  • benchmarks/ - Benchmark evidence and performance tracking logs.

Historical & Experimental

  • sessions/ - Chronological session logs documenting the "decision trail" and intellectual history of major choices.
  • handoffs/ - Legacy brief, audit, and investigation notes (historical; the formal HANDOFF mechanism is retired — see AGENTS.md for the current lightweight session-break-summary-<DATETIME>.md convention).
  • research/ - Raw research notes and preliminary findings.
  • lab/ - Experimental content (Warning: Not ratified; must not be referenced as authoritative in production PRs).

External

  • outreach/ - External communications and messaging.
  • zig/ - Scoped documentation for the Zig language components.