Skip to content

feat(review): add an ordinal improvement/value judgment to the AI review schema - #4754

Merged
JSONbored merged 1 commit into
mainfrom
worktree-agent-af8327615bbe8b1d6
Jul 10, 2026
Merged

feat(review): add an ordinal improvement/value judgment to the AI review schema#4754
JSONbored merged 1 commit into
mainfrom
worktree-agent-af8327615bbe8b1d6

Conversation

@JSONbored

@JSONbored JSONbored commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a valueAssessment field to ModelReview (src/services/ai-review.ts) — an ordinal
    unclear/minor/moderate/significant band plus a one-sentence rationale — populated by the
    same AI-review call the engine already makes. No new LLM call, no new provider/model-selection
    surface.
  • This is a genuinely different axis from confidence: confidence is calibrated
    defect-certainty ("how sure am I my own blockers are real"); valueAssessment instead asks "does
    this change plausibly move the codebase forward, given the diff and its stated intent." It is also
    not a risk judgment — that stays the separate deterministic signals/slop.ts tier, untouched here.
  • Gated behind a caller-resolved input.improvementSignal boolean, mirroring how
    inlineFindings/findingCategories/securityFocus already work in this file: off by default, zero
    extra prompt/output tokens spent when off.
  • Dual-review combination (block mode, two reviewers): surfaces the more conservative (lower) of
    the two reviewers' bands, carrying that reviewer's own rationale (documented in
    composeImprovementSignal's doc comment).
  • Sanitizer safety: the prompt explicitly steers the model toward "improvement/value/gain" wording and
    away from "score" and its sibling forbidden terms; new tests assert a representative set of
    rationale strings pass every independent public-comment sanitizer this repo relies on.

Closes #4743. Part of epic #4737 (advances it; the epic itself stays open until its remaining
sub-issues land).

Scope

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally (unsharded) — every line and branch this PR changed is covered
    (verified with a v8 coverage-map cross-reference against the actual diff hunks, not just the
    aggregate repo percentage)
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check (unaffected — no OpenAPI/schema surface changed)
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate — 0 vulnerabilities
  • New/changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer
    boundaries

Additionally ran the full npm run test:ci composite gate end-to-end (not just its pieces
individually): exit 0, 692 test files / 13,742 tests passed, 2/12 pre-existing skips, zero
failures.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, PATs, private keys, raw trust scores, private
    rankings, or private maintainer evidence anywhere in the diff (confirmed by reading the diff).
  • Public GitHub text stays sanitized: the new prompt instructions steer the model away from
    "score" and its sibling forbidden terms toward "improvement/value/gain" wording; new tests
    assert a representative set of rationale strings pass isPublicSafeText
    (src/signals/redaction.ts) and both independently-implemented sanitizePublicComment
    functions (src/queue-intelligence.ts and src/github/commands.ts), plus a negative-control
    test proving those assertions are meaningful (a rationale using forbidden vocabulary does trip
    all three).
  • Auth/cookie/CORS/GitHub App/Cloudflare/session: N/A — no such surface touched.
  • API/OpenAPI/MCP: N/A — this extends an internal type + prompt only; no route/schema/tool changed.
  • UI: N/A — no UI/frontend code touched.
  • Docs/changelog: N/A — no changelog edit (not a release-prep PR).

UI Evidence

N/A — no visible UI/frontend/docs surface in this PR; it only changes
src/services/ai-review.ts (internal schema + prompt) and its test file.

Notes

…iew schema

Adds a `valueAssessment` field to `ModelReview` (`src/services/ai-review.ts`),
populated by the SAME LLM call the reviewer already makes -- no new call, no
new provider/model-selection surface. It is a genuinely different axis from
`confidence`: `confidence` is calibrated defect-certainty ("how sure am I my
own blockers are real"); `valueAssessment` instead asks "does this change
plausibly move the codebase forward, given the diff and its stated intent."
It is also not a risk judgment -- that stays the deterministic slop.ts tier,
which this call never touches.

The band is a small fixed ordinal (unclear/minor/moderate/significant),
matching this repo's existing SlopBand convention, never a percentage. The
system prompt only asks for it -- and the parser only looks for it -- when
the caller resolves `input.improvementSignal` on, mirroring how
inlineFindings/findingCategories/securityFocus are already caller-resolved
in this file, so the disabled path spends zero extra prompt or output
tokens and this file carries no new dependency on the `ConvergedFeatureKey`
union.

Sanitizer safety: the prompt explicitly steers the model toward
"improvement/value/gain" wording and away from "score" and its sibling
forbidden terms, since a sanitizer hit on AI-authored text drops the whole
note rather than redacting the offending phrase. A rationale that still
fails the check is dropped the same way (never surfaced, never partially
redacted). New tests assert a representative set of rationale strings pass
every independent public-comment sanitizer this repo relies on
(isPublicSafeText, and both same-named sanitizePublicComment
implementations), plus a negative control proving those assertions are
meaningful.

Dual-review combination: when both reviewers emit a valueAssessment, the
more conservative (lower) of the two bands is surfaced, carrying that
opinion's own rationale -- overclaiming a change's value is the riskier
direction to err toward advisory-only.

Depends on #4738 (adding `improvementSignal` as a real `ConvergedFeatureKey`)
before any caller can resolve and pass this flag in production; that has not
merged yet, so this PR uses a caller-resolved boolean field rather than an
internal resolveConvergedFeature call, keeping it independently compilable
and mergeable regardless of #4738's landing order.

Implements #4743 (sub-issue of epic #4737)
@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 10, 2026
@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 10, 2026
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4754   +/-   ##
=======================================
  Coverage   94.21%   94.22%           
=======================================
  Files         440      440           
  Lines       38712    38736   +24     
  Branches    14101    14112   +11     
=======================================
+ Hits        36474    36498   +24     
  Misses       1577     1577           
  Partials      661      661           
Files with missing lines Coverage Δ
src/services/ai-review.ts 96.71% <100.00%> (+0.12%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb

loopover-orb Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-10 23:19:03 UTC

2 files · no blockers · readiness 100/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • AI review already in progress for this PR head: Another Gittensory pass is already running the AI review for this exact PR head. This pass is skipping to avoid a duplicate LLM call.

Review summary
AI review is already running for this PR head in another Gittensory pass. Gittensory is holding this PR for manual review until that pass completes.

Nits — 2 non-blocking
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.
  • AI review already in progress for this PR head — The gate is held for a human reviewer rather than passed automatically; it re-evaluates once the in-flight review completes or on the next update.
Signal Result Evidence
Code review ✅ No blockers No AI review summary
Linked issue ✅ Linked #4743
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: 48 registered-repo PR(s), 40 merged, 285 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 48 PR(s), 285 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Linked issue satisfaction

Addressed
The PR adds an ordinal `valueAssessment` field to `ModelReview` with explicit doc-comment and prompt language distinguishing it from `confidence`/risk, gates it behind a caller-resolved `improvementSignal` flag with byte-identical prompts when off, reuses the existing LLM call with no new provider surface, documents and implements a conservative-band dual-review combination in `composeImprovementS

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, JavaScript, Ruby, Go, Kotlin, MDX, Shell
  • Official Gittensor activity: 48 PR(s), 285 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • 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.

🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 10, 2026
@JSONbored
JSONbored merged commit 5c20908 into main Jul 10, 2026
11 checks passed
@JSONbored
JSONbored deleted the worktree-agent-af8327615bbe8b1d6 branch July 10, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. manual-review Gittensor contributor context

Development

Successfully merging this pull request may close these issues.

Extend ModelReview with an ordinal improvement/value judgment

1 participant