Skip to content

REGRESSION: POST /amicode/connections/credential (pasqal-cloud) segfaults Bun — bisected to 467fb15cf #82

Description

@jack-champagne

Rewritten. The first version of this issue concluded "latent Bun bug, skip the test." That was wrong. The test passed six days ago and a specific commit broke it. Details below.

Not an OOM

The unit (linux) job dies with exit code 137 and turbo labels it "likely due to running out of memory." That label is boilerplate turbo prints for any signal-killed child. Memory is not involved:

Elapsed: 1498ms | RSS: 0.15GB | Peak: 0.37GB | Faults: 0 | Machine: 32.38GB
panic(main thread): Segmentation fault at address 0x0

0.37 GB peak on a 32 GB machine, zero faults, dead in 1.5 s. SIGILL is Bun's crash handler trapping after the panic; 137 is turbo relaying it.

It is a regression, not latent debt

Test: test/server/amicode-connections-routes.test.ts:335
"full lifecycle: submit(valid) → connected + devices; revalidate never respawns; disconnect scrubs"

The test file is unchanged since 2026-07-20. Bun has been pinned at 1.3.14 since 2026-05-18. Only connections.ts moved underneath it. Bisected by running that one test at each commit that touched connections.ts:

commit date result
85922e176 2026-07-20 1 pass
3e4b37298 2026-07-21 1 pass
467fb15cf 2026-07-21 CRASH
8c6dd6940 2026-07-27 CRASH
f43233e68 (tip) 2026-07-27 CRASH

467fb15cf — "feat: two-step Pasqal auth — username+password → project picker (amicode#194)" is the first bad commit. It rewrote runPasqalValidator / submitPasqalCredential (+207 lines in connections.ts).

Localized to one statement

Inserting an early return at successive points in the test body:

stop after result
const server = app() pass
const stub = stageStubValidator() pass
stub.scenario(0, validatorLine()) pass
the POST /amicode/connections/credential + .json() CRASH

So the crash is inside the credential-submit route handler for id: "pasqal-cloud". The sibling test that submits id: "company-compute" passes — that path uses an HTTP stub, not the spawn path. Every other test in the file passes individually; skipping this one alone yields 553 pass / 3 skip / 0 fail across all 63 files in test/server/.

Ruled out

  • OOM — see above.
  • A larger runner — memory was never the constraint. Also unavailable: org is plan=free, GET /orgs/harmoniqs/actions/hosted-runners404 GitHub hosted runners are not supported for this organization.
  • Upgrading Bunbun-v1.3.14 is the current release; packageManager already pins it and upstream sst/opencode pins the same.
  • return inside try/finally467fb15cf refactored runPasqalValidator from assign-then-return into return directly inside try with a mutating finally. Hoisting it back out does not fix the crash. Tested.
  • bun-spawning-bun by itself — the harness sets AMICO_PYTHON = process.execPath, so the real spawnPasqalValidator spawns bun to run a generated .mjs. A standalone 20-iteration bun-spawns-bun-mjs test passes cleanly. The crash needs the Effect/route context.

Open — and it gates the amicode.10 tag

Unknown whether production is affected. The test drives the real spawn path with bun standing in as the interpreter; production spawns a real Python interpreter. So this may be a Bun bug reachable only under the test's interpreter substitution, or it may be a genuine fault in the rewritten submit path that Python would also hit. Not yet determined.

Until that is settled, v1.17.3-amicode.10 should not be cut on the assumption this is test-only.

cc @kate467fb15cf is yours; you likely have the fastest read on what changed in the submit path.

Found while establishing a CI baseline for #2 / #79 — this went unnoticed for 6 days because the fork's workflows request blacksmith-4vcpu-* runners the org has none of, so no test job has ever run here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions