Skip to content

feat(review): add AMS live-gate-thresholds read endpoint - #6553

Merged
loopover-orb[bot] merged 5 commits into
JSONbored:mainfrom
RealDiligent:feat/critical-issue-orb-gate-thresholds-endpoint-6486-v2
Jul 16, 2026
Merged

feat(review): add AMS live-gate-thresholds read endpoint#6553
loopover-orb[bot] merged 5 commits into
JSONbored:mainfrom
RealDiligent:feat/critical-issue-orb-gate-thresholds-endpoint-6486-v2

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Expose field-limited snake_case live gate thresholds for AMS via GET /v1/repos/:owner/:repo/live-gate-thresholds.
  • Live override wins; soaking shadow fills in when live is absent; 404 when neither is active.

Closes #6486

Supersedes closed #6545 / #6551 / #6552.

Test plan

  • Unit projection edge cases including confidenceFloor-only / scopeCap-only
  • Integration route coverage
  • CI + codecov/patch ≥ 99%

RealDiligent and others added 5 commits July 16, 2026 21:19
Expose field-limited snake_case confidence_floor / scope_cap_* from live (or soaking shadow) TunableOverride, gated by isMcpReadRepoAllowed, with 404 when no override is active.

Closes JSONbored#6486

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…ecov

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@superagent-security

Copy link
Copy Markdown
Contributor

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

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 16, 2026
@loopover-orb

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-16 13:36:50 UTC

7 files · 1 AI reviewer · no blockers · readiness 82/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR adds a read-only `GET /v1/repos/:owner/:repo/live-gate-thresholds` endpoint that projects either the live `TunableOverride` or, if absent, a soaking shadow override into a field-limited snake_case payload (confidence_floor/scope_cap_files/scope_cap_lines), returning 404 when neither is active. The projection logic (`toLiveGateThresholdFields`, `authoritativeGateOverride`) is small, pure, and well covered by unit tests including confidenceFloor-only/scopeCap-only/empty-object edge cases, and the integration test verifies live-wins-over-shadow, shadow-fallback, mcp-allowlist 403, and 401/404 paths while asserting audit/applied_at/clear_at fields never leak. OpenAPI/spec/schema wiring is consistent across all four surfaces (openapi.json, spec.ts, schemas.ts) and the route reuses the existing `requireStaticProtectedApiToken` + mcp-allowlist auth pattern already established for gate-config/effective.

Nits — 4 non-blocking
  • src/api/routes.ts:3018 — the changed import line has a stray leading two-space indent (` import { ... }`), which is inconsistent with the rest of the file's top-level import formatting.
  • src/api/routes.ts: the route does `await import("../auth/security")` inline inside the handler on every request just to call `isMcpReadRepoAllowed`; if that module isn't already imported elsewhere in routes.ts, hoist it to a static top-level import instead of a per-request dynamic import.
  • The v8 ignore comments on the auth branches (routes.ts) assume codecov will otherwise mark them patch-partial across shards — worth confirming these are genuinely unreachable-in-isolation rather than just under-tested.
  • Consider extracting the 401/403/404 status literals into named constants or reusing existing route conventions, per the external brief's magic-number note, though this is purely stylistic.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #6486, #6545
Related work ⚠️ 1 scoped overlap Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (2 linked issues).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 342 registered-repo PR(s), 166 merged, 31 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 342 PR(s), 31 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Partially addressed
The PR does add a field-limited live-gate-thresholds route with correct confidence_floor/scope_cap_files/scope_cap_lines projection and live-over-shadow precedence, but it invents a new 404 error shape (`live_gate_thresholds_not_found`) instead of reusing the sibling routes' existing not-found convention, and layers a new auth flow (requireStaticProtectedApiToken + actor-kind checks) around isMcpR

Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 342 PR(s), 31 issue(s).
  • Related work: Titles/paths share 11 meaningful terms. (issue #6486, issue #6487)
Contributor next steps
  • Start here: Review top overlaps.
  • Then work through the remaining 2 steps in the Signals table above.
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 &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; 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.

Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/ desktop before /
before /
after /
after /
diff /
diff /
/ mobile before / (mobile)
before / (mobile)
after / (mobile)
after / (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy · Diff highlights exactly what changed.

🟩 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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit e066a90 into JSONbored:main Jul 16, 2026
42 checks passed
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(review): read-only endpoint exposing ORB's live self-tuned gate thresholds

1 participant