Skip to content

ci: the sandbox network-guard test fails now and then in the merge queue #4989

Closed

Description

@yannickmonney

Summary

services/sandbox/src/session/buildkit-network-guard.test.ts › "refuses a foreign network without touching its firewall or attaching" failed once in a merge-group run and passes on its own. Its failure took a PR out of the merge queue.

What was observed

  • Merge-group run 38683015237, job Unit (workspaces) (116251549542), 2026-10-15 04:44Z, for feat(platform): one template catalog, general syncs, no default automations #4988 — a PR that changes nothing under services/sandbox:

    error: Expected network attachment to fail
          at expectFailure (services/sandbox/src/session/buildkit-network-guard.test.ts:132:13)
          at async <anonymous> (services/sandbox/src/session/buildkit-network-guard.test.ts:309:13)
    (fail) verified session build-network attachment > refuses a foreign network without touching its firewall or attaching [43.96ms]
    

    Every other case in the file passed in that run, including the sibling "refuses a foreign session …" right before it.

  • The same file passed 25/25 eight times in a row on a laptop (macOS, Bun 1.4.2) against main 56c44e3. The file was last changed in perf(sandbox): cut BuildKit stack upkeep, idle time and disk #4604.

  • Not examined: how often it fails across runs (only this one failure was seen), and whether the code under test leaves a docker call running after attachBuildkitNetwork returns or throws.

How the test works (main 56c44e3)

  • beforeAll writes a fake docker script into one temp directory shared by every case (buildkit-network-guard.test.ts:141-147); beforeEach rewrites state.json and empties calls.jsonl there (:148-151).
  • The fake reads state.json when it starts (:24-25) and writes it back when it ends (:28-29), whatever the command.
  • The foreign-network case puts tale.org: other-org on the network in state.json (:301-308) and expects the guard to refuse (:309).

A plausible mechanism, not confirmed: a fake docker process from the previous case (or from the code's own background work) still running when this case saves its state, writing its older copy of state.json back on exit — the guard then reads a network of its own organization and attaches.

Options

  1. A temp directory (state and calls) per case instead of per file.
  2. The fake writes state.json only for commands that change it.
  3. Confirm and remove any docker call the code under test leaves running after it returns.
  4. Retry the case on failure in CI.

Questions

  • Does attachBuildkitNetwork or anything it calls start a docker process it does not await?
  • Has this case failed in other merge-group or PR runs?

Activity

  1. added
    agent-ready
    on Oct 29, 2026
  2. added a commit that references this issue on Oct 30, 2026
    8194ffe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions