Skip to content

CI flake: PersistentAgentModeMCPReadFileConnectionTests/testAgentOwnedWorktreeContentSearchCarriesPhysicalCoverageAndPreservesFullSelections fails intermittently on shards 3/4 #434

Description

@moonray

Symptom

RepoPromptTests.PersistentAgentModeMCPReadFileConnectionTests/testAgentOwnedWorktreeContentSearchCarriesPhysicalCoverageAndPreservesFullSelections (Tests/RepoPromptTests/MCP/Control/PersistentAgentModeMCPReadFileConnectionTests.swift:796, assertion at :804) fails intermittently on the Build and Test CI shards, then passes on re-run / on other PRs.

Failure

PersistentAgentModeMCPReadFileConnectionTests.swift:796: error: -[RepoPromptTests.PersistentAgentModeMCPReadFileConnectionTests testAgentOwnedWorktreeContentSearchCarriesPhysicalCoverageAndPreservesFullSelections] : XCTAssertEqual failed: ("Optional([RepoPrompt.LineRange(start: 10, end: 17, description: nil), RepoPrompt.LineRange(start: 27, end: 29, description: nil), RepoPrompt.LineRange(start: 34, end: 34, description: nil)])") is not equal to ("Optional([RepoPrompt.LineRange(start: 6, end: 10, description: nil), RepoPrompt.LineRange(start: 20, end: 24, description: nil), RepoPrompt.LineRange(start: 30, end: 34, description: nil)])"

The content search returns a different (but plausible) set of matching line ranges than the expected coverage slices.

Evidence this is a flake (not a deterministic regression)

Across the last ~30 failed CI runs (Jul 6–8), this same test fails with the identical signature on 4 unrelated branches, spanning shard 3 and shard 4:

Run Date Branch Shard
28786487861 Jul 6 wt/issue-390-fable-investigation 3
28790765740 Jul 6 feat/history-duration-threshold 3/4
28928694335 Jul 8 wt/build-process-storm-investigation 3/4
28955810559 Jul 8 fix/ci-flake-420 4

Same test, same :796/:804, byte-identical actual vs expected LineRange values each time, on different PRs built against main → non-deterministic. (The last run is from PR #430, where it was the only failure — the PR's own target test, AgentRunWorktreeStartTests/...testProductionCapture..., passed there.)

Likely cause

The result is a content-search line-range set that differs from the expected slices under some ordering/timing. PersistentAgentModeMCPReadFileConnectionTests is built around fragile concurrency machinery — the file references "the deterministic late-ingress race" and requires "Fixture slice ingress must be quiescent before installing the deterministic late-ingress race." The flake is consistent with fixture-slice ingress / content-search coverage not being fully quiescent when the assertion runs.

Impact

Suggested investigation

Tracking

Not currently listed in the flakes meta issue #425. (Filing without labels — filer lacks label permission. A maintainer please add e.g. bug / area:agent-mode / flaky and link from #425.)

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