Skip to content

[fix] Round 2: fix agent-chat playground navigation, app-overview app pollution, use-api selectors - #5905

Merged
mmabrouk merged 5 commits into
release/v0.112.0from
test-fix/acceptance-round2
Aug 10, 2026
Merged

[fix] Round 2: fix agent-chat playground navigation, app-overview app pollution, use-api selectors#5905
mmabrouk merged 5 commits into
release/v0.112.0from
test-fix/acceptance-round2

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

Context

Round 2 of the 0.112.0 acceptance gate cleanup, following #5900/#5901. The gate re-ran with those fixes: 43 passed, 4 flaky-recovered, 4 failed. Two of the four were the follow-up already flagged in #5900 (use-api's same stale selector / hanging wait). The other two needed fresh diagnosis: the app-overview test still failed after its round-1 fix, and agent-chat was still unreproducible locally until this round found the actual bug. All four are fixed here and verified live against the dev stack (144.76.237.122:8180).

Changes

use-api drawer tests. Same two issues as #5900, on a file that wasn't in scope for round 1: .ant-drawer-content-wrapper never matches (the drawer is [data-slot="sheet-content"], an @agenta/ui Sheet), and waitForLoadState("networkidle") hangs forever because the layout keeps a live SSE connection open (ProjectWatch). Both fixed the same way as the round-1 overview test.

App overview test — the real root cause. #5900 removed the hanging networkidle wait, but CI kept failing at the same spot ("waiting for getByRole('heading', {name: 'Deployment'})", 120s × 3). The test called apiHelpers.getApp(), whose "completion" matcher only excludes is_chat/is_custom/is_evaluator — but the /workflows/query list API returns no field that distinguishes a completion app from an agent app; both carry identical {is_application, is_evaluator, is_snippet} flags. In CI's single shared ephemeral project (one project for all 80 tests), agent-chat's test runs immediately before this one and leaves behind an agent app. getApp() picked that up instead of creating a real completion app. An agent app renders AgentOverview, not DeploymentOverview — no "Deployment" heading ever appears, hence the deterministic 120s hang.

Fix: apiHelpers.createApp("completion") instead of getApp() — always mints a fresh app, sidestepping the classification ambiguity. Verified by reproducing the exact CI scenario: seed an agent app via agent-chat's fixture in one ephemeral project, then run this test right after in the same project. Failed before the fix, passed after.

Agent-chat: the actual bug behind "unreproducible locally." Round 1 replayed the seed+navigate flow live and it worked, so I couldn't reproduce the CI failure and left the test alone (documented in #5900). This round's gate log gave the missing piece: the CI navigation chain shows /w?revisions=... → workspace → /apps → a bare /playground (missing /apps/<id>). Root cause:

// before
const scopedPrefix = new URL(page.url() || "http://localhost").pathname
    .match(/^(\/w\/[^/]+\/p\/[^/]+)/)?.[1] ?? ""

seedAgentChatApp() only makes API calls (no navigation), so on a fresh test page.url() is still "about:blank" when this line runs — scopedPrefix is permanently "". Both the first goto("/apps") and, critically, the second goto (to the actual playground) use this same stale empty prefix, so the playground navigation targets an unscoped /apps/<id>/playground — a URL the app doesn't route to the seeded app; it falls through to the bare onboarding playground ("What do you want to build?"), which has no composer, hanging expectPath for the full timeout.

Fix: recompute scopedPrefix from page.url() again after the first navigation resolves it to the real workspace/project-scoped URL.

That got the test past navigation, but exposed a second, real issue: a revision committed moments earlier via direct API calls can race the playground's entity resolution, landing on MainLayout's "Playground is unable to communicate with the service" error state instead of the composer (3/3 reproduction rate in fresh browser contexts). That panel's own "Try again" button has no onClick handler (web/oss/src/components/Playground/Components/MainLayout/index.tsx:318<Button>Try again</Button>, literally does nothing), so I added a real page.reload() retry in the test instead, which re-runs entity resolution from scratch. 3/3 clean after that.

Finally, the test's own assertions were stale: FileCard (@ant-design/x) renders an image attachment as a bare <img> with the filename only in alt, not as visible text (only file/audio/video card types get a name caption). getByText(IMAGE_NAME) never matched post-send; switched to getByAltText, matching the pre-send assertion on the same page that already used it correctly. Also bumped the timeout to 120s (siblings doing less already use 120s+, per #5695) since this flow is API seed + 2 navigations + upload + SSE-mocked run + reload.

Live verification summary

Test Result
use-api: variant TypeScript snippet Passed live (13.7s)
use-api: deployment TypeScript snippet Passed live (9.2s)
App overview (fresh, isolated) Passed live (14.8s)
App overview (reproducing CI: agent-chat seeds an agent app first, same ephemeral project) Failed before fix (confirmed root cause), passed after (18.8s / 9.1s across repeats)
Agent-chat attach/send/render/reload (isolated) Reproduced the exact CI redirect chain before the fix; passed 3/3 after (9.4–12.1s each)
Agent-chat + app-overview together (CI order, shared ephemeral project) Passed 2/2 clean runs; one run hit a transient full-navigation hang unrelated to any of these changes (health check was 200 immediately before and after — looked like shared-stack load, not a code issue), self-recovered on immediate retry

Notes for reviewers

  • The dead "Try again" button (MainLayout/index.tsx:318) is a separate, minor product bug (button exists but does nothing) — not fixed here since I have no way to verify a product-code change against this dev stack without deploying to it, which I was asked not to do. Flagging for a follow-up.
  • Verified read-only against 144.76.237.122:8180 throughout; made no product-code changes, no stack deploys/restarts. One accidental cross-navigation into another agent's live session during manual diagnosis (read-only, no clicks) — caught and backed out immediately.

Same two issues fixed elsewhere in the acceptance suite (#5900), now
hit by use-api's Use API drawer tests too:

- .ant-drawer-content-wrapper never matches the drawer, which renders
  through EnhancedDrawer (a facade over the @agenta/ui Radix Sheet,
  [data-slot="sheet-content"]).
- waitForLoadState("networkidle") hangs forever because the layout
  keeps a live SSE connection open (ProjectWatch).

Verified live: both use-api tests passed (13.7s, 9.2s).
Root cause of the still-failing overview test after #5900's networkidle
fix: apiHelpers.getApp() picks the first workflow matching a loose
"completion" filter (not is_chat/is_custom/is_evaluator), but the
workflow list API returns no field distinguishing a completion app from
an agent app — both carry {is_application, is_evaluator, is_snippet}.
In CI's single shared ephemeral project, agent-chat's test runs first
and leaves behind an agent app that getApp() can pick up here instead
of creating a real completion app. An agent app has no Deployment
section (AgentOverview renders instead), so the test hung 3x120s
waiting for a heading that would never appear.

createApp("completion") always mints a fresh app, sidestepping the
classification ambiguity entirely. Verified live: reproduced the exact
CI scenario (seeding an agent app via agent-chat's fixture in the same
ephemeral project, then running this test right after) and confirmed
it now passes.
… entity-resolution races

Two bugs in navigateToAgentPlayground, both diagnosed live against the
dev stack:

1. URL construction bug (the actual CI failure, gate job 31390095129).
   scopedPrefix was read from page.url() before the first navigation —
   on a fresh test page.url() is still "about:blank" (seedAgentChatApp
   only makes API calls), so scopedPrefix was permanently "". Every
   later navigation, including the playground goto, built an unscoped
   URL like /apps/<id>/playground instead of
   /w/<ws>/p/<proj>/apps/<id>/playground. The app doesn't route that to
   the seeded app; it falls through to the bare project-level
   onboarding playground ("What do you want to build?"), which has no
   composer textbox, hanging expectPath for the full timeout — exactly
   matching the gate log's redirect chain
   (.../w?revisions=... -> .../apps -> bare .../playground).
   Fix: read scopedPrefix from page.url() again AFTER the first
   navigation resolves it.

2. Read-your-writes race. A revision committed moments earlier via
   direct API calls can race the playground's entity resolution,
   landing on MainLayout's "Playground is unable to communicate with
   the service" error state instead of the composer. That panel's own
   "Try again" button has no onClick handler (dead), so a real reload
   is used to retry instead.

Verified live against the dev stack: reproduced the exact CI redirect
chain with the bug in place, confirmed the fix resolves it, then hit
the race (3/3 fresh-context runs) and confirmed the reload recovery
resolves it too (3/3 clean runs afterward, ~10s each).
FileCard (@ant-design/x) renders an image attachment as a bare <img>
with the filename only in alt text — there is no separate visible text
caption for images (only file/audio/video card types render a name
label). The post-send and post-reload assertions used getByText, which
never matches; switched to getByAltText, matching the pattern the
pre-send assertion on the same page already used correctly.

Also bumps the test timeout to 120s: API seeding + 2 navigations + file
upload + SSE-mocked run + reload is heavier than the 60s default, and
siblings doing less than this already use 120s+ (#5695).

Verified live: full test (upload, send, verify render, reload, verify
persists) passed 3/3 runs against the dev stack.
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 10, 2026
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Error Error Aug 10, 2026 2:43pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 87c6676a-3ff3-435a-bee1-d09f0b7ed3f6

📥 Commits

Reviewing files that changed from the base of the PR and between e9d7198 and 8b27004.

📒 Files selected for processing (1)
  • web/oss/tests/playwright/acceptance/use-api/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/oss/tests/playwright/acceptance/use-api/index.ts

📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Improved attachment verification in agent chat, including support after page reloads.
    • Increased reliability for workspace-scoped playground navigation and temporary service errors.
    • Updated app management coverage to use compatible completion apps.
    • Improved Use API drawer checks for more reliable readiness and interaction validation.

Walkthrough

Playwright acceptance tests now resolve scoped agent playground URLs, retry transient playground errors, use stable attachment and drawer selectors, create compatible completion apps, and adjust test timeouts.

Changes

Playwright acceptance flows

Layer / File(s) Summary
Agent-chat navigation and attachment validation
web/oss/tests/playwright/acceptance/agent-chat/tests.ts, web/oss/tests/playwright/acceptance/agent-chat/attach-send-render-reload.spec.ts
Agent-chat tests derive workspace/project-scoped playground URLs, retry service errors with page reloads, increase the attachment test timeout, and validate images by filename alt text.
Completion app scenario setup
web/oss/tests/playwright/acceptance/app/app-management.ts
The app overview test creates a new completion app instead of retrieving an existing prompt app.
Use API drawer readiness and selectors
web/oss/tests/playwright/acceptance/use-api/index.ts
Variant and deployment drawer helpers remove networkidle waits, wait for variant checkbox readiness, target Radix Sheet content, and update related commentary.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main acceptance-test fixes for agent-chat navigation, app-overview app selection, and Use API selectors.
Description check ✅ Passed The description directly explains all four acceptance-test fixes and the verification performed against shared-project scenarios.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test-fix/acceptance-round2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: f1543bd9-c129-454b-8ee7-cd99cbf7d9f9

📥 Commits

Reviewing files that changed from the base of the PR and between df65653 and e9d7198.

📒 Files selected for processing (4)
  • web/oss/tests/playwright/acceptance/agent-chat/attach-send-render-reload.spec.ts
  • web/oss/tests/playwright/acceptance/agent-chat/tests.ts
  • web/oss/tests/playwright/acceptance/app/app-management.ts
  • web/oss/tests/playwright/acceptance/use-api/index.ts

Comment thread web/oss/tests/playwright/acceptance/use-api/index.ts
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-08-10T15:04:25.097Z

The button is not disabled while no revision is selected and captures the
revision at click time; clicking in the pre-selection window opens the
drawer with an undefined revision and empty snippets. Wait for the antd
row checkbox to turn checked first.
@mmabrouk
mmabrouk merged commit 08b2381 into release/v0.112.0 Aug 10, 2026
78 of 82 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant