Skip to content

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

Closed
RealDiligent wants to merge 4 commits into
JSONbored:mainfrom
RealDiligent:feat/critical-issue-orb-gate-thresholds-endpoint-6486
Closed

feat(review): add AMS live-gate-thresholds read endpoint#6545
RealDiligent wants to merge 4 commits into
JSONbored:mainfrom
RealDiligent:feat/critical-issue-orb-gate-thresholds-endpoint-6486

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Add GET /v1/repos/:owner/:repo/live-gate-thresholds returning only confidence_floor / scope_cap_files / scope_cap_lines (snake_case allowlist; no audit / applied_at / clear_at).
  • Live override wins; soaking shadow fills in only when live is absent (authoritativeGateOverride).
  • 404 live_gate_thresholds_not_found when neither is active; 403 forbidden_repo for disallowed MCP tokens — same auth posture as gate-config/effective.
  • OpenAPI schema + unit/integration coverage.

Distinct from the existing gate-config/effective (#6247) camelCase dashboard shape: this is the AMS probe contract from #6209.

Closes #6486

Test plan

  • npx vitest run test/unit/auto-apply.test.ts -t "live gate threshold"
  • npm run ui:openapi
  • CI green (integration suite runs there)

Made with Cursor

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 16, 2026 12:48
@superagent-security

Copy link
Copy Markdown
Contributor

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

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>
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.81%. Comparing base (6c1a081) to head (67f594a).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
src/api/routes.ts 90.00% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (95.45%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6545   +/-   ##
=======================================
  Coverage   95.81%   95.81%           
=======================================
  Files         589      590    +1     
  Lines       47049    47136   +87     
  Branches    14962    14998   +36     
=======================================
+ Hits        45079    45165   +86     
  Misses       1176     1176           
- Partials      794      795    +1     
Flag Coverage Δ
shard-1 43.91% <59.09%> (-0.05%) ⬇️
shard-2 37.11% <9.09%> (-0.06%) ⬇️
shard-3 32.51% <18.18%> (+0.09%) ⬆️
shard-4 34.24% <18.18%> (-0.46%) ⬇️
shard-5 31.31% <9.09%> (-0.05%) ⬇️
shard-6 45.74% <77.27%> (-0.02%) ⬇️

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

Files with missing lines Coverage Δ
src/openapi/schemas.ts 100.00% <100.00%> (ø)
src/openapi/spec.ts 99.43% <100.00%> (+<0.01%) ⬆️
src/review/auto-apply.ts 99.22% <100.00%> (+0.05%) ⬆️
src/api/routes.ts 94.48% <90.00%> (-0.03%) ⬇️

@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

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-16 13:13:29 UTC

7 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
Adds a read-only AMS probe endpoint that exposes only confidence_floor/scope_cap_files/scope_cap_lines from the live override (falling back to a soaking shadow), explicitly excluding audit/applied_at/clear_at fields, matching the auth posture of the existing gate-config/effective route. The logic in toLiveGateThresholdFields/authoritativeGateOverride is straightforward and the integration test explicitly asserts audit fields never leak into the response body, which is the right kind of test for a field-limited payload. Wiring across OpenAPI schema, spec registration, and route handler is consistent and complete.

Nits — 5 non-blocking
  • src/review/auto-apply.ts: toLiveGateThresholdFields accesses override.scopeCap.files/.lines only guarded by `=== undefined`; if rowToOverride (or any other producer) can ever set scopeCap to null rather than omitting the key, this throws a TypeError — worth confirming the DB-row path never emits null there.
  • src/api/routes.ts:267 — the modified import line has stray leading indentation (` import {...}`) and the newly added names (authoritativeGateOverride, toLiveGateThresholdFields) aren't in alphabetical order with the rest of the import list.
  • codecov/patch is failing at 85.71%/95.45% against a 99% target — worth identifying which branch (likely the mcp-allowlist-deny or unauthorized-identity paths marked with v8 ignore) is actually undertested versus intentionally excluded.
  • The two `/* v8 ignore next */` comments assert specific branches are unreachable given upstream guards; that reasoning looks correct against the visible code (requireStaticProtectedApiToken narrowing) but is worth a second pair of eyes since it silently opts branches out of coverage.
  • src/api/routes.ts: dynamic `await import("../auth/security")` for isMcpReadRepoAllowed inside the handler is a bit unusual style-wise — check whether gate-config/effective (the sibling route) imports this statically instead, and align for consistency.

CI checks failing

  • codecov/patch — 95.45% of diff hit (target 99.00%)

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
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 (1 linked issue).
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
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 /
/ 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.

🟩 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

RealDiligent and others added 3 commits July 16, 2026 21:03
…t/critical-issue-orb-gate-thresholds-endpoint-6486
Co-authored-by: Cursor <cursoragent@cursor.com>
@loopover-orb

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

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