Skip to content

feat(mcpx): add script check failure policies - #6111

Open
dezren39 wants to merge 2 commits into
mainfrom
queue/9338-1911-script-check-remainder
Open

dezren39 wants to merge 2 commits into
mainfrom
queue/9338-1911-script-check-remainder

Conversation

@dezren39

@dezren39 dezren39 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

script.checkOnError:       fail | warn | run
script.checkOnUnsupported: skip | warn | switch

local CLI + remote ExecOptions → runner → preflight policy

Adds registry-backed settings and docs/API schema. switch uses Deno as checker only; the selected runtime still executes the script. This is the first bounded slice of #1911, not the full Approach C pipeline.

Still owed on #1911: syntax mode; script.compile/script.checkJs; local and remote text runtime reporting; one-time legacy-spelling notice; coordination note on #1868.

Evidence

  • Before: type-check failures always stopped a run; unsupported runtimes always emitted the same warning.
  • After: go test ./internal/preflight ./internal/runner ./internal/cli ./internal/execsvc ./internal/daemon ./internal/api -count=1 — PASS (API after regenerating plugin/opencode/mcpx/ops.gen.ts).
  • git diff --check — PASS.
  • Settings coverage test still reports the pre-existing proto.elicitationPerMinute, proto.samplingPerMinute, and proto.samplingSessionPerMinute gaps; the new policy settings are exempted against deterministic preflight tests.

Merge Danger

Door: two-way.

Blast Radius: bounded — changes preflight handling only when script checking is enabled; defaults preserve fail-on-check-error and warn-on-unsupported-runtime behavior.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 5, 2026 07:06
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0cb33335-908b-4c87-bcc3-7718b96630e1
Commits

Reviewing files that changed from the base of the PR and between 95dfaf4 and 7fc696b.

Files selected for processing: 14

  • pkgs/mcpx/docs/configuration.md
  • pkgs/mcpx/docs/exec.md
  • pkgs/mcpx/internal/api/ops_exec.go
  • pkgs/mcpx/internal/cli/commands.go
  • pkgs/mcpx/internal/cli/exec.go
  • pkgs/mcpx/internal/daemon/routes_exec.go
  • pkgs/mcpx/internal/execsvc/execsvc.go
  • pkgs/mcpx/internal/execsvc/execsvc_test.go
  • pkgs/mcpx/internal/preflight/preflight.go
  • pkgs/mcpx/internal/preflight/preflight_test.go
  • pkgs/mcpx/internal/runner/runner.go
  • pkgs/mcpx/internal/settings/effect.go
  • pkgs/mcpx/internal/settings/registry.go
  • pkgs/mcpx/plugin/opencode/mcpx/ops.gen.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T07:11:04.057794Z 7fc696b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7fc696b9bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +654 to +656
rep := preflight.TypeCheckWithPolicy(ctx, rt.Bin, scriptPath, preflight.TypeCheckMode(mode), timeout,
append(append([]string{}, rt.ConfigArgs...), depsFlags...), opts.Dir,
opts.TypeCheckOnError, opts.TypeCheckOnUnsupported)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve dependency download policy when switching checkers

When Node or Bun executes a script with checking enabled, checkOnUnsupported=switch, and deps.autoInstall=off, the new Deno checker can still download uncached dependencies. The forwarded depsFlags were generated for the execution runtime: Node supplies none, and Bun's --no-install is discarded by ResolutionArgs. Only the Deno branch of runner/deps.go generates --cached-only, which Deno documents as “Require that remote dependencies are already cached.” Consequently, switching checkers bypasses the configured no-download policy before execution even starts. Generate checker-specific dependency flags when switching to Deno, preserving deps.autoInstall=off.

Useful? React with 👍 / 👎.

What: "the program does not type check:\n" + indent(strings.TrimSpace(string(out))),
Where: "script.check",
Fatal: true,
Fatal: onError == "" || onError == "fail",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Deliver nonfatal check diagnostics to remote callers

For a remote /v1/exec request with typecheck=types and checkOnError=warn, a script that fails checking but executes successfully returns no warning. Downgrading the problem here sends it through runner.go:660–661, which writes directly to warnSink rather than the structured logger. execsvc.RunWith captures that writer in a stderr buffer (execsvc.go:934–948), but only exposes its contents when the script exits nonzero (execsvc.go:1063–1071). Consequently, neither the successful response nor its streamed frames contain the check diagnostic, making the new warn policy indistinguishable from run for remote callers. Route these warnings through the result/log delivery path even when execution succeeds.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant