Skip to content

miner(self-review): applyLiveGateThresholdsToManifest never raises the live confidence floor when the static manifest has no readiness config #10338

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

Context

packages/loopover-miner/lib/self-review-context.ts's applyLiveGateThresholdsToManifest
overlays a live-probed ORB confidence floor onto a statically-reconstructed FocusManifest, per its
own doc comment: "confidence_floor → raise-only readinessMinScore (mirrors
applySelfTuneOverrideToSettings)":

if (typeof fields.confidence_floor === "number") {
  const floorScore = Math.max(0, Math.min(100, Math.round(fields.confidence_floor * 100)));
  if (typeof gate.readinessMinScore === "number" && floorScore > gate.readinessMinScore) {
    gate.readinessMinScore = floorScore;
  }
}

packages/loopover-engine/src/focus-manifest.ts defaults readinessMinScore to null (not a
number) whenever a repo's manifest doesn't configure a custom readiness threshold — the common case
for any repo without a custom .loopover.yml readiness block. typeof null === "object", so the
typeof gate.readinessMinScore === "number" guard evaluates false for exactly this default case.
The result: a successfully-fetched live confidence_floor is silently discarded and never applied
whenever there's no pre-existing static value to compare it against — the "raise-only" overlay
never RAISES anything in the most common baseline configuration, because there's nothing for it to
compare against and raise.

Every existing test for this function in test/unit/miner-self-review-context.test.ts (around
lines 717-746 and 843-857) constructs its baseline manifest from YAML that explicitly sets
gate.readiness.minScore to a real number (70, 10, or a deliberately-invalid "x" string for the
type-guard case) — none constructs a manifest with no readiness block at all (the real
readinessMinScore: null default) and then applies a live confidence_floor, so the no-op path is
currently untested.

Requirements

  • Change applyLiveGateThresholdsToManifest's confidence_floor branch so that when
    gate.readinessMinScore is null (or otherwise not a number), the live floorScore is ADOPTED
    as the initial value, not discarded. The "raise-only" semantics must still hold when a real
    existing number IS present — do not regress the existing raise-only comparison for that case.
  • Do not change behavior for the case where fields.confidence_floor itself is not a number — that
    branch is untouched (existing outer if (typeof fields.confidence_floor === "number") guard
    stays).

Deliverables

  • applyLiveGateThresholdsToManifest adopts a live confidence_floor as the initial
    readinessMinScore when the static baseline has no existing numeric value (null or
    otherwise not a number).
  • The existing raise-only behavior (a live floor lower than an existing static number does NOT
    overwrite it; a live floor higher than an existing static number DOES overwrite it) is
    unchanged and still passes its existing tests.
  • A new regression test constructing a baseline manifest with no readiness block (i.e. the
    real default readinessMinScore: null), applying a live confidence_floor, and asserting
    the resulting gate.readinessMinScore equals the live-derived floorScore — the exact path
    that currently silently no-ops.

All deliverables are required in this one PR.

Test Coverage Requirements

This repo's Codecov patch gate is 99%+ (branch-counted) on packages/loopover-miner/lib/**. Add
the new regression test to test/unit/miner-self-review-context.test.ts (this package's tests
live in the shared root test/ directory, not packages/loopover-miner/test/**). The new branch
handling readinessMinScore === null must be exercised, and the pre-existing branches (both the
raise case and the no-raise-because-lower case) must remain covered by the existing tests.

Expected Outcome

A repo whose .loopover.yml has no custom readiness threshold still gets the live ORB-probed
confidence floor applied when one is available, matching the "raise-only" overlay's own stated
intent instead of silently no-op'ing for the most common baseline configuration.

Links & Resources

  • packages/loopover-miner/lib/self-review-context.tsapplyLiveGateThresholdsToManifest
    (~lines 167-186).
  • packages/loopover-engine/src/focus-manifest.tsreadinessMinScore's default of null
    (~line 1386).
  • test/unit/miner-self-review-context.test.ts — existing tests around lines 717-746, 843-857 to
    extend/mirror.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions