Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions pkgs/mcpx/internal/e2e/dispatch_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
1 change: 1 addition & 0 deletions pkgs/mcpx/internal/e2e/envguard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down
3 changes: 3 additions & 0 deletions pkgs/mcpx/internal/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading