Skip to content

[Bug]: Runner-load flakes in drip-feed timing, plugin-loader deadline, and desktop journal lock tests #6912

Closed

Description

@lidge-jun

Client or integration

Other

Area

Platform (Windows / macOS / Linux)

Summary

The 2.83.0 release needed failed-job reruns for three CI tests. Each failure was unrelated to the release diff, and each reproduces only under runner load. Each one is a test-design problem worth fixing at the root rather than rerunning:

  1. tests/server/plaintext-v2-agent-messages-server.test.ts:437, "fails closed when a headerless body drip-feeds bytes that never classify". It asserts a wall-clock bound of < 3000 ms. It took 3279 ms on Windows 2/9 (dev run 38061336429) and 5397 ms on macOS control (candidate run 38068414983). It also failed on the 2.82.0 candidate. The test should assert on the drip deadline and its outcome, not on elapsed wall time.
  2. tests/lib/plugin-loader, "a setup that resumes after its deadline cannot leave registrations behind". On macOS control it returned ancestor_untrusted where setup_timeout was expected (candidate run 38068414983, attempt 2). The same failure appeared on the 2.82.0 candidate. The temp-root ACL ancestry check apparently races or depends on runner state.
  3. Rust: desktop/src-tauri/src/cli_command_record.rs:1114, final_save_before_journal_deletion_is_cleaned_on_reopen, panicked on Err("lock-busy") in the desktop shell job (run 38065943619). This looks like lock contention between tests running in parallel.

Separately, ultrafast-tier-honesty.test.ts:175 (retained-sync) hit the 20 s timeout on Windows 7/9 because its spawned bun child stalled. That stall is in the #4956 class and is tracked there.

Reproduction

Rerun the listed jobs under load. Each test passes in isolation, and each failed at least once in the runs cited above.

Version

dev 518f9ab (2.84.0 line)

Operating system

Windows and macOS CI runners, plus the Linux desktop shell job

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    on Oct 10, 2026
  2. added
    platform
    on Oct 10, 2026
  3. lidge-jun commented on Oct 10, 2026

    @lidge-jun
    OwnerAuthor

    All three flakes are fixed at the root on dev:

    The ultrafast retained-sync spawn stall belongs to the #4956 class and is still tracked there.

  4. lidge-jun commented on Oct 11, 2026

    @lidge-jun
    OwnerAuthor

    Reopening for a sibling case of item 1. In the same file, tests/server/plaintext-v2-agent-messages-server.test.ts, the test "bounds the headerless prefix probe when the upstream body produces no chunk" also asserts a wall-clock limit (< 3000 ms). It took 3622 ms on Linux test 4/4 in dispatch run 38097028916, on the head of #6924, which does not touch this path. #6914 fixed only the drip-feed case. This one needs the same treatment: assert the probe deadline and its outcome, not elapsed time.

  5. Ingwannu commented on Oct 11, 2026

    @Ingwannu
    Owner

    I prepared a focused test-only candidate for the reopened silent-body sibling case. It reuses #6914's fake-clock approach instead of increasing the wall-clock allowance: wait for the probe's first read with highWaterMark=0, assert unsettled/no cancellation at 999 ms, then assert 502/unsupported-content-type/exactly one cancellation at 1000 ms. The real response/probe path remains exercised; there is no runtime timeout change.

    Executed in isolation with Bun 1.4.0, private disposable homes and CPUQuota=75%/MemoryMax=1536M/swap=0:
    bun test --no-env-file --isolate ./tests/server/plaintext-v2-agent-messages-server.test.ts --test-name-pattern 'bounds the headerless prefix probe when the upstream body produces no chunk|fails closed when a headerless body drip-feeds bytes that never classify'
    Result: 2 pass, 0 fail, 32 filtered, 10 assertions. The unchanged drip regression passes alongside the candidate. The target file is unchanged between the preparation base 433764e and current dev f189b33, and git apply --check succeeds against a current-dev-derived tree.

    Sharing the exact candidate below so it can be reviewed without claiming a published or integration-ready PR. The full 34-case file and typecheck are still unverified: attempts at the full file were deferred before Bun started because another build occupied the shared host. No native account/provider calls or scan was run. Please keep this issue open until a reviewed fix lands with the remaining coverage; this comment does not mark it fixed.

    diff --git a/tests/server/plaintext-v2-agent-messages-server.test.ts b/tests/server/plaintext-v2-agent-messages-server.test.ts
    index e48406826a..e6acb46c06 100644
    --- a/tests/server/plaintext-v2-agent-messages-server.test.ts
    +++ b/tests/server/plaintext-v2-agent-messages-server.test.ts
    @@ -307,24 +307,44 @@ describe("plaintext v2 agent messages at the Responses server boundary", () => {
     
       test("bounds the headerless prefix probe when the upstream body produces no chunk", async () => {
         takeInheritedSpendHome();
    +    jest.useFakeTimers();
    +    const firstRead = Promise.withResolvers<void>();
    +    let controller!: ReadableStreamDefaultController<Uint8Array>;
         let cancels = 0;
    -    globalThis.fetch = (async () => new Response(new ReadableStream<Uint8Array>({
    -      pull: () => new Promise<void>(() => {}),
    +    const body = new ReadableStream<Uint8Array>({
    +      start(value) { controller = value; },
    +      pull() { firstRead.resolve(); },
           cancel: () => { cancels += 1; },
    -    }), { status: 200 })) as typeof fetch;
    -
    -    const started = performance.now();
    -    const response = await handleResponses(
    +    }, { highWaterMark: 0 });
    +    globalThis.fetch = (async () => new Response(body, { status: 200 })) as typeof fetch;
    +    let settled = false;
    +    const pending = handleResponses(
           collaborationRequest(),
           config(true, false, undefined, 1),
           { model: "", provider: "" },
    -    );
    -    const clientBody = await response.text();
    -
    -    expect(response.status).toBe(502);
    -    expect(clientBody).toContain("unsupported content type");
    -    expect(cancels).toBeGreaterThan(0);
    -    expect(performance.now() - started).toBeLessThan(3_000);
    +    ).then(response => { settled = true; return response; });
    +    try {
    +      // Anchor to the probe's read, not dispatch latency under a busy CI runner.
    +      // Checking both sides of the deadline also rejects premature cancellation.
    +      await firstRead.promise;
    +      jest.advanceTimersByTime(999);
    +      for (let turn = 0; turn < 50; turn++) await Promise.resolve();
    +      expect(settled).toBe(false);
    +      expect(cancels).toBe(0);
    +      jest.advanceTimersByTime(1);
    +      const response = await pending;
    +      expect(response.status).toBe(502);
    +      expect(await response.text()).toContain("unsupported content type");
    +      expect(cancels).toBe(1);
    +    } finally {
    +      try {
    +        if (cancels === 0) controller.close();
    +        await pending;
    +      } finally {
    +        jest.clearAllTimers();
    +        jest.useRealTimers();
    +      }
    +    }
       });
     
       test("fails closed when the headerless prefix probe reads a failed body", async () => {

    Latest-dev verification update — 2026-10-11

    The same one-file patch has now been applied in an isolated worktree based on trusted dev 9b6f4b2632492b3df637dccc009d6a01ed47c85d and committed locally as 1f96d8b1c02f932ab6af1968314d07e650548d33 (local-only, not a published GitHub commit/PR). The target file was unchanged between the original patch base and current dev.

    bun test --no-env-file --isolate ./tests/server/plaintext-v2-agent-messages-server.test.ts --timeout 10000 with Bun1.4.0: 34 passed / 0 failed / 188 assertions, complete file, 16.13 seconds. This includes the deterministic no-chunk deadline, the drip-feed case, JSON/SSE/WebSocket restoration, size-limit refusal and concurrent request separation. No test was skipped by a name filter in this run.

    Execution was serial after foreign builds cleared, with fresh private homes and verified effective CPU75%, memoryHigh1280MiB/max1536MiB, swap0, tasks64, nice10 and a finite120-second ceiling. IOWeight20 is requested, but the user-manager lacks an io controller, so no effective I/O enforcement is claimed. Protected user configuration stayed unchanged. All provider/native behavior in this run used synthetic fixtures, not real accounts or daemons.

    Root typecheck, full repository suite and cross-platform validation remain outstanding. The patch is still not a published PR or shipped fix: publication remains held by the unanswered question about repository CI automatically invoking privacy:scan under the existing no-scan instruction. No security/privacy scan, push, merge, deployment or restart was performed.

    Root typecheck attempt on the same local candidate: the installed TypeScript7.0.2 compiler was invoked directly with --noEmit, without package installation or hooks. It produced no completed diagnostic result before the verified180-second systemd ceiling; the unit then terminated it (TERM/KILL cleanup, total185 seconds). This is incomplete/timeout, not a typecheck pass, and I did not raise CPU/RAM limits or retry it. The root tsconfig includes only src, so even a root pass would not establish strict typechecking of this changed test file. The 34-case behavioral result above remains valid; full-suite/platform and unresolved type coverage remain separate publication/readiness limits.

    Published Draft candidate — 2026-10-11

    The publication hold is now lifted by the explicit permission for automatically triggered privacy CI on new PRs only. The unchanged candidate is published as Draft #6928: #6928, head 1f96d8b1c02f932ab6af1968314d07e650548d33, base dev at 9b6f4b2632492b3df637dccc009d6a01ed47c85d. The measured complete-file result remains 34 pass / 0 fail / 188 assertions; no unchanged tests were rerun. Typecheck timeout, full-suite and cross-platform limits are recorded in the PR.

    The no-scan rule otherwise remains in force. React Doctor workflow 38108447423 was automatically queued on publication and was cancelled during checkout; its scanner action was confirmed skipped. No additional scan, CI dispatch/approval, sponsorship waiver, merge, release or deployment was performed. This issue remains open until a verified fix lands on dev.

  6. lidge-jun commented on Oct 11, 2026

    @lidge-jun
    OwnerAuthor

    All items are now on dev. The reopened headerless no-chunk probe sibling is fixed by #6949 (b1f39cd, carrying #6928). The drip-feed, plugin-loader and desktop-lock items were fixed earlier by #6914 (289d528) and #6917 (bf09e1a). The separate spawned-child stall is tracked in #4956.

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

    bugplatform

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions