Skip to content

feat(mcp): add loopover_set_agent_paused and loopover_set_action_autonomy tools - #6102

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
nghetienhiep:fix/issue-6087
Jul 15, 2026
Merged

feat(mcp): add loopover_set_agent_paused and loopover_set_action_autonomy tools#6102
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
nghetienhiep:fix/issue-6087

Conversation

@nghetienhiep

Copy link
Copy Markdown
Contributor

Summary

  • maintain pause/resume/set-level (the write-side kill-switch + per-action autonomy dial) had no MCP tool, even though maintain status/queue/approve/reject are already mirrored as loopover_get_automation_state/loopover_list_pending_actions/loopover_decide_pending_action. Added loopover_set_agent_paused and loopover_set_action_autonomy to close that gap.
  • Both tools require the same maintainer-manage authorization as loopover_propose_action (requireRepoManageAccess) and read-merge-write over the repo settings row so unrelated fields (and, for autonomy, other action classes) are preserved — matching the CLI's own pattern.
  • loopover_set_action_autonomy's action enum mirrors the CLI's MAINTAIN_ACTION_CLASSES exactly. Its level enum intentionally validates against the live AUTONOMY_LEVELS (src/settings/autonomy.ts) rather than the CLI's own MAINTAIN_AUTONOMY_LEVELS, which still lists suggest/propose — both removed server-side by Resolve dead config branches (wire or remove) #4620 and silently dropped by normalizeAutonomyPolicy on persist. Accepting them here would report a successful write that never actually took effect.

Closes #6087

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • 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 (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • ui:lint/ui:typecheck/ui:build skipped: this PR only touches src/mcp/server.ts + its unit test, no apps/loopover-ui/** files.
  • npm run test:coverage (full unsharded run) fails 3 pre-existing test files in this sandbox (selfhost-ams-reporting.test.ts needs a sqlite3 binary not installed here; miner-live-issue-snapshot.test.ts picks up a stray local GITHUB_TOKEN-shaped env var) — reproduced identically on a clean main stash, so unrelated to this diff. test/unit/mcp-automation-state.test.ts (this PR's tests) passes fully; verified via coverage/lcov.info that every changed line and branch in src/mcp/server.ts is hit (100% line + branch on the diff).

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.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

Not applicable: this is a backend-only MCP tool addition with no UI/docs/changelog surface.

UI Evidence

Not applicable — no UI/frontend change.

Notes

  • New tests added to test/unit/mcp-automation-state.test.ts (alongside the existing loopover_get_automation_state/loopover_propose_action coverage in the same file): successful pause/resume with unrelated-settings preservation, successful set-level confirming other action classes are untouched, schema rejection of an out-of-surface action class and of the CLI's stale suggest level, and an unauthorized-caller (write-access + MCP actuation allowlist) rejection test mirroring the sibling write tools.

@nghetienhiep
nghetienhiep requested a review from JSONbored as a code owner July 15, 2026 09:19
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.24%. Comparing base (0760e1f) to head (a430d67).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6102   +/-   ##
=======================================
  Coverage   95.24%   95.24%           
=======================================
  Files         595      595           
  Lines       47035    47067   +32     
  Branches    15015    15016    +1     
=======================================
+ Hits        44797    44829   +32     
  Misses       1493     1493           
  Partials      745      745           
Flag Coverage Δ
shard-1 43.95% <33.33%> (-0.06%) ⬇️
shard-2 36.62% <33.33%> (+<0.01%) ⬆️
shard-3 31.98% <33.33%> (-0.08%) ⬇️
shard-4 31.99% <33.33%> (-1.15%) ⬇️
shard-5 32.66% <33.33%> (+0.44%) ⬆️
shard-6 44.86% <100.00%> (+0.37%) ⬆️

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

Files with missing lines Coverage Δ
src/mcp/server.ts 96.21% <100.00%> (+0.08%) ⬆️

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

loopover-orb Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-15 09:33:14 UTC

2 files · 1 AI reviewer · no blockers · readiness 80/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
Adds two MCP tools, loopover_set_agent_paused and loopover_set_action_autonomy, mirroring the CLI's maintain pause/resume/set-level as read-merge-write operations over the repo settings row, matching the existing get_automation_state/propose_action patterns and access controls. The autonomy level enum is deliberately validated against the live AUTONOMY_LEVELS rather than the CLI's stale list, correctly closing a real gap where stale levels (suggest/propose) would silently no-op on persist. Tests cover pause/resume, autonomy read-merge-write, access denial, and rejection of out-of-surface action/level values, closing the linked issue #6087.

Nits — 5 non-blocking
  • src/mcp/server.ts: setAgentPaused/setActionAutonomy call getRepositorySettings then spread `...current` into upsertRepositorySettings — confirm getRepositorySettings returns a plain object safe to spread (not a class instance or containing extra derived fields) so the read-merge-write doesn't accidentally write back computed values.
  • The action enum MAINTAIN_AUTONOMY_ACTION_CLASSES duplicates the CLI's MAINTAIN_ACTION_CLASSES as a hardcoded literal array in server.ts rather than importing it, risking future drift if the CLI's list changes.
  • Consider adding a JSDoc-level comment noting why MAINTAIN_AUTONOMY_ACTION_CLASSES isn't imported from the CLI module, since the inline comment covers the AUTONOMY_LEVELS choice but not this one.
  • src/mcp/server.ts: import MAINTAIN_ACTION_CLASSES from the CLI module (if exported) instead of re-declaring MAINTAIN_AUTONOMY_ACTION_CLASSES, or add a comment/test asserting the two arrays stay in sync.
  • Add a test asserting agentPaused defaults correctly when getRepositorySettings returns no prior row for the repo (new repo, first pause call).
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #6087
Related work ⚠️ 2 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: 70 registered-repo PR(s), 36 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor nghetienhiep; Gittensor profile; 70 PR(s), 0 issue(s).
Gate result ✅ Passing No configured blocker found.
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff adds loopover_set_agent_paused and loopover_set_action_autonomy MCP tools that mirror the CLI's pause/resume/set-level operations, gate both behind requireRepoManageAccess matching sibling write tools, use a read-merge-write pattern preserving unrelated settings/action classes, and validate inputs against enums with tests covering success, preserved-other-classes, and unauthorized-caller

Review context
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://gittensory.aethereal.dev/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 cabc706 into JSONbored:main Jul 15, 2026
15 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 15, 2026
12 tasks
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(mcp): expose maintain pause/resume/set-level as MCP tools (write-side gap in the automation control surface)

1 participant