core/core
Shay c3e2a229a8 fix(pipeline): usefulness gate on realized-plan override
The 2026-05-19 design review's P0 #1 finding:

  > CognitiveTurnPipeline can replace a useful runtime surface with
  > placeholder prose.

Evidence at core/cognition/pipeline.py:147-149 (pre-fix):

  if realized_plan.surface and not gate_fired:
      surface = realized_plan.surface
      articulation_surface = realized_plan.surface

The override gate was JUST "non-empty + gate didn't fire".  No
usefulness check.  Result: a realizer output of
"Truth is defined as ..." (with <pending> rendered as ...) silently
overrode a perfectly-grounded runtime pack surface, and the runtime
audit log still held a third surface.

Fix: gate the override through ``_is_useful_surface`` from
generate/intent_bridge.py — the same predicate that already gates
the bridge's articulate_with_intent fallback path.  An ungrounded
realizer surface cannot honestly override a grounded runtime
surface.  When the realizer cannot produce a useful surface, we
keep the runtime answer the user sees.

Measured lift on the warmed_session_consistency lane (3 of its 4
metrics):

                                BEFORE      AFTER
  no_placeholder_rate         0.4444  →   1.0000
  telemetry_consistency_rate  0.4444  →   1.0000
  warm_grounding_stability    0.0000  →   0.0000  (separate bug — see below)

The two metrics that flipped to 1.00 are now CI-pinned in
tests/test_warmed_session_lane.py:
TestPipelineOverrideGateInvariants — any future weakening of the
override gate fails the suite immediately.

Cognition eval byte-identical:
  public:  100 / 100 / 91.7 / 100
  holdout: 100 / 100 / 83.3 / 100

KNOWN FOLLOW-UP — not in this commit:

  warm_grounding_stability remains 0.0 because of a SEPARATE bug
  the warmed lane surfaces:

    Turn 1: "What is truth?" -> pack-grounded ("truth — pack-grounded
            (en_core_cognition_v1): cognition.truth; ...")
    Turn 2: "What is truth?" -> vault-grounded ("Truth infer.")

  After turn 1 ingests pack content into the vault, turn 2's gate
  source flips from ``empty_vault`` to ``vault``, so the runtime's
  ``_maybe_pack_grounded_surface`` dispatcher is bypassed entirely
  and the field-walk path produces gibberish ("Truth infer.").

  This is the SurfaceSelector-shaped problem from the design review:
  pack-grounding should fire by intent shape and lemma residency, not
  by vault gate state.  Fix scope crosses runtime.py:chat() + the
  vault gate logic; deferred to its own commit / design proposal
  rather than absorbed here.

  The warmed lane already records the metric (0.0 baseline) so when
  the fix lands it shows up as a measurable lift.
2026-05-19 07:21:00 -07:00
..
cognition fix(pipeline): usefulness gate on realized-plan override 2026-05-19 07:21:00 -07:00
physics feat(adr-0052): teaching-grounded CAUSE/VERIFICATION surface 2026-05-18 07:13:43 -07:00
__init__.py chore: fix package name, add core/__init__.py, ADR-0011, session note 2026-05-13 2026-05-13 10:44:42 -07:00
_safe_display.py feat(adr-0051): trust-boundary hardening pass 2026-05-18 07:09:55 -07:00
cli.py feat(phase5+bench): cross-pack supersede + articulation benchmark suite 2026-05-18 17:44:59 -07:00
config.py feat(packs): en_core_polarity_v1 — polarity + frequency (16 lemmas) 2026-05-19 05:38:13 -07:00