Skip to content

feat(api): mirror loopover_propose_action to REST and the CLI - #6939

Closed
real-venus wants to merge 1 commit into
JSONbored:mainfrom
real-venus:feat/propose-action-rest-cli-mirror-6744
Closed

feat(api): mirror loopover_propose_action to REST and the CLI#6939
real-venus wants to merge 1 commit into
JSONbored:mainfrom
real-venus:feat/propose-action-rest-cli-mirror-6744

Conversation

@real-venus

Copy link
Copy Markdown
Contributor

Summary

The loopover_propose_action MCP tool stages a new pending agent action for later maintainer approval
(it never auto-executes). REST already had the list side (GET .../agent/pending-actions) and the
decision side (POST .../agent/pending-actions/:id/:decision), both CLI-mirrored — but no way to
create a staged action over REST/CLI. This completes the create/list/decide trio.

  • POST /v1/repos/:owner/:repo/agent/pending-actions — a plain create route, requireRepoWriteAccess-gated
    exactly like its sibling decision route. It mirrors the proposeAction MCP handler verbatim: resolve the
    repo's installation (409 app_not_installed if the App isn't installed), pin the staged action to the PR's
    current head SHA (the same force-push freshness guard proposeAction sets, fix(mcp): gittensory_propose_action stages actions with no expectedHeadSha, disabling the force-push guard #2255), then
    createPendingAgentActionIfAbsent at auto_with_approval. It returns the identical
    { created, action: { id, actionClass, pullNumber, status, reason } } shape the tool returns, and only
    stages
    an action — it never executes one. A zod schema mirroring proposeActionShape (minus the
    path-param owner/repo) rejects a malformed body with 400 invalid_propose_action_request.
  • loopover-mcp maintain propose <action-class> <pull-number> — the CLI subcommand, alongside the
    existing status/queue/approve/reject. Posts to the bare create path, supports
    --reason/--label/--review-body/--merge-method/--close-comment + --json, validates the action class
    (the 7-value propose set, incl. review_state_label) and pull number before any request, and sanitizes
    every API-echoed field on the plain-text path.

Like every sibling agent/pending-actions route, it is deliberately omitted from the OpenAPI spec.

Closes #6744

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (Closes #6744).

Validation

  • npm run typecheck
  • npm run build:mcp (node --check)
  • npm run command-reference:check / npm run ui:openapi — no diff (local maintain subcommands aren't in the generated command catalog; mirror routes aren't in the OpenAPI spec)
  • git diff --check
  • npx vitest run test/unit/routes-agent-approval.test.ts test/unit/mcp-cli-maintain.test.ts (66 passing)
  • Verified 100% statement + branch coverage on every changed line in src/api/routes.ts (the only Codecov-measured file in this diff) via coverage-final.json — every optional-param branch (present/absent), the head-SHA pin (present/absent), the schema-reject, and the not-installed arm.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics. — the CLI runs every API-echoed field through sanitizePlainTextTerminalOutput; --json stays raw (JSON.stringify escapes control chars).
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. — the route is requireRepoWriteAccess-gated like the decision route; a non-maintainer session gets 401/403 (tested), and the coarse-allowlist comment is updated to reflect the new write-gated POST on the shared path.
  • API/OpenAPI/MCP behavior is updated and tested where needed. — new route tested for parity + every branch; deliberately no OpenAPI entry (matches all sibling pending-actions routes).
  • No visible UI changes (REST route + CLI subcommand only), so no UI Evidence section is required.
  • Public docs/changelogs: --help documents the new subcommand; no changelog edited.

Notes

  • No new business logic or decision surface: the route reuses the same pure createPendingAgentActionIfAbsent
    path the MCP tool calls, with the same write gate and head-SHA pinning. It stages for approval only —
    execution stays exclusively on the existing accept path.
  • The action-class enum is kept as a dedicated 7-value PROPOSE_ACTION_CLASSES in the CLI (a superset of the
    autonomy-configurable set-level list, adding review_state_label) so propose accepts exactly what the
    route + MCP tool accept.

@real-venus
real-venus requested a review from JSONbored as a code owner July 17, 2026 14:32
@superagent-security

Copy link
Copy Markdown
Contributor

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

@github-actions
github-actions Bot had a problem deploying to preview/pr-6939 July 17, 2026 14:35 Failure
…red#6744)

Add POST /v1/repos/:owner/:repo/agent/pending-actions and a `maintain propose`
CLI subcommand, completing the create/list/decide trio the approval queue only
had list/decide for.

The route is write-gated (requireRepoWriteAccess) like its sibling decision
route and mirrors the loopover_propose_action MCP tool: same head-SHA pinning
(JSONbored#2255) and the same { created, action } shape. It only STAGES an
auto_with_approval action for a maintainer to accept/reject later; it never
executes one. Like the sibling pending-actions routes it is not in the OpenAPI
spec. The CLI subcommand posts to the bare create path and sanitizes every
API-echoed field on the plain-text path.
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 15.00000% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.01%. Comparing base (5347291) to head (98a1d77).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/api/routes.ts 15.00% 17 Missing ⚠️

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

❗ There is a different number of reports uploaded between BASE (5347291) and HEAD (98a1d77). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (5347291) HEAD (98a1d77)
shard-6 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6939      +/-   ##
==========================================
- Coverage   93.71%   87.01%   -6.70%     
==========================================
  Files         685      685              
  Lines       68358    68377      +19     
  Branches    18726    18734       +8     
==========================================
- Hits        64059    59501    -4558     
- Misses       3302     7186    +3884     
- Partials      997     1690     +693     
Flag Coverage Δ
shard-1 43.68% <10.00%> (-0.02%) ⬇️
shard-2 36.83% <10.00%> (-0.02%) ⬇️
shard-3 32.75% <10.00%> (-0.01%) ⬇️
shard-4 34.83% <10.00%> (-0.01%) ⬇️
shard-5 31.31% <15.00%> (-0.01%) ⬇️
shard-6 ?

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

Files with missing lines Coverage Δ
src/api/routes.ts 58.91% <15.00%> (-35.85%) ⬇️

... and 117 files with indirect coverage changes

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

loopover-orb Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - reject/close recommended

Review updated: 2026-07-17 14:48:00 UTC

5 files · 1 AI reviewer · 1 blocker · CI failing · blocked

🛑 Suggested Action - Reject/Close

Review summary
This PR adds the missing CREATE side of the agent pending-actions REST/CLI trio (list and decide already existed), implemented as a new POST route that mirrors the loopover_propose_action MCP handler, plus a corresponding `maintain propose` CLI subcommand and fixture-harness wiring. The route logic (schema validation, app_not_installed 409, head-SHA pinning, requireRepoWriteAccess gate, idempotent createPendingAgentActionIfAbsent call) is well-traced and consistent with the sibling decision route, and the new tests cover the create/idempotent/validation/auth/not-installed paths. The main issue is codecov/patch failing at 15% against a 99% target, meaning large swaths of the new route and CLI code are not actually exercised by tests despite the added test files.

Blockers

  • codecov/patch reports only 15.00% of the diff is covered (target 99%), meaning significant new logic in the propose route (src/api/routes.ts) and/or the CLI propose subcommand (packages/loopover-mcp/bin/loopover-mcp.js) is untested despite the added test files, so per this repo's coverage bar this is not merge-ready.
Nits — 5 non-blocking
  • src/api/routes.ts: the 500/60000 length limits in proposePendingActionSchema are unexplained magic numbers duplicated from proposeActionShape — consider a shared constant or comment citing the MCP schema as the source of truth.
  • packages/loopover-mcp/bin/loopover-mcp.js: `maintain propose` usage/help text should also link back to issue REST + CLI mirror for loopover_propose_action #6744 or the propose route doc comment for discoverability, matching the convention used elsewhere in this file.
  • Confirm getPullRequest's headSha field name/shape matches what pr?.headSha expects — worth a quick verification since this is the force-push freshness guard's critical input.
  • Investigate why codecov/patch is only at 15% given the added route + CLI + harness tests — likely some branches (e.g. the app_not_installed 409 path, or particular optional-param combinations) aren't hit; add targeted assertions rather than relying on the existing suite.
  • Consider extracting the 500/60000 length caps into named constants shared between src/mcp/server.ts's proposeActionShape and this new schema to guarantee they can't drift apart silently.

Why this is blocked

  • codecov/patch reports only 15.00% of the diff is covered (target 99%), meaning significant new logic in the propose route (src/api/routes.ts) and/or the CLI propose subcommand (packages/loopover-mcp/bin/loopover-mcp.js) is untested despite the added test files, so per this repo's coverage bar this is not merge-ready.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. codecov/patch reports only 15.00% of the diff is covered \(target 99%\), meaning significant new logic in the propose route \(src/api/routes.ts\) and/or the CLI propose subcommand \(packages/loopover-mcp/bin/loopover-mcp.js\) is untested despite the added test files, so per this repo's coverage bar this is not merge-ready.

CI checks failing

  • validate
  • codecov/patch — 15.00% of diff hit (target 99.00%)
  • validate-tests (6)

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 #6744
Related work ⚠️ 3 scoped overlaps 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: 167 registered-repo PR(s), 90 merged, 20 issue(s).
Contributor context ✅ Confirmed Gittensor contributor real-venus; Gittensor profile; 167 PR(s), 20 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Review context
  • Author: real-venus
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript, JavaScript, Python, Rust, CSS, MDX, Svelte, Swift
  • Official Gittensor activity: 167 PR(s), 20 issue(s).
  • Related work: Titles/paths share 8 meaningful terms. (PR #6937)
  • Related work: Titles/paths share 6 meaningful terms. (issue #6743)
  • Related work: Titles/paths share 6 meaningful terms. (issue #6747)
  • Additional title-only matches omitted; title-only overlap does not block.
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.

🟩 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 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, codecov/patch, validate-tests (6)); AI reviewers agree on a likely critical defect: codecov/patch reports only 15.00% of the diff is covered (target 99%), meaning significant new logic in the propose route (src/api/routes.ts) and/or the CLI propose subcommand (packages/loopover-mcp/bin/loopover-mcp.js) is untested despite the added test files, so per this repo's coverage bar this is not merge-ready.). 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.

@loopover-orb loopover-orb Bot closed this Jul 17, 2026
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.

REST + CLI mirror for loopover_propose_action

1 participant