Skip to content

test(opencode): permission tests flaky under CI load - internal 1s deadline exceeded by poll gaps #732

Open

Description

@agenteinstinct1-max

Summary

The packages/opencode/test/permission tests carry an internal Effect.timeoutOrElse deadline of 1 second while polling for pending permission requests. Under CI load, poll gaps exceed that deadline and the tests fail with timed out waiting for N pending permission request(s). This is a distinct flake family from the harness flake family fixed earlier.

Evidence (CI job logs, 2026-10-31)

  1. PR fix(client): resolve import-boundary failures under bun work (Refs #724) #727 (head eb4dc227224fe874dd7a465a10508e71e410246b, diff touches only packages/client/test/import-boundaries.test.ts), unit (linux) job 124597514395, 2 fails, both in test/permission/timeout.test.ts:
    • reply - always cancels the countdown [5995ms] - timed out waiting for 1 pending permission request(s): elapsed=2745ms polls=2 worstPollGap=2742ms lastSeenPending=0
    • ask - expiry settles only the request that ran out of time [6675ms] - timed out waiting for 2 pending permission request(s): elapsed=1085ms polls=3 worstPollGap=1074ms lastSeenPending=1
  2. PR Supersedes #721 #731 (head aa18ee1404a8b4df323a3e3c5b6b9156332f25b8, probe-stall fix, disjoint from permission code), unit (linux) job 124605154079, 1 fail in test/permission/next.test.ts:80:
    • pending permission rejects on instance reload [17399ms] - timed out waiting for 1 pending permission request(s)

Same-day counterexamples: PRs #728 and #729 passed unit (linux) clean, so the suite is intermittently green.

Notes

  • Both failing runs took ~18 minutes total (heavy parallel load); the failing tests' internal 1s deadline (Effect.timeoutOrElse({ duration: "1 second" }), e.g. timeout.test.ts:115-119) is exceeded by measured poll gaps of 1074-2742ms.
  • Hypothesis: timing-sensitive tests under CI load, not a product regression. The two affected PR diffs are both disjoint from permission code.
  • Acceptance direction (not prescriptive): make the permission tests robust to CI-load scheduling (e.g. derive the wait deadline from the actual poll budget rather than a fixed 1s wall clock, or retry-aware polling) WITHOUT weakening what the tests assert about permission expiry/reload behavior. Any change must keep the tests' assertions at equal strength.

Relationship to #489

This issue is recurrence evidence for the same family tracked in #489 ("Linux CI flake: permission-area timing tests fail once each under runner load"), not a second independent front. #489 recorded two single-occurrence failures on 2026-10-21 (one of them in test/permission/timeout.test.ts) with the rule "if either recurs, treat as a waiver candidate". The 2026-10-31 runs above are the recurrence: same file (timeout.test.ts, different test bodies), same internal-deadline mechanism, plus next.test.ts:80. If the family is hardened, the fix should cover #489's named tests as well; if a waiver route is preferred, #489's exact-match rule applies. This note is the cross-link; no duplicate tracking intended.

Additional bounded synthetic reproduction (2026-10-31)

Read-only source qualification at PR #733 head a0080ab9889569853dbb7e9a8a0cae869d5db959 versus base 3d4c83f08467f61fca388a4d1ee3e27f77afe555, Bun 1.3.14 on 2 vCPU. Isolated permission/next.test.ts:10/10 green. Full opencode suite at head:4899 pass,25 skip,0 fail; this is local evidence, not green CI. Under synthetic CPU oversubscription, pristine head failed shared next.test.ts:80 wait site3/4 runs; alternating instrumented30-spinner A/B:head2/5 failures,base3/5, elapsed1016-1096ms,polls14-19,worst gap112-152ms,lastSeenPending0. Thus this reproduction is delayed ask/config readiness before publication while polling still runs, NOT the earlier2.7s poll-gap example. The exact original failing guard test did not reproduce (8/8 isolated under40 spinners green).

Limits: synthetic load is a mechanism probe, not proof of the actual CI trigger, cause of every related failure, or PR exoneration. Original CI logs were inaccessible to that environment. No tests/assertions/timeouts/budgets were changed, no CI reruns requested, no waiver granted. Current integration is newer than this A/B baseline and still requires qualification. This is recurrence evidence within #489/#732, not a new independent fix front.

Activity

  1. added
    priority: medium
    on Nov 12, 2026
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

    priority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions