Skip to content

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

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
real-venus:feat/propose-action-rest-cli-mirror-6744
Jul 17, 2026
Merged

feat(api): mirror loopover_propose_action to REST and the CLI#7030
loopover-orb[bot] merged 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.

…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.
@real-venus
real-venus requested a review from JSONbored as a code owner July 17, 2026 18:44
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.74%. Comparing base (12d030f) to head (847db98).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7030   +/-   ##
=======================================
  Coverage   93.74%   93.74%           
=======================================
  Files         690      690           
  Lines       68643    68662   +19     
  Branches    18756    18764    +8     
=======================================
+ Hits        64346    64365   +19     
  Misses       3302     3302           
  Partials      995      995           
Flag Coverage Δ
shard-1 43.81% <10.00%> (-0.02%) ⬇️
shard-2 36.89% <10.00%> (+0.04%) ⬆️
shard-3 33.14% <10.00%> (+0.10%) ⬆️
shard-4 34.82% <10.00%> (+0.85%) ⬆️
shard-5 31.44% <15.00%> (-0.82%) ⬇️
shard-6 45.82% <100.00%> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
src/api/routes.ts 94.94% <100.00%> (+0.04%) ⬆️

@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

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-17 18:55:46 UTC

6 files · 1 AI reviewer · no blockers · readiness 77/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This adds the missing CREATE side of the agent pending-actions REST endpoint plus a CLI `maintain propose` subcommand, closing the create/list/decide trio for issue #6744. The route mirrors the MCP tool's proposeAction handler (same auth gate, head-SHA pinning, idempotent create-if-absent, response shape) and the diff is well-tested across route, CLI, and completion-script layers. The magic numbers (500/60000 char limits, 400/409 status codes) and long-file flags from the brief are pre-existing patterns in this codebase, not real defects introduced here.

Nits — 4 non-blocking
  • src/api/routes.ts: the zod schema's max-length literals (500, 60000) duplicate proposeActionShape's bounds in src/mcp/server.ts without a shared constant — if one drifts, the two surfaces silently diverge despite the comment claiming they can't.
  • packages/loopover-mcp/bin/loopover-mcp.js: `pullArg` is read positionally via `args[2]` — confirm this can't misparse if a future flag is inserted before the pull-number positional.
  • Consider extracting the reason/reviewBody/closeComment max-length constants into a shared module imported by both src/mcp/server.ts and src/api/routes.ts so the 'VERBATIM mirror' comment is enforced by the type system rather than just a comment.
  • The 409 app_not_installed and 400 invalid_propose_action_request error codes look consistent with the sibling decision route — worth confirming existing API docs/clients that parse pending-actions errors already expect these exact strings (they should, per the decision route precedent).

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 #6744
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: 159 registered-repo PR(s), 86 merged, 20 issue(s).
Contributor context ✅ Confirmed Gittensor contributor real-venus; Gittensor profile; 159 PR(s), 20 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR adds the POST /v1/repos/:owner/:repo/agent/pending-actions create route with head-SHA pinning via createPendingAgentActionIfAbsent (mirroring proposeAction), plus a `maintain propose` CLI subcommand with matching options and validation, completing the create/list/decide trio as requested.

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: not available
  • Official Gittensor activity: 159 PR(s), 20 issue(s).
  • Related work: Titles/paths share 8 meaningful terms. (issue #6744, issue #6746)
Contributor next steps
  • Start here: Review top overlaps.
  • Then work through the remaining 3 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 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 a752b8f into JSONbored:main Jul 17, 2026
16 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.

REST + CLI mirror for loopover_propose_action

1 participant