Skip to content

fix(miner-ui): register chat governor and discover/attempt actions under vite preview too - #7292

Closed
galuis116 wants to merge 1 commit into
JSONbored:mainfrom
galuis116:fix/miner-ui-chat-plugins-preview-server-7228
Closed

fix(miner-ui): register chat governor and discover/attempt actions under vite preview too#7292
galuis116 wants to merge 1 commit into
JSONbored:mainfrom
galuis116:fix/miner-ui-chat-plugins-preview-server-7228

Conversation

@galuis116

Copy link
Copy Markdown
Contributor

Summary

  • apps/loopover-miner-ui/README.md's "Running as a persistent service" section documents that every vite-*-api.ts plugin registers for both configureServer and configurePreviewServer, so npm run build && npm run preview alone is sufficient — no extra step needed. Two plugins didn't actually honor that contract: vite-chat-governor-actions.ts's chatGovernorActionsPlugin() and vite-chat-discover-attempt-actions.ts's chatDiscoverAttemptActionsPlugin() only implemented configureServer.
  • vite preview only ever runs a plugin's configurePreviewServer hook, never configureServer — which is exactly the deployment mode systemd/loopover-miner-ui.service.example (this repo's own recommended persistent-deployment unit) uses. Under that mode, registerGovernorChatActions() / registerDiscoverAttemptChatActions() never ran, so the shared chat-action registry stayed empty and any chat-issued governor pause/resume or discover/attempt command dispatched against it, surfacing to the operator as a silent-looking unknown_action ("Couldn't {pause/release/…}: action is not registered.") — identical wording to a real bug, with the actual cause being the deployment mode, not the command itself.
  • Factored each plugin's registration call into a shared register() function and wired it to both configureServer and configurePreviewServer, matching the shape every other plugin in this app already uses (vite-chat-api.ts's chatApiPlugin). registerGovernorChatActions/registerDiscoverAttemptChatActions are already idempotent — confirmed by reading packages/loopover-miner/lib/chat-governor-actions.js/chat-discover-attempt-actions.js, both guard each registration with a registry.has(...) check before calling register — so no new idempotency logic was needed; calling the same function from either hook is safe.
  • No change to configureServer's existing behavior, the registration modules under src/lib/, or any other plugin file.

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 #7228

Validation

  • git diff --check — clean.
  • npm --workspace apps/loopover-miner-ui run typecheck (tsc --noEmit) — clean.
  • npm --workspace apps/loopover-miner-ui run lint (eslint .) — 0 errors; the 7 pre-existing warnings (Fast Refresh / exhaustive-deps on unrelated files) are untouched by this change.
  • npx vitest run in apps/loopover-miner-ui — 328/328 passing across all 29 test files (no regressions), including two new test files: src/vite-chat-governor-actions.test.ts and src/vite-chat-discover-attempt-actions.test.ts, each proving the registration function is invoked when only configurePreviewServer is exercised (not just configureServer), via a mock of the dynamically-imported registration module.
  • apps/** is outside this repo's Codecov coverage.include scope (confirmed in PR Ledgers page and portfolio's queue-actions table never join the shared live-refresh poll cadence #7082's own body and this issue's own Test Coverage Requirements section), so this PR carries no codecov/patch obligation — the new dedicated tests are the local coverage proxy.
  • The repo-root npm run test:ci's ui:build step (which builds @loopover/ui-miner among other workspaces) was not run locally — it's a heavy, multi-workspace build (engine + both UI apps + both extensions) on this shared, memory-constrained sandbox, and this change is scoped to two plugin files' Vite lifecycle hooks with no build-config or route changes; ui:typecheck/ui:lint/ui:test above are the local proxy for this workspace.
  • npm run test:workers / npm run build:mcp / npm run test:mcp-pack / npm run ui:openapi:check (not applicable — no Worker route, MCP transport, or OpenAPI surface changed)
  • npm audit --audit-level=moderate (no dependency changes)

If any required check was skipped, explain why:

  • The repo-root whole-workspace ui:build step wasn't run locally for the resource reasons above; CI's isolated runner performs the real build. ui:typecheck/ui:lint/ui:test (all clean, scoped to the actual affected workspace) are the local substitute.

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. (N/A — this only wires an existing, already-tested registration call into a second Vite lifecycle hook; no auth/cookie/CORS/session changes.)
  • API/OpenAPI/MCP behavior is updated and tested where needed. (N/A — no /api/* route added or changed; the governor/discover/attempt HTTP routes this registry ultimately gates dispatch for are unchanged and already tested elsewhere.)
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. (N/A — no visible UI changes; this is a server-side Vite plugin lifecycle fix.)
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots. (N/A — no visible UI changes.)
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

…der vite preview too

vite-chat-governor-actions.ts and vite-chat-discover-attempt-actions.ts
only implemented configureServer, unlike every other vite-*-api.ts
plugin in this app. vite preview only runs configurePreviewServer, so
under the documented persistent-service deployment path (npm run
build && npm run preview, per systemd/loopover-miner-ui.service.example)
the shared chat-action registry never gets these two registrations,
and any chat-issued governor pause/resume or discover/attempt command
dispatches against an empty registry as unknown_action.

Both registration functions already guard against re-registering via
registry.has() checks, so calling them from both hooks is safe.

Closes JSONbored#7228
@galuis116
galuis116 requested a review from JSONbored as a code owner July 19, 2026 13:00
@superagent-security

Copy link
Copy Markdown
Contributor

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

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 19, 2026
@loopover-orb

loopover-orb Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - reject/close recommended

Review updated: 2026-07-19 13:14:34 UTC

4 files · 1 AI reviewer · 1 blocker · CI green · clean

🛑 Suggested Action - Reject/Close

Review summary
This diff correctly extends both chat-action plugins to register under configurePreviewServer, matching the pattern already used by vite-chat-api.ts, and fixes a real bug where systemd-deployed vite-preview instances never registered governor/discover/attempt chat actions. The `register()` extraction is clean, the registration functions are confirmed idempotent (registry.has guard), and the diff is accompanied by tests exercising both hooks independently. This is a narrow, well-targeted fix tied to issue #7228 with no scope creep.

Nits — 5 non-blocking
  • The added test files use `@​ts-expect-error` to call configureServer/configurePreviewServer without a server arg; consider passing a minimal mock server object instead for stronger typing, though this matches the existing convention in the codebase.
  • The doc comments in both plugin files are quite long for a two-line functional change; could be trimmed to just the essential rationale.
  • apps/loopover-miner-ui/vite-chat-governor-actions.ts and vite-chat-discover-attempt-actions.ts: consider adding a one-line test asserting configureServer and configurePreviewServer are the same function reference to guard against future accidental divergence.
  • Consider updating README's 'Running as a persistent service' section (mentioned in the PR description) to explicitly confirm this contract now holds for all plugins, if not already done elsewhere in the diff.
  • Pull request duplicates other open work — Check for an existing pull request or issue covering this change and coordinate or consolidate before continuing.

Why this is blocked

  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.

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 #7228
Related work ⚠️ Same linked issue: #7293, #7295 Another open PR references the same linked issue.
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: 1953 registered-repo PR(s), 1282 merged, 51 issue(s).
Contributor context ✅ Confirmed Gittensor contributor galuis116; Gittensor profile; 1953 PR(s), 51 issue(s).
Improvement ✅ Minor risk: low · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
Both plugins now share a register() function wired to both configureServer and configurePreviewServer, exactly mirroring the vite-chat-api.ts pattern requested, with no changes to the idempotent registration modules themselves.

Review context
Contributor next steps
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 <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> 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

@loopover-orb

loopover-orb Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (Linked issue overlaps another open PR; duplicate of open PR #7295). 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:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat governor and discover/attempt action registration is missing from configurePreviewServer, unlike every sibling vite-*-api.ts plugin

1 participant