Skip to content

CI flake: AgentRunWorktreeStartTests/testProductionCapturePreservesBoundStoredSelectionInsteadOfCanonicalUI fails intermittently on shard 4 #420

Description

@moonray

Symptom

RepoPromptTests.AgentRunWorktreeStartTests/testProductionCapturePreservesBoundStoredSelectionInsteadOfCanonicalUI (Tests/RepoPromptTests/MCP/AgentRunWorktreeStartTests.swift:844, assertion at :918) fails intermittently on the Build and Test (app shard 4) CI job, then passes on a re-run / on other PRs.

Failure

AgentRunWorktreeStartTests.swift:918: error: -[RepoPromptTests.AgentRunWorktreeStartTests testProductionCapturePreservesBoundStoredSelectionInsteadOfCanonicalUI] :
  failed - Expected production source capture: The launching tab's Oracle review context could not be captured: The launching selection changed while its frozen review capability was being created.
Test Case '...testProductionCapturePreservesBoundStoredSelectionInsteadOfCanonicalUI' failed (2.433 seconds).

Evidence this is a flake (not a deterministic regression)

Same test, opposite outcomes on two PRs built against the same main → non-deterministic.

Likely cause

The failure message points to a race: "the launching selection changed while its frozen review capability was being created." That's timing-sensitive concurrency between the launching tab's selection state and the creation of its frozen review capability — it tips over under hosted-runner scheduling/load but holds on a warm local machine. The test is tagged deterministic_lifecycle_integration, lifecycle owner WindowStatesManager.

Impact

  • Blocks otherwise-green PRs: Title fresh Codex threads on the direct streaming path #370 is currently red solely because of this single shard-4 failure (shards 1–3, Style, Provider Tests, Secret Scan all pass), which also delays its re-approval/merge.
  • Erodes the CI signal and forces manual re-runs.

Suggested investigation

  • Stabilize the production source-capture path around AgentRunWorktreeStartTests.swift:918 so frozen-review-capability creation observes a stable selection snapshot, or quiesce/await before asserting.
  • If the race is inherent, make the test deterministically resilient (deterministic setup + explicit await) rather than leaving it timing-dependent.

(Filing without labels — filer lacks label permission on this repo. A maintainer please add e.g. bug / area:agent-mode.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions