Skip to content

feat(orb): persist the AI judgment's confidence and prompt commitment in the decision record - #8847

Merged
JSONbored merged 1 commit into
mainfrom
feat/decision-record-ai-commitments
Jul 26, 2026
Merged

feat(orb): persist the AI judgment's confidence and prompt commitment in the decision record#8847
JSONbored merged 1 commit into
mainfrom
feat/decision-record-ai-commitments

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

What

When an AI-judgment finding (ai_consensus_defect / ai_review_split) shaped a decision, the decision record now carries the finding's calibrated confidence and the prompt-template commitment digest (REVIEW_PROMPT_VERSION + REVIEW_SYSTEM_PROMPT). Advances #8834 and completes #8842's tracked follow-up.

Why

#8835's risk-control thresholds calibrate over (confidence, adjudicated-correctness) pairs — so every decision must persist its confidence at decision time, joined to the same record the audit labels reference. The prompt digest makes 'which template judged this' a content-addressed fact, which the golden corpus's future AI tier and the replay harness both key on.

Scope note

The rotated-exemplar N-run consistency variant from #8834's text stays open on the issue as a flag-gated cost knob: the dual-model consensus already is a two-sample agreement signal (min-confidence + split→hold), so the extra sampling improves the signal but is not the prerequisite for calibration — persistence is, and this delivers it. modelId deliberately stays null at this site: the finding doesn't carry which concrete models ran, and recording a guess would be worse than nothing (reviewDiagnostics holds per-run identities).

Verification

TSC clean; 537 tests green (decision-record, queue, queue-2, ai-review) including: normalization arms (undefined→null, explicit 0 honored), render with/without confidence, and an end-to-end queue assertion that the consensus-defect one-shot close persists schemaVersion: 2, aiConfidence: 0.3, and a prompt digest. Changed-line coverage: 0 uncovered statements/branches.

… in the decision record

When an AI-judgment finding (ai_consensus_defect / ai_review_split)
shaped a decision, the decision record now carries the finding's
calibrated confidence and a digest of the prompt template commitment
(REVIEW_PROMPT_VERSION + REVIEW_SYSTEM_PROMPT) -- the fields that join
every decision to the risk-control calibration set (#8835) and complete
#8842's tracked follow-up.

Advances #8834 (the persistence half its issue text names as the core
deliverable; the flag-gated rotated-exemplar N-run variant remains --
the existing dual-model consensus already IS a two-sample agreement
signal, so the extra runs are a cost knob, not the prerequisite).

- DecisionRecord schema v2: + aiConfidence (null when no AI judgment
  contributed); normalized once at the builder like its siblings
- processors: source the confidence from the gate's own AI-judgment
  blocker; modelId deliberately stays null at this site -- the finding
  does not carry which concrete models ran, and a guess would be worse
  than nothing (reviewDiagnostics holds per-run identities)
- render: the model line gains the confidence when present
@superagent-security

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

Logic backtest

Replayed 0 historical case(s) for linked_issue_scope_mismatch through the base (19158b8) and head (0d631a1) versions of its detection logic (corpus checksum 4f53cda18c2b).

Backtest comparison: linked_issue_scope_mismatch

Verdict: unchanged — no comparable axis moved.

Advisory only — this check never blocks merge (#8105).

@JSONbored JSONbored self-assigned this Jul 26, 2026
@JSONbored
JSONbored merged commit 8a3d2c9 into main Jul 26, 2026
6 checks passed
@JSONbored
JSONbored deleted the feat/decision-record-ai-commitments branch July 26, 2026 12:54
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 26, 2026
@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.30%. Comparing base (19158b8) to head (0d631a1).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8847      +/-   ##
==========================================
- Coverage   93.84%   92.30%   -1.54%     
==========================================
  Files         803      803              
  Lines       80065    80069       +4     
  Branches    24267    24270       +3     
==========================================
- Hits        75138    73909    -1229     
- Misses       3562     5096    +1534     
+ Partials     1365     1064     -301     
Flag Coverage Δ
backend 92.98% <100.00%> (-2.15%) ⬇️

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

Files with missing lines Coverage Δ
src/queue/processors.ts 95.71% <100.00%> (+<0.01%) ⬆️
src/review/decision-record.ts 100.00% <100.00%> (ø)
src/services/ai-review.ts 97.15% <100.00%> (ø)

... and 3 files with indirect coverage changes

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant