Skip to content

test:e2e fails on main: two schema-seeding tests time out, blocking every push through the pre-push gate #2402

Closed

Description

@malibio

Problem

bun run test:e2e fails on main with two timeouts in packages/desktop-app/src/tests/e2e/schema-seeding.e2e.ts. Because the pre-push hook (scripts/test-gate.ts, ADR-047) runs test:e2e on every push, this blocks all pushes and forces --no-verify, which defeats the gate.

 FAIL  src/tests/e2e/schema-seeding.e2e.ts > getSchema returns a specific core schema by id
 FAIL  src/tests/e2e/schema-seeding.e2e.ts > schemas have a fields array
 Error: Test timed out in 30000ms.

 Test Files  1 failed (1)
      Tests  2 failed | 3 passed (5)

Shape of the failure

The first three tests in the file pass in ~40ms combined. The 4th and 5th each hang for the full 30s timeout. All five call h.adapter.getAllSchemas(); the passing and failing tests are not distinguished by which RPC they call.

Notably, which line hangs moves between runs: in one run the 4th test timed out at getSchema (:47), in another at the getAllSchemas on :43. That points at the daemon (or the dev-proxy channel in front of it) becoming unresponsive partway through the file rather than at either RPC being individually broken — the first few calls succeed, then everything after them hangs.

The other five e2e files in the suite pass, including daemon-readiness and dev-proxy-recovery.

Confirmed pre-existing

Verified by reverting packages/core/src and packages/desktop-app to 758f9f4d (current origin/main), rebuilding the daemon sidecar from that code, and re-running the file: the same two tests fail identically. Not caused by any in-flight branch.

Reproduces consistently — not flaky.

Repro

bun run build:sidecars --debug
bun run --cwd packages/desktop-app vitest run --config vitest.e2e.config.ts \
  src/tests/e2e/schema-seeding.e2e.ts

Acceptance criteria

  • Root cause identified: why the daemon/proxy stops answering after the first few RPCs in this file
  • bun run test:e2e passes on main
  • The pre-push gate no longer requires --no-verify for an otherwise-clean change
  • If the cause is harness lifecycle rather than product code, the harness is fixed rather than the assertions loosened or the timeout raised

Context

Surfaced while pushing #2389, whose branch was blocked by this gate despite test:all, cargo check --workspace --all-targets, and clippy -D warnings all being clean.

Activity

  1. malibio commented on Sep 7, 2026

    @malibio
    CollaboratorAuthor

    Investigation update — narrowed considerably

    Root cause is not in NodeSpace's Rust code. Findings below, with what was ruled out and how, so this isn't re-derived from scratch.

    The actual signature

    gRPC calls wedge after exactly 3 requests, but only when issued from inside the dev-proxy's Bun.serve request handler.

    The decisive experiment: calling GetAllSchemas directly over gRPC, using the same createNodeSpaceClients client and the same channel options, with no HTTP proxy in the path:

    grpc getAllSchemas 1: 11ms nodes=18
    grpc getAllSchemas 2: 2ms nodes=18
    ...
    grpc getAllSchemas 8: 1ms nodes=18
    

    8/8 fast. Through the proxy, the same RPC dies on call 4 every time.

    Ruled out (each tested, not assumed)

    • The daemon. sample on the hung process shows every tokio worker parked and idle. It has already written its responses.
    • Embedding / model load. Running with NODESPACED_MODEL_PATH pointed at a nonexistent file (so resolve_model_path returns None and embeddings are disabled) reproduces identically.
    • HTTP/2 flow-control windows. Raising initial_connection_window_size / initial_stream_window_size on the tonic server, and grpc.http2.initial_window_size on the grpc-js client, to 64 MiB each — no change. Still exactly 3.
    • gRPC message size. Already 64 MiB on both sides via with_message_limits! / MAX_MESSAGE_SIZE_BYTES.
    • maxSessionMemory. Raising grpc-node.max_session_memory to 256 MB — no change.
    • The proxy's HTTP server. /health (proxy-local, no gRPC) still answers in ~10ms after the wedge. The process is alive and responsive.
    • A connection leak in the schema read path. Real bug, found and fixed while investigating (see below), but not this one: it dropped the daemon's open db fds from 8 to 6 and the hang was unchanged.

    What the evidence points to

    A Bun + grpc-js interaction — plausibly async-context or callback scheduling inside Bun.serve's handler. Response size correlates (the tiny /api/daemon/version survives 10/10 alone) but window sizing demonstrably does not, so "large response" looks like a trigger rather than the mechanism.

    Once wedged, every gRPC-backed route stalls, including tiny ones — which is why /api/daemon/version also dies once /api/schemas has been called 3 times. That shared-fate behaviour is what made this look like a daemon hang.

    Suggested next step

    Build a minimal repro outside this repo: a Bun.serve handler making a repeated grpc-js unary call against any server returning a ~34 KiB response. If it reproduces, the issue belongs upstream with Bun and the fix here is a workaround in dev-proxy.ts.

    Reproduction

    bun run build:sidecars --debug
    bun run --cwd packages/desktop-app vitest run --config vitest.e2e.config.ts \
      src/tests/e2e/schema-seeding.e2e.ts

    Consistent, not flaky.

    Related, found along the way

    A genuine connection leak: SqliteStore::get_all_schemas and get_schema_node call a nested self.read() while an outer cursor is still alive. Per the ReadConn contract, a cursor owns its reader connection until dropped, so each call pins two connections instead of one. 8 further sites share the pattern (embeddings.rs, nodes.rs, relationships.rs). Being handled separately from this issue.

  2. malibio commented on Sep 7, 2026

    @malibio
    CollaboratorAuthor

    Baseline on worktree issue-2402-e2e-schema-seeding-hang — Frontend: 4857 passed (231 files).

  3. self-assigned this
    on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions