Skip to content

feat(calibration): reason-code enrichment pass — the flat-confidence era's only discriminator#8258

Merged
JSONbored merged 1 commit into
mainfrom
fix/decision-confidence-derivation
Jul 23, 2026
Merged

feat(calibration): reason-code enrichment pass — the flat-confidence era's only discriminator#8258
JSONbored merged 1 commit into
mainfrom
fix/decision-confidence-derivation

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

What

#8243's investigation + its actionable core. The constant-1.0 decision confidence has no live writer to fix: those decisions came from the retired legacy content gate (review_targets decisions stopped 2026-06-22), and the live path records finding-level confidences that genuinely vary. What the backfill era needs is segmentability — so pass C copies the ledger's own decision reasonCode onto each phase-1 fired row (DB-only, zero GitHub, idempotent, distinct provenance).

Already applied to BOTH stores (460/460 each) and immediately decisive

reason decided reversed rate
dual_review_declined (AI judgment) 223 68 30%
checks_failed 131 62 47%
scope_failure 29 8 28%
strict_duplicate 26 4 15%
thin_description 20 20 100%
source_unfetchable 17 5 29%
protected_metadata_edit 8 3 38%
source_archived 6 3 50%

Every thin_description close was pure friction — the author's rework always merged. These per-reason rates are exactly the evidence the disposition/drift work (#8211 tracks A/D) consumes.

Validation

Full npm run test:ci green (TEST_CI_EXIT=0, zero failed files); core patcher 100% covered (idempotency, never-guess, trim arms).

Closes #8243

…era's only discriminator (#8243)

Investigation result first: the constant-1.0 decision confidence has NO
live writer to fix — those decisions came from the retired legacy content
gate (review_targets decisions stopped 2026-06-22); the live path records
finding-level confidences that genuinely vary. What the backfill era
needs instead is segmentability: pass C copies the ledger's own decision
reasonCode onto each phase-1 fired row (DB-only, idempotent, distinct
provenance), separating AI-judgment closes (dual_review_declined, 48%)
from deterministic ones.

Applied to both stores (460/460 each) and immediately decisive:
thin_description closes reversed 100% (20/20 — pure friction),
checks_failed 47%, dual_review_declined 30%, strict_duplicate 15%.
Per-reason reversal rates are exactly the evidence the disposition and
drift work (#8211 tracks A/D) consume.

Closes #8243
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jul 23, 2026
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 23, 2026
@loopover-orb

loopover-orb Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-23 15:53:35 UTC

3 files · 1 AI reviewer · 1 blocker · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This adds a third, DB-only phase-2 backfill pass that copies each historical decision's reasonCode from review_targets onto its corresponding phase-1 fired row, giving the flat-confidence backfill era a segmentation axis. The core patcher (patchFiredMetadataWithReasonCode) is small, pure, and well-tested for its idempotency, blank-code, and unparseable-metadata arms, and the wrapper/report/CLI wiring for the new 'reason-codes' pass value is threaded consistently through parseArgs, runReasonCodesPass, renderPhase2Report, and main's dispatch. The target_key join (`${row.repo}#${row.number}` vs loadBackfillRows' target_key) is consistent with the existing convention used elsewhere in this file.

Nits — 5 non-blocking
  • The new runReasonCodesPass (scripts/backfill-calibration-corpus-phase2.ts) has no direct test of its own — only the pure patcher it calls is unit-tested, matching the existing pattern for the other passes but worth noting since it's the actual DB read/join logic.
  • scripts/backfill-calibration-corpus-phase2.ts is now ~515 lines per the external size check; consider whether pass C's IO logic (SQL + join + patch loop) could move into the -core.ts file alongside its patcher for consistency with the file's stated IO/pure split, though the existing passes already mix IO in this file so it's not a new pattern.
  • The RequestBudget is still constructed and passed through main() even though runReasonCodesPass never uses GitHub requests — harmless but slightly misleading given the pass is explicitly described as zero-GitHub.
  • Consider a light integration-style test for runReasonCodesPass's SQL/join (e.g., via the pg-cli test harness used elsewhere) rather than relying solely on the pure patcher's coverage.
  • scripts/backfill-calibration-corpus-phase2-core.ts:176 — the JSDoc already explains the 'calibration: decision-level confidence is a constant 1.0 — derive it from finding-level signal instead #8243' reference; a named constant isn't necessary here since it's just an issue-tracking comment, not a magic number in logic.

Concerns raised — review before merging

  • Linked issue does not appear to be satisfied: AI assessment: this PR does not appear to satisfy its linked issue's scope. The issue requires finding the live decision writer in review_targets and replacing the constant 1.0 confidence with a derivation (e.g. minimum) from contributing findings' confidences, plus an invariant test proving confidence varies. This PR instead argues no live writer needs fixing and adds an unrelated backfill enrichment pass tagging historical rows with reasonCode — it does not touch any de — Confirm this PR actually addresses the linked issue's scope, or link the correct issue.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. Linked issue does not appear to be satisfied: AI assessment: this PR does not appear to satisfy its linked issue's scope. The issue requires finding the live decision writer in review\_targets and replacing the constant 1.0 confidence with a derivation \(e.g. minimum\) from contributing findings' confidences, plus an invariant test proving confidence varies. This PR instead argues no live writer needs fixing and adds an unrelated backfill enrichment pass tagging historical rows with reasonCode — it does not touch any de — Confirm this PR actually addresses the linked issue's scope, or link the correct issue.

Decision drivers

  • ❌ Code review — 1 blocker (1 reviewer)
  • ❌ Gate result — Blocking (Repo-configured hard blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8243
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 14 registered-repo PR(s), 14 merged, 255 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 14 PR(s), 255 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Linked issue satisfaction

Not yet addressed
The issue requires finding the live decision writer in review_targets and replacing the constant 1.0 confidence with a derivation (e.g. minimum) from contributing findings' confidences, plus an invariant test proving confidence varies. This PR instead argues no live writer needs fixing and adds an unrelated backfill enrichment pass tagging historical rows with reasonCode — it does not touch any de

Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, Ruby, Go, MDX, Shell, Solidity, JavaScript
  • Official Gittensor activity: 14 PR(s), 255 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Treat this as maintainer-lane context rather than normal contributor-lane activity.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 23, 2026
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.14%. Comparing base (8e34212) to head (cb6ed76).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8258   +/-   ##
=======================================
  Coverage   92.14%   92.14%           
=======================================
  Files         785      785           
  Lines       78715    78715           
  Branches    23759    23757    -2     
=======================================
  Hits        72531    72531           
  Misses       5062     5062           
  Partials     1122     1122           
Flag Coverage Δ
shard-1 51.46% <ø> (ø)
shard-2 55.82% <ø> (-0.01%) ⬇️
shard-3 54.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@JSONbored
JSONbored merged commit e6e6521 into main Jul 23, 2026
14 checks passed
@JSONbored
JSONbored deleted the fix/decision-confidence-derivation branch July 23, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

calibration: decision-level confidence is a constant 1.0 — derive it from finding-level signal instead

1 participant