feat(miner): add chat action-dispatch scaffolding (#6519) - #6544
feat(miner): add chat action-dispatch scaffolding (#6519)#6544glorydavid03023 wants to merge 1 commit into
Conversation
Add the shared, disabled-by-default scaffolding the three chat action-family child issues (discover/attempt, portfolio release/requeue, governor pause/resume) register their handlers into. This issue wires no concrete action: the flag defaults OFF and the registry ships empty, so nothing observable changes. - `packages/loopover-miner/lib/chat-action-registry.js`: the allowlist registry plus `createChokepointRoutedHandler`, which routes an action's effect through the existing `governor-chokepoint.js` `evaluateGovernorChokepointGate` wrapper (the fail-closed precedence ladder) and brands the result. `registerChatAction` accepts ONLY branded handlers — a raw, unwrapped function is rejected at registration time, so a chat-triggered write cannot structurally bypass the Governor chokepoint. Every action must also supply its own params-validator. - `packages/loopover-miner/lib/chat-action-dispatch.js`: `dispatchChatAction`, the single entry point every chat-issued action must go through. Fail-closed order — the `MINER_CHAT_ACTIONS` flag (explicit enable values only) is checked FIRST, before the registry is touched or params are validated; then an unknown action is rejected, the action's params-validator runs (rejecting, never coercing, on failure), and only then is the registered handler invoked. Does not add any HTTP route, `vite-*-api.ts`, or UI, and does not modify `chokepoint.ts`/`governor-chokepoint.js`/`pretooluse-hook.js` — it only calls into them, unchanged. Tests cover both files to 100% branch: flag-off short-circuit, unknown-action rejection, params-validator pass/fail, the wrapped-accepted vs raw-rejected handler contract, and a regression test asserting the registry ships empty.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Caution 🛑 LoopOver review result - reject/close recommendedReview updated: 2026-07-16 13:00:17 UTC
Review summary Nits — 5 non-blocking
Why this is blocked
📋 Copy for AI agents — paste into your coding agentCI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk 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.
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.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests (6), validate-tests (2), validate-code); Linked issue overlaps another open PR; duplicate of open PR #6542). 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. |
Summary
packages/loopover-miner/lib/chat-action-registry.js(new): the allowlist registry +createChokepointRoutedHandler, which routes an action's effect through the existinggovernor-chokepoint.jsevaluateGovernorChokepointGatewrapper (the fail-closed precedence ladder) and brands the result.registerChatActionaccepts only branded handlers — a raw, unwrapped function is rejected at registration time, so a chat-triggered write cannot structurally bypass the Governor chokepoint. Every action must also supply its own params-validator.packages/loopover-miner/lib/chat-action-dispatch.js(new):dispatchChatAction, the single entry point every chat-issued action must go through. Fail-closed order — theMINER_CHAT_ACTIONSflag (explicit enable values only; unset/empty/anything-else = off) is checked first, before the registry is touched or params validated; then unknown-action rejection, then the params-validator (rejecting, never coercing, on failure), then the registered handler.Closes #6519.
Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #6519).Validation
git diff --checknpm run typecheck(0 errors)npm run test:coverage— the two new files (packages/loopover-miner/lib/chat-action-{dispatch,registry}.js, both inside Codecov's measured paths) are at 100% branch, statement, function, and line coverage: flag-off short-circuit, unknown-action + non-string-action rejection, both params-validator arms (incl. a falsy validator result and a missingerrorsarray), the wrapped-accepted vs raw-rejected handler contract, empty-name/missing-validator/duplicate rejections, and the ships-empty regression.If any required check was skipped, explain why:
test:workers,build:mcp,test:mcp-pack,ui:*,actionlint,npm auditwere not run locally — this PR adds only twopackages/loopover-miner/lib/modules + their tests; it touches no Cloudflare Worker, MCP package, UI, workflow, or dependency.ui:openapi:checkis unaffected (nosrc/apiroute/schema change). This Windows dev environment reports CRLF false-positives on the tree-wide prettier/openapi/engine-parity checks (pre-existing on cleanmain); committed files are LF. CI (Linux) is the authoritative gate.Safety
chokepoint.ts/governor-chokepoint.js/pretooluse-hook.js— it only calls into them, unchanged; it adds no second, competing safety check.vite-*-api.tsis added here.UI Evidence
Not applicable — backend-only library scaffolding, no UI or rendered surface.
Notes