Skip to content

feat(mcp): stream loop progress to the customer via a progress snapshot - #5798

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
luciferlive112116:feat/loop-progress-snapshot
Jul 14, 2026
Merged

feat(mcp): stream loop progress to the customer via a progress snapshot#5798
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
luciferlive112116:feat/loop-progress-snapshot

Conversation

@luciferlive112116

Copy link
Copy Markdown
Contributor

Summary

Implements #4800 — a customer can watch their rented loop's progress in near-real time instead of polling for a final result. Adds the deterministic brain of the stream (part of the Rent-a-Loop path #4778), so a customer surface (#4807) pushes on change rather than on a fixed interval.

  • new packages/loopover-engine/src/loop-progress.ts (pure): buildProgressSnapshot(state) formats a running loop's already-computed state into phase, status, iteration + percentComplete (through the iteration budget — capped at 100, null when the budget is unknown), and a bounded recent-activity tail. progressChanged(prev, next) decides when a snapshot has meaningfully changed on the displayed axes — so the surface streams on change, not on a fixed interval (the exact acceptance criterion). No IO, no transport.
  • new loopover_build_progress_snapshot MCP tool (src/mcp/server.ts); src/loop-progress.ts is a thin re-export shim over the engine module.

Acceptance (#4800): a test loop's progress is visible and updating without the client polling on a fixed interval — the progressChanged push-on-change model provides exactly that, tested at the engine level and end-to-end through the MCP tool.

Closes #4800

Scope

  • Conventional Commit title (feat(mcp): …).
  • Focused: the progress-snapshot model + its tool, on the merged intake/claim/results chain.
  • Follows CONTRIBUTING.md; no site//CNAME/VitePress.
  • Linked open issue: Closes #4800.

Validation

  • git diff --check
  • npm run typecheck clean; npm --workspace @loopover/engine run build + npm run build:mcp clean
  • npm run test:coverage on the changed code: loop-progress.ts 100% lines & branches (14/14); the new src/mcp/server.ts handler + schema + registration fully covered (all 43 changed lines, both branch sides — diff-verified).
  • MCP tool-invariant suites pass with the new tool (mcp-output-schemas "outputSchema on EVERY tool" + "schema-valid structured content").
  • Tests cover known/unknown/zero/over-budget percent-complete, the activity-tail cap, the done transition, and every progressChanged axis (first snapshot, phase/status/iteration/activity change, no-change).

If any required check was skipped, explain why:

  • Full test:ci not run end-to-end locally (Linux-only shell/self-host steps on Windows); the change-relevant gates above were validated directly.

Safety

  • No secrets, wallet/hotkey/coldkey, trust scores, rewards, private rankings, or private maintainer evidence — the snapshot is public-safe loop status only, source-free.
  • No auth/cookie/CORS/GitHub App/session change (pure function over caller-supplied data).
  • MCP behavior added + tested (output schema + schema-valid content).
  • No UI changes; no changelog edit.

Implements JSONbored#4800: a customer can watch their rented loop's progress in near-real time instead of
polling for a final result. Adds the deterministic brain of the stream (part of the Rent-a-Loop path
JSONbored#4778), so a customer surface (JSONbored#4807) pushes on change rather than on a fixed interval.

- new packages/loopover-engine/src/loop-progress.ts (pure): buildProgressSnapshot(state) formats a
  running loop's already-computed state into phase, status, iteration + percent-complete (through the
  iteration budget, capped, null when unknown), and a bounded recent-activity tail. progressChanged(
  prev, next) decides when a snapshot has meaningfully changed on the displayed axes -- so the surface
  streams ON CHANGE, not on a fixed interval. No IO, no transport.
- new loopover_build_progress_snapshot MCP tool (src/mcp/server.ts); src/loop-progress.ts is a thin
  re-export shim over the engine module.
- tests cover percent-complete (known/unknown/zero budget, over-budget cap), the activity-tail cap,
  the done transition, and every progressChanged axis (first snapshot, phase/status/iteration/activity
  change, and no-change), at the engine level and end-to-end through the MCP tool.

Closes JSONbored#4800
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.11%. Comparing base (9b3f4b2) to head (f30f682).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5798   +/-   ##
=======================================
  Coverage   95.10%   95.11%           
=======================================
  Files         584      585    +1     
  Lines       46440    46455   +15     
  Branches    14849    14854    +5     
=======================================
+ Hits        44169    44184   +15     
  Misses       1515     1515           
  Partials      756      756           
Flag Coverage Δ
shard-1 43.74% <26.66%> (-0.02%) ⬇️
shard-2 36.25% <26.66%> (+0.06%) ⬆️
shard-3 32.12% <73.33%> (-0.03%) ⬇️
shard-4 33.46% <26.66%> (+0.54%) ⬆️
shard-5 31.07% <80.00%> (-0.57%) ⬇️
shard-6 44.51% <26.66%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
packages/loopover-engine/src/loop-progress.ts 100.00% <100.00%> (ø)
src/mcp/server.ts 95.90% <100.00%> (+0.03%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

loopover-orb Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Tip

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

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-14 17:38:07 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a pure, small, well-tested addition: a `buildProgressSnapshot`/`progressChanged` module plus a thin MCP tool wrapper, closing issue #4800 with a push-on-change progress model. The math and edge cases (null/0/undefined maxIterations, capping at 100, activity-tail slicing) are correctly handled and covered by both engine-level and MCP end-to-end tests. The `src/loop-progress.ts` re-export shim mirrors the existing `results-payload.ts`/`idea-intake.ts` pattern, and CI is green across build/typecheck/tests.

Nits — 5 non-blocking
  • packages/loopover-engine/src/loop-progress.ts:24-25 — recentActivity/detail/at use `| undefined` in addition to `?:` which is redundant under standard TS config; harmless but inconsistent with typical style elsewhere in the codebase.
  • test/unit/loop-progress.test.ts — `progressChanged` only compares `recentActivity.length`, not content; a test that swaps activity items of the same length (e.g. replacing the last entry) would silently not push — worth a comment or explicit test acknowledging this is an intentional simplification.
  • src/mcp/server.ts:987 — `recentActivity` cap of `.max(1000)` in the input schema is much looser than the internal `MAX_PROGRESS_ACTIVITY` (10) truncation; consider aligning or documenting why the input allows more than is ever kept.
  • The 'size smells' flags on packages/loopover-engine/src/index.ts and src/mcp/server.ts reflect pre-existing file growth, not something this diff meaningfully worsens (it adds ~10 and ~43 lines respectively) — not actionable against this PR.
  • Consider exporting `MAX_PROGRESS_ACTIVITY` from `src/loop-progress.ts` shim explicitly if any downstream CLI needs the same cap value referenced by name (currently only re-exported via `export *`, which is fine but worth double-checking is intended).
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #4800
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low 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: 91 registered-repo PR(s), 37 merged, 39 issue(s).
Contributor context ✅ Confirmed Gittensor contributor luciferlive112116; Gittensor profile; 91 PR(s), 39 issue(s).
Gate result ✅ Passing No configured blocker found.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence. LLM value judgment: moderate — The PR adds a focused, pure, fully-tested progress-snapshot model plus one MCP tool that directly closes the linked issue #4800 without scope creep into unrelated areas.
Linked issue satisfaction

Partially addressed
The PR adds a deterministic snapshot builder and change-detection logic plus a synchronous MCP tool to compute a snapshot on request, but this is a pull-based tool call, not an actual streaming/push mechanism — a client still must invoke the tool repeatedly to see updates, so the acceptance criterion 'without the client needing to poll on a fixed interval' is only partially met since polling on-de

Review context
  • Author: luciferlive112116
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, JavaScript, MDX, Rust, TypeScript
  • Official Gittensor activity: 91 PR(s), 39 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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.
[BETA] Chat with Gittensory

Ask Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @gittensory ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @gittensory chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @gittensory 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/gittensory-commands

🟩 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.

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

@loopover-orb
loopover-orb Bot merged commit 96b8c42 into JSONbored:main Jul 14, 2026
16 checks passed
This was referenced Jul 14, 2026
This was referenced Jul 15, 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.

Real-time progress streaming

1 participant