Skip to content

fix(test): isolate smithery-env-trust first-spawn cold-start under CI contention - #3970

Merged
Yeachan-Heo merged 1 commit into
devfrom
fix/smithery-env-trust-spawn-isolation
Aug 6, 2026
Merged

fix(test): isolate smithery-env-trust first-spawn cold-start under CI contention#3970
Yeachan-Heo merged 1 commit into
devfrom
fix/smithery-env-trust-spawn-isolation

Conversation

@Yeachan-Heo

Copy link
Copy Markdown
Owner

Problem

After #3967 raised the per-test timeout to 60s, #3969 exact-head CI still failed:

(fail) Smithery env trust boundary > uses the built-in endpoints and no key by default [60001.32ms]
  ^ this test timed out after 60000ms.

The four sibling child-process cases in the same file complete in ~290–350ms. Only the first spawn stalls.

Root cause

resolveIn spawns a Bun child that loads smithery-env-probe.tssmithery-auth@gajae-code/utils/env (eager parse of project/agent/home env + shell rc). Under coding-agent shard contention, the first child pays cold compile of that graph and can exceed 60s. Later spawns hit a warm Bun/module/disk cache and finish in ~300ms.

A third blind per-test timeout bump would not fix isolation and would still leave a stalled child holding pipes until the outer it() budget expires.

Fix (harness only — assertions unchanged)

  1. beforeAll warmup spawn (120s suite budget, matches other child-process suite budgets) moves cold-start outside per-test timeouts.
  2. resolveIn kill-on-timeout at 45s with a diagnostic so a stalled child is reaped instead of leaking until the outer 60s it() timeout.

Non-goals

Verification

  • Exact-head Dev CI on this branch (dispatched)
  • Local full probe run blocked here by missing natives prebuild; CI has natives

… contention

Root cause: the first Bun probe child absorbs cold compile of the probe + env
module graph. Under coding-agent shard contention that cold start can exceed
the 60s per-test budget (observed 60001ms on #3969 exact-head) while the four
sibling cases complete in ~300ms once the module graph is warm.

Fix (harness isolation, assertions unchanged):
- beforeAll warmup spawn (120s suite budget) moves cold-start outside it()
- resolveIn kills stalled children at 45s with a diagnostic instead of leaking
  pipes until the outer it() timeout

Not a third blind per-test timeout bump; the 60s it() budgets stay.

Lore-id: smithery-spawn-isolation-1
Confidence: high
Scope-risk: narrow
Reversibility: trivial
Tested: not fully offline (local natives missing); exact-head CI verifies
Not-tested: full parallel shard matrix offline

@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: 0c1aac25f0

ℹ️ 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".

// finish in ~300ms; under extreme shard contention they may take a few seconds.
// Kill rather than wait for the outer it() timeout so a stalled child cannot
// pin the suite for the full 60s and leak pipes.
const PROBE_SPAWN_BUDGET_MS = 45_000;

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 Let the warmup use its advertised 120-second budget

When the first Bun probe needs 45–120 seconds under the same shard contention this patch is intended to tolerate, this constant kills it at 45 seconds and resolveIn throws, so the 120-second beforeAll timeout can never absorb the observed >60-second cold start; the suite instead fails earlier than before. The warmup needs a separate longer spawn budget, while the shorter kill budget can remain for already-warmed per-test probes.

Useful? React with 👍 / 👎.

@Yeachan-Heo
Yeachan-Heo merged commit 5debf24 into dev Aug 6, 2026
40 checks passed
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