Skip to content

Make desktop pairing deadline-settlement tests deterministic #2024

Closed

Description

@integry

Objective

Eliminate the recurring CI-only nondeterminism at the desktop pairing deadline without weakening the production fail-closed boundary. This is an independent transport child and must never target or merge directly to main.

Evidence

On unchanged packages/client/test/desktopPairing.test.ts, Validate failed twice under hosted load while all changed discovery tests passed:

  • run 33403847100 / job 99526426468: the microtask-late response case expected PAIRING_EXPIRED but received bounded PAIRING_TIMEOUT;
  • run 33407982517 / job 99540221433: the adjacent next-task-late case failed identically.

Both tests use a real new Date(Date.now() + 40) deadline, so scheduler load races the protocol expiry classifier against the request timeout.

Required behavior

  • Preserve the security invariant: a token response settling in a microtask or later task after deadline abort is never accepted.
  • Make deadline classification deterministic at the exact boundary. Prefer an injected monotonic/wall clock or explicit deadline-abort cause over widening sleeps or accepting either error.
  • Do not increase the 40 ms timing window, add retries, skip tests, or weaken assertions to allow PAIRING_TIMEOUT.
  • Keep external cancellation, header/body/slowloris/overall deadlines, late callbacks, and bounded cancellation behavior unchanged.
  • Add focused deterministic tests for microtask and next-task late settlement under simulated scheduler delay.
  • Limit scope to the client pairing implementation and focused tests; no API/discovery/Connect/Electron/renderer/package/lock changes.

Integration

Target base-1953-epic-desktop-transport-api. It has no intended overlap with #1989, #2023, or #1988. Do not merge the generated PR until #1989 and #2023 have landed and this child is synced to the cumulative transport head. Require exact-head Ultrafix, Validate, Full, and desktop package audit.

Activity

  1. propr-dev commented on Aug 31, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using codex agent with gpt-5.6-sol model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: codex
    • Model: gpt-5.6-sol
    • Branch: 2024/gpt-5.6-sol-make-desktop-pairing-dead-20260831-1528-lsc
    • Base Branch: 1953-epic-desktop-transport-api
    • Worktree: issue-2024-20260831-1528-gpt-5.6-sol-lsc

    🔍 Track Task Execution

  2. added a commit that references this issue on Aug 31, 2026
  3. integry commented on Sep 4, 2026

    @integry
    OwnerAuthor

    Implemented by #2025, merged into 1953-epic-desktop-transport-api (b9e29d4). Closing the completed child issue during epic issue/PR reconciliation. Final desktop integration and delivery remain tracked by #1950 / #1970; this does not claim a main-branch release.

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

    AIAI-doneenhancementultrafix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions