Repository navigation
Description
Symptom
Scheduled Dashboard E2E Tests workflow on main is failing (run 26328466816, 2026-05-23 08:46 UTC). All retries failed.
Single failing test:
packages/codev/src/agent-farm/__tests__/e2e/work-view-backlog.test.ts:153
> recently closed section renders when items exist
Error:
Error: strict mode violation: locator('.work-section:has-text("Recently Closed")')
resolved to 2 elements:
1) <section class="work-section">…</section> aka getByText('Backlog#819projectcore:')
2) <section class="work-section">…</section> aka getByText('Recently Closed✓#')
Root cause
The test uses an over-loose locator:
const closedSection = page.locator('.work-section:has-text("Recently Closed")');
await expect(closedSection).toBeVisible({ timeout: 5_000 });:has-text(...) matches anywhere in the element subtree. Issue #813 ("vscode: migrate Recently Closed view from sidebar to Codev panel tab") is currently open with the project label, so it renders inside the Backlog section's item list — its title contains the substring "Recently Closed", causing the selector to match the Backlog section and the Recently Closed section.
This is a test-only bug. Product code is fine — the Backlog and Recently Closed sections render correctly.
Why it surfaced now
The test is data-coupled to live GitHub Issues. It happened to pass while no open backlog issue contained the substring "Recently Closed". Issue #813 was filed and the title contains the literal phrase, so the test started failing on the next scheduled run.
The flakiness is latent: any future issue whose title contains "Recently Closed" (or similar header text) will break the test again.
Fix
Scope the locator to the section heading, not the section subtree. Each section renders <h3 class=\"work-section-title\">{name}</h3> (see `packages/dashboard/src/components/WorkView.tsx:122-134`), so:
const closedSection = page.locator('.work-section', {
has: page.locator('h3.work-section-title', { hasText: /^Recently Closed$/ }),
});or equivalently:
const closedSection = page.locator('.work-section:has(h3.work-section-title:text-is(\"Recently Closed\"))');Apply the same scoping to both occurrences in the test (lines 152 and 173). Sweep the rest of the file (and any other dashboard e2e tests) for the same .work-section:has-text(\"…\") pattern — Builders / Needs Attention / Backlog headings are all vulnerable to the same collision.
Acceptance criteria
-
packages/codev/src/agent-farm/__tests__/e2e/work-view-backlog.test.tsno longer uses:has-text(...)to identify work sections; matches the heading element directly. - Any sibling dashboard e2e tests using the same loose pattern are hardened the same way.
- Scheduled Dashboard E2E workflow on
mainis green for two consecutive runs.
Out of scope
- Decoupling the test from live GitHub state (the test deliberately exercises real data via
/api/overview— keep that, just don't trip on issue-title content).
Activity
amrmelsayed commentedon May 28, 2026
Same flake reproduced on
maintoday — Dashboard E2E run26566196472failed with the identical locator collision:Test:
src/agent-farm/__tests__/e2e/work-view-backlog.test.ts:153— "recently closed section renders when items exist". All 3 retries hit the same collision.Today's offending backlog item was #913 (filed earlier in the same session). Doesn't matter which specific issue triggers it — the
.work-section:has-text("Recently Closed")locator will collide with whichever backlog item happens to render at fixture-injection time if its textContent (or the section's combined textContent) contains the substring "Recently Closed."This continues to surface with regular cadence — any session that files an issue with backlog churn shortly before a push can knock CI red. Recommending bumping priority on the fix (anchor the locator to the section's
h2/header element, or filter to.work-section:not(.work-section--backlog), or anything else that breaks the substring-match path).amrmelsayed commentedon May 28, 2026
On it! Working on a fix now.
amrmelsayed commentedon May 28, 2026
On it! Working on a fix now.
[Bugfix #828] Scope work-view test locators to section headings
[Bugfix #828] Update thread: PR open, CMAP-3 APPROVE, awaiting pr gate
Merge pull request #917 from cluesmith/builder/bugfix-828