From d5babcd55985348a0a636a90f035e82a993229a8 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Mon, 23 Nov 2026 13:36:59 -0600 Subject: [PATCH 1/3] test(mcpx/e2e): classify MCPX_ADAPTERS_ALLOW_BARE as harness-set The #1992 env guard (TestEveryRegistryVariableIsHarnessSetOrSafe) fails on main: MCPX_ADAPTERS_ALLOW_BARE (setting adapters.allowBare) is declared in the settings registry but classified in neither envguard table. TestAdaptersAllowBareGatesABareDeclaration sets the variable with e.setenv in internal/e2e/effect_test.go, so per the guard's own definitions it belongs in harnessSetMCPX. This broke e2e shard 3, the flake binary e2e legs and the container e2e leg of the mcpx test workflow (run 45227606720). Verified: the guard failed before this change with exactly this one unclassified variable and passes after; the effect probe and the full CI-assigned shard-3 pattern (104 tests) also pass. Part of #13619 --- pkgs/mcpx/internal/e2e/envguard_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/mcpx/internal/e2e/envguard_test.go b/pkgs/mcpx/internal/e2e/envguard_test.go index c4554ce0b2..252d918eb8 100644 --- a/pkgs/mcpx/internal/e2e/envguard_test.go +++ b/pkgs/mcpx/internal/e2e/envguard_test.go @@ -32,6 +32,7 @@ import ( // harnessSetMCPX is every registry variable the harness sets: newEnv for // every child, or a test's withEnv/append for its own. var harnessSetMCPX = map[string]struct{}{ + "MCPX_ADAPTERS_ALLOW_BARE": {}, "MCPX_ARTIFACTS_MAX_BYTES": {}, "MCPX_AUTONOMY_MAX": {}, "MCPX_AUTOSTART_ARGS": {}, From f6eed7c25110fcb40f1dd3f55898b606910f1629 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Mon, 23 Nov 2026 14:27:44 -0600 Subject: [PATCH 2/3] test(mcpx/e2e): match script.cwd by value, not by line position TestScriptCwdIsReachableFromTheEnvironment took the last line of the combined stream as the script's pwd. The dispatch notice ("running under sh (shebang dispatch): ...") is written to stderr and its position against the script's stdout is not ordered; in the flake-binary leg of mcpx test run 45251429763 the notice came after the pwd, so the last line was the notice and the test compared "" against the expected directory. Scan the output for a line that resolves to the script directory instead, and fail when none does (a run that stayed in the caller's directory therefore still fails). Verified: 20 consecutive local runs pass; the failing ordering is the one recorded in the run log. Part of #13619 --- .../internal/e2e/dispatch_settings_test.go | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/pkgs/mcpx/internal/e2e/dispatch_settings_test.go b/pkgs/mcpx/internal/e2e/dispatch_settings_test.go index 0727e5e61b..87c5076b92 100644 --- a/pkgs/mcpx/internal/e2e/dispatch_settings_test.go +++ b/pkgs/mcpx/internal/e2e/dispatch_settings_test.go @@ -46,12 +46,27 @@ func TestScriptCwdIsReachableFromTheEnvironment(t *testing.T) { defer func() { e.envVars = saved }() out := e.run("run", script) - // The dispatch notice shares the stream; the script's pwd is the - // last line it printed. - lines := strings.Split(strings.TrimSpace(out), "\n") - got, _ := filepath.EvalSymlinks(strings.TrimSpace(lines[len(lines)-1])) + // The dispatch notice shares the stream and is written to stderr, so + // its position against the script's own stdout output is not + // ordered (observed in the flake-binary leg of run 45251429763, + // where the notice followed the pwd). Find the pwd by value instead + // of assuming it is the last line: a run that stayed in the caller's + // directory prints that directory and matches nothing here. want, _ := filepath.EvalSymlinks(sub) + var got string + for _, line := range strings.Split(strings.TrimSpace(out), "\n") { + cand := strings.TrimSpace(line) + if !filepath.IsAbs(cand) { + continue + } + resolved, err := filepath.EvalSymlinks(cand) + if err != nil || resolved != want { + continue + } + got = resolved + break + } if got != want { - t.Fatalf("MCPX_SCRIPT_CWD=script: pwd = %q, want %q\n%s", got, want, out) + t.Fatalf("MCPX_SCRIPT_CWD=script: no output line is the script directory %q\n%s", want, out) } } From 161dcbefe0e66bcf12981535f9adb353966d4093 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Mon, 23 Nov 2026 15:25:22 -0600 Subject: [PATCH 3/3] fix(mcpx/pool): refuse a schema refresh whose deadline has passed A daemon refresh with daemon.refreshTimeout=1ns raced the transport: an already-running instance could still answer tools/list after the deadline had expired, so TestDaemonRefreshTimeoutBoundsARefresh failed about one run in eight (shard 0, run 45259861221). Checking the context before acquiring makes the bound deterministic. --- pkgs/mcpx/internal/pool/pool.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/mcpx/internal/pool/pool.go b/pkgs/mcpx/internal/pool/pool.go index c8d9953683..b23dbc882b 100644 --- a/pkgs/mcpx/internal/pool/pool.go +++ b/pkgs/mcpx/internal/pool/pool.go @@ -1293,6 +1293,9 @@ func (p *Pool) refreshSchemasScoped(ctx context.Context, scoped *config.Resolved // recording a guaranteed failure as the server's state. return p.refreshFailed(staleGen, fmt.Errorf("server %q: schema refresh deferred: definition requires a caller scope", p.cfg.Name)) } + if err := ctx.Err(); err != nil { + return p.refreshFailed(staleGen, err) + } lease, err := p.Acquire(ctx, acquireScope) if err != nil { return p.refreshFailed(staleGen, err)