Skip to content

test(mcpx): remote-safe e2e subset — fail-closed registry + remote runner leg (#13386) - #13597

Merged
dezren39 merged 3 commits into
mainfrom
lane-au12-13386
Nov 23, 2026
Merged

dezren39 merged 3 commits into
mainfrom
lane-au12-13386

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Implements the remote-safe e2e subset for #13386 (no auto-close: the issue's last acceptance line is the new leg going green in CI, which runs on main — the outcome record follows on the issue once the main run reports).

What lands

  • pkgs/mcpx/internal/e2e/remote_safe_tests.txt — the registry: one test name per line, with the membership claim spelled out (no host-local server binary, no daemon stop/restart, no per-test daemon config). Opt-in only.
  • pkgs/mcpx/internal/e2e/remote_test.go — remote mode (MCPX_E2E_REMOTE=1 + MCPX_DAEMON_ENDPOINT):
    • selection fails closed in two layers: the CI leg builds its -run pattern from the registry, and newEnv skips any unlisted test in remote mode, so a manual full-suite run against a shared daemon cannot point host-local fixtures at it;
    • newRemoteEnv points CLI children at the shared daemon and transplants no host-local config (empty server set; the daemon is never started or stopped by the test);
    • addRemoteServer registers a per-test server over POST /v1/servers under a per-test suffixed name and removes it with DELETE in cleanup;
    • guard tests: TestRemoteSafeSelectionFailsClosed (registry non-empty, names resolve to real test functions, pattern + predicate admit exactly the registry, canonical member present) and TestAddRemoteServerRegistersSuffixedAndRemovesOnCleanup (against a fake /v1 daemon).
  • pkgs/mcpx/internal/e2e/e2e_test.go — the newEnv remote branch (10 lines).
  • .github/workflows/mcpx-test.yml — new remote-e2e leg beside remote-smoke: daemon from the shipped image (packages.mcpx-container) with a published port and the remote-smoke status probe for readiness; the subset runs on the host against it. Added to the ci-ok gate's needs.

TestExecOnTheDaemonRunsWhereTheDaemonIs is the canonical first member of the subset, as the issue names it.

Verification (laptop runs, worktree off main 1f9bc15391c)

  • go vet ./internal/e2e/ clean; gofmt clean; workflow YAML parsed (job present, in ci-ok needs).
  • Both new guard tests pass.
  • Canonical test passes in local mode (ok for the package on a clean run; one earlier run tripped the suite's disturbed-daemons guard from concurrent suites on the shared laptop and passed on re-run with the guard silent).
  • Canonical test passes in remote mode against a real standalone daemon over TCP (MCPX_E2E_REMOTE=1 MCPX_DAEMON_ENDPOINT=http://127.0.0.1:18799), and an undeclared test (TestLsStartsDaemonAndListsNamespaces) skips in remote mode with the fail-closed message.
  • go test ./internal/settings/ green (the env scan does not flag the test-only mode variable; it is read only from _test.go files).

Pre-existing red, not from this change: TestEveryRegistryVariableIsHarnessSetOrSafe fails at the base commit — MCPX_ADAPTERS_ALLOW_BARE is in neither envguard classification table. That is main suite health, tracked by #13481; this PR does not touch it.

— Lane AU12 (archer)


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

…nner leg (#13386)

The e2e suite can now run a declared subset of its tests against a
shared daemon it did not start, reached over MCPX_DAEMON_ENDPOINT:

- internal/e2e/remote_safe_tests.txt is the registry: one test name per
  line. Selection fails closed in two layers — the CI leg builds its
  -run pattern from the registry, and newEnv skips any unlisted test
  when remote mode is on (MCPX_E2E_REMOTE=1), so a full-suite remote
  run cannot point host-local fixtures at a shared daemon by accident.
- newRemoteEnv points CLI children at the shared daemon and transplants
  no host-local config; a test that needs a server on the daemon adds
  it with addRemoteServer (POST /v1/servers under a per-test suffixed
  name, DELETE in cleanup).
- TestExecOnTheDaemonRunsWhereTheDaemonIs is the canonical first
  member; guard tests prove the selection admits exactly the registry
  and that addRemoteServer suffixes and removes.
- New remote-e2e leg in mcpx-test.yml, beside remote-smoke: the daemon
  runs from the shipped image (packages.mcpx-container) with a
  published port, and the subset runs on the host against it. Added to
  the ci-ok gate's needs.

Verified on the laptop: go vet + gofmt clean; both new guard tests
pass; the canonical test passes in local mode and in remote mode
against a real standalone daemon over TCP, and an undeclared test
skips in remote mode; internal/settings green. One pre-existing main
red is untouched by this change: TestEveryRegistryVariableIsHarnessSetOrSafe
fails at the base commit because MCPX_ADAPTERS_ALLOW_BARE is in
neither envguard table (suite health, #13481).
@coderabbitai

coderabbitai Bot commented Nov 23, 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 59 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: a815c02e-b5db-4b38-8706-4dcec2e607bf
Commits

Reviewing files that changed from the base of the PR and between 81587f3 and 9f1278d.

Files selected for processing: 4

  • .github/workflows/mcpx-test.yml
  • pkgs/mcpx/internal/e2e/e2e_test.go
  • pkgs/mcpx/internal/e2e/remote_safe_tests.txt
  • pkgs/mcpx/internal/e2e/remote_test.go
  • 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 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T18:17:18.783859Z 753a265 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: 753a2655ea

ℹ️ 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 +124 to +125
"MCPX_CONFIG="+filepath.Join(dir, ".mcpx.json"),
"MCPX_DAEMON_ENDPOINT="+endpoint,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Select a daemon-local working directory for remote execution

In the new remote-e2e workflow, the daemon runs inside an unmounted container, but this environment leaves script.cwd at its default caller. The binary runner launches the CLI in this host-only temporary directory; execRemoteScript forwards that path as Options.Cwd, and the daemon's runner assigns it to cmd.Dir through ResolveCwd. Consequently, the registered canonical test cannot start its script inside the container because that directory does not exist there, making the new required CI leg fail even after readiness succeeds. Configure the remote client to use a daemon-local policy such as workdir, rather than forwarding the host temporary directory.

Useful? React with 👍 / 👎.

…13386)

Codex review of PR #13597: with the default script.cwd=caller, the CLI
forwards host-local paths with a remote exec request, and the daemon
starts the script resolved against them — paths that do not exist on
the daemon's side of the connection, so the canonical test would fail
in the new remote-e2e leg even after the readiness probe succeeds. A
same-filesystem daemon cannot show this, which is why the local remote
smoke passed.

Fix: newRemoteEnv sets MCPX_SCRIPT_CWD=workdir for its CLI children, so
the policy travels with the request and ResolveCwd resolves on the
daemon.

Verified against the real shipped image on the laptop (nix-built
mcpx-container, daemon in docker, subset run from the host): the
canonical test passes with workdir (4.0s). Mutation check: forcing
caller makes the same run fail — the daemon tries to exec the host's
nix-store bun path, which does not exist in the image.
@dezren39

Copy link
Copy Markdown
Member Author

Codex P1 addressed in 3ab6b6c9716 — and proven against the real shipped image, not just argued.

The finding was right, and a same-filesystem daemon hides it (my first remote smoke ran the daemon on the laptop, where the host paths exist). Fix: newRemoteEnv now sets MCPX_SCRIPT_CWD=workdir for its CLI children, so the policy travels with the request and ResolveCwd resolves on the daemon.

Container rehearsal of the leg, on the laptop, from this branch:

  • nix build .#packages.x86_64-linux.mcpx-container, daemon in docker (no config file, bun runtime — the shipped condition), readiness via the leg's own status probe: ready.
  • Subset run from the host with the registry-built pattern: TestExecOnTheDaemonRunsWhereTheDaemonIs PASS (4.0s).
  • Mutation check: forcing MCPX_SCRIPT_CWD=caller makes the identical run FAIL — the daemon tries to exec the host's nix-store bun path, which does not exist in the image. Restored to workdir and re-verified (guard tests green, gofmt/vet clean).

— Lane AU12 (archer)

# Conflicts:
#	.github/workflows/mcpx-test.yml
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