Skip to content

test(evals): saved-app world.open waits for the destination page before the spec acts on it - #4794

Merged
yomgui merged 15 commits into
devfrom
e2e/dashboard-delete-no-buttons
Sep 11, 2026
Merged

yomgui merged 15 commits into
devfrom
e2e/dashboard-delete-no-buttons

Conversation

@yomgui

@yomgui yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member

Stacked on origin/e2e/saved-app-browser-requesting-conversation (#4779, which carries #4757) via merge commit 80bab88f4; those commits are not part of this fix. Net change over the merge: one hunk in evals/worlds/saved-apps.ts. The brief's working title was fix(app): dashboard stays interactive after navigating with an app-page menu open; the evidence below shows the dashboard was never broken, so no product code changes and the title says what actually changed.

Root cause

Triage: reports/e2e-red-2026-09-09/triage.md → saved-app-creation (Cluster 1, then #4779 "Noticed, not touched" item 1: step 13 fails deterministically 2/2 at saved-app-creation.e2e.test.ts:523).

world.open(path) was go(app, path), which only sets window.location.hash and returns. The page being left stays mounted until React Router commits the new location (~100–200 ms on Daytona), and the app page and the dashboard share control labels (App options for Team briefing) and preview text (Weekly overview / Launch briefing). So the spec's next observation could land on the page it had just left:

  • Step 13 (world.open("/dashboard") → click("App options for Team briefing")): the click resolved against the still-mounted app-page header button (trace target 1066,136, identical to the pre-navigation click), its menu opened and unmounted with the page, and Delete Team briefing was then never found on the dashboard because no menu was open there.
  • Same race at line ~198 (world.open(\/dashboard${originalPath}`)→eventually(previewText includes …)): satisfied in 135 ms by the dashboard card's iframe before it unmounted; showDetails()/previewText()then read''` from a vanished target (my run 2, below). fix(evals): saved-app creation opens its verification return tab as a person's tab, not agent browser control #4779's three runs took 648–1340 ms here, i.e. they happened to wait for the real app-page iframe.

The dashboard does not break. A diagnostic run (sha fead49b90, temporary, removed in c63458e38) snapshotted the renderer around the route change with a raw hash set: right after hash = #/dashboard → appHeader: true, dashboardPage: false (app page still mounted); after the route committed → dashboardPage: true, menus: 1, menuItems: ["Remove Team briefing from dashboard", "Delete Team briefing"], all dashboard buttons present (Share, Add, Open Team briefing, App options for …, Refresh/Run Project updates), console.error/window.error/unhandledrejection bucket empty, body pointer-events: auto, no inert / aria-hidden leftovers. The "main content renders no buttons" reading in #4779 was an artefact of cdp/src/input.ts#locate listing only the first 8 visible buttons on a miss — the shell rail comes first in DOM order.

What changed

evals/worlds/saved-apps.ts open(): after go(), wait (bounded, 30 s) for the destination's own root — [data-app-header] for /dashboard/apps/…, [data-dashboard-page] for /dashboard — before returning. Other paths are unchanged. No spec assertion was loosened or reordered and no sleeps were added; open now means "the destination page is rendered", which is what every call site already assumed.

Proof

pnpm evals:e2e saved-app-creation --daytona with OPENWORK_EVAL_REF exported; placement line selection: engine=legacy surface=legacy case=all; placement: daytona (--daytona); each run provisioned its own Den + admin desktop + web sandboxes and deleted all three.

run sha (source verified in sandbox log) result
2 3d139f004 (merge + diagnostics only, no fix) 0 passed / 1 failed / 0 skipped — line 202 expected '' to contain 'Hide details' (the line-198 instance of the same race; step 13 not reached)
3 fead49b90 (fix + step-13 diagnostics using a raw hash set) 1 passed / 0 failed / 0 skipped; diagnostics quoted above; the raw-hash click happened to land after the commit (1055,190, dashboard card) so Z2 reproduced: false in that run
4 c63458e387be1bb842dad885550813d90cad745b (final, diagnostics removed) 1 passed / 0 failed / 0 skipped, "verdict":"passed". All 14 steps ok; step 13 "an admin cancels deletion in the app and confirms it on the dashboard" ok (4.0 s) — Delete Team briefing located at 912,260 on the app page and 470,298 on the dashboard card, then Delete app; step 14 "Dashboard Add opens a creation conversation" ok (1.2 s).

Also: pnpm --dir evals run check:browser passes (832 callbacks); lint:layers and tsc -p evals report only pre-existing violations/errors in files this PR does not touch (same as noted in #4770 / #4779).

Noticed, not touched

  • locate()'s not-found message caps "Visible button/link candidates" at the first 8 visible buttons, which are always the shell rail. It reads as "the page has no buttons" and misled fix(evals): saved-app creation opens its verification return tab as a person's tab, not agent browser control #4779's diagnosis; listing candidates from the primary slot first, or raising the cap, would make misses self-describing.
  • inPreview in worlds/saved-apps.ts picks the first sandbox iframe target; on the dashboard there can be several (company tile + personal card), so preview reads there are ambiguous. Not a problem for current call sites once open waits for the destination.
  • The go() behaviour itself (hash set only) is shared by many worlds; a generic "route committed" signal would need a product marker for the active route. Kept this fix local to the saved-apps world.
  • Run 1 was killed by my tool's shell timeout during Den provisioning; its leaked openwork-server-…-32284-… sandbox was deleted manually. No sandboxes from any of my runs remain.

…immediately

A freshly created session had no cached snapshot, so deriveSessionRenderModel
reported "switching" while the first snapshot round trip ran and the composer
disabled Run task. On Daytona that window is ~0.9 s and a click or Enter inside
it was silently dropped with the draft intact. Seed the snapshot cache from the
create response (stale, so the real fetch still runs as a background refresh).
…ad of wedging

A prompt_async answered with 5xx/408 is an uncertain admission (#4635), but
the hold it created could never end: the acceptance check treated absence as
no evidence, Stop refused while the admission was unknown, and the failure body
was dropped, so the person saw a paused composer with no explanation.

- Keep the settled response body on PromptAdmissionUnknownError and show it as
  the session error card right away; the hold still prevents any resend.
- readPromptAdmission: after the exact-message GET misses, list the idle
  conversation; when native lists it without the message the POST is settled
  and did not admit, so the drain receives admission_rejected and halts like
  any definite failure (explicit retry only, never an automatic resend).
- On release the pending row is removed and the submitted composer is kept as
  an unsent message to restore; on confirmed acceptance the stale failure card
  is cleared.
Lexical keeps one empty paragraph in an empty editor, which innerText reports
as "\n". readComposerState now drops that trailing line break so draftText
matches what the person sees; user.see("composer", { text }) already trimmed.
…ssion button

The sidebar button was renamed from "New task" to "New session" in #4491
(Sep 5) and the "new" scenario added in #4631 (Sep 8) still targeted the old
label, so it could never find the button. Same user action, current label.
…o e2e/saved-app-browser-requesting-conversation
… new tab

returnVerification drove the agent browser entry point (browser.openUrl, the
IPC behind browser.open_url) with no requesting conversation. Since #4434 the
task host refuses that, and it never accepted an about:blank destination.
The tab only stands in for the person's own browser so the openwork:// return
link can be navigated without OS protocol registration, so create it the way a
person opens a new tab and find its CDP target by diffing the page targets.
…-conversation' into e2e/dashboard-delete-no-buttons
@vercel

vercel Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 10, 2026 10:13pm UTC
openwork-den Ready Ready Preview Sep 10, 2026 10:13pm UTC
openwork-diagnostics Ready Ready Preview Sep 10, 2026 10:13pm UTC
openwork-landing Ready Ready Preview, v0 Sep 10, 2026 10:13pm UTC

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run

Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (131042 ms), confidentiality-review (53744 ms), spec-provenance-review (90372 ms), desktop-den-sync-review (158523 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 2
  • Distinct heads in retained window: 2
  • Current unresolved Warden threads: 0 of 0 observed
  • Observed resolved/unresolved transitions in retained snapshots: 0 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 0 / 0
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 2/20 run attempts retained; truncated: false
  • Transition snapshot: 0/0 current attributed threads retained (limit 500); truncated: false

Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority.

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 10, 2026

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (c63458e387be1bb842dad885550813d90cad745b). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Passed · 12/12 tests · 18/18 assertions · 8 images

Commit 05b752efcbfb7bf9a14c2802daa8ce7c13d416e0 · selected evidence

Open review report

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Deploying openwork with  Cloudflare Pages  Cloudflare Pages

Latest commit: 05b752e
Status: ✅  Deploy successful!
Preview URL: https://e61d7940.openwork.pages.dev
Branch Preview URL: https://e2e-dashboard-delete-no-butt.openwork.pages.dev

View logs

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (05b752efcbfb7bf9a14c2802daa8ce7c13d416e0). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@yomgui

yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

Resync onto dev after the #4757 conflict resolution

Proof at the pushed head

OPENWORK_EVAL_REF=05b752efcbfb7bf9a14c2802daa8ce7c13d416e0 pnpm evals:e2e saved-app-creation --daytona (placement: daytona (--daytona), source verified 05b752efc… in all three sandboxes; fresh Den + admin desktop + web sandboxes, all deleted by the runner).

test result
create, preview, save and reopen an app without changing already-open results (this PR's spec, incl. step 13 "an admin cancels deletion in the app and confirms it on the dashboard") ✓ passed (387.1 s)
APP-ISOLATION embedded MCP Apps isolate siblings… (added to this file by #4829 today) × failed in world provisioning (62 s), before any assertion: Mock issuer gate failed: health reported https://3979-…, expected https://3979-…

"passed":1,"failed":1,"skipped":0 → file verdict Failed, but the red test is #4829's, not this PR's: isolatedMcpApps seeds two seed.mock(...) without ports into one appWeb sandbox, both default to daytonaPort: 3979 (evals/packages/env/src/mock.ts:56), and the second mock's pkill + rebind on the same port trips the issuer gate. Now reproduced 3/3 across #4779 (2 runs) and this branch; #4829 only proved that case with --local. See the same note on #4779. This PR does not touch that code.

@yomgui
yomgui merged commit 213fb11 into dev Sep 11, 2026
29 checks passed
yomgui added a commit that referenced this pull request Sep 11, 2026
… route-commit wait in world open() (#4810)

* fix(app): seed the delegated-task eval with a running parent thread

The eval.task_activity.seed hook rendered an in-flight child under a parent
whose thread status stayed "ready": it only marked the activity store busy.
Since #4635 MessageList reads that as a stopped parent and the unobserved
child shows "Waiting for task result" instead of the Working shimmer, so
task-activity-shimmer and parent-child-permission-approval lost their
[data-subagent-activity="shimmer"] row. A delegating parent is mid-run;
mark the eval thread streaming like the chat-loading seed already does.

* fix(app): seed a created session's snapshot so its composer can send immediately

A freshly created session had no cached snapshot, so deriveSessionRenderModel
reported "switching" while the first snapshot round trip ran and the composer
disabled Run task. On Daytona that window is ~0.9 s and a click or Enter inside
it was silently dropped with the draft intact. Seed the snapshot cache from the
create response (stale, so the real fetch still runs as a background refresh).

* fix(app): let a send that settled with a server failure recover instead of wedging

A prompt_async answered with 5xx/408 is an uncertain admission (#4635), but
the hold it created could never end: the acceptance check treated absence as
no evidence, Stop refused while the admission was unknown, and the failure body
was dropped, so the person saw a paused composer with no explanation.

- Keep the settled response body on PromptAdmissionUnknownError and show it as
  the session error card right away; the hold still prevents any resend.
- readPromptAdmission: after the exact-message GET misses, list the idle
  conversation; when native lists it without the message the POST is settled
  and did not admit, so the drain receives admission_rejected and halts like
  any definite failure (explicit retry only, never an automatic resend).
- On release the pending row is removed and the submitted composer is kept as
  an unsent message to restore; on confirmed acceptance the stale failure card
  is cleared.

* test(evals): read an empty Lexical composer as an empty draft

Lexical keeps one empty paragraph in an empty editor, which innerText reports
as "\n". readComposerState now drops that trailing line break so draftText
matches what the person sees; user.see("composer", { text }) already trimmed.

* test(evals): open the fresh conversation through the sidebar's New session button

The sidebar button was renamed from "New task" to "New session" in #4491
(Sep 5) and the "new" scenario added in #4631 (Sep 8) still targeted the old
label, so it could never find the button. Same user action, current label.

* test(evals): create the empty-session workspace at its declared tmp path

The emptySession world declared /tmp/openwork-empty-session-<ts> but
seed.workspace() adopted the existing first-launch default workspace
instead ("OpenWork Chat" under the dev profile home). On Daytona that
profile lives inside the repo checkout, so the engine merged
/workspace/.opencode/opencode.json ("permission": "allow") over the
workspace's own catch-all and composer-run-mode never saw the workspace
MCP rule take effect.

* test(evals): name the server error when a run-mode read is not 200

* fix(app): reuse the running OpenWork server when the selected workspace is server-owned

Workspaces created from the app live only in the server registry, so a
renderer reload reaches startServerWithoutDesktopWorkspace and restarted
the embedded server (and its engine) although it was healthy and already
serving that workspace. Reuse it when it is ready with the preferred
remote-access mode; only restart when nothing usable is running.

* test(evals): open the saved-app verification return tab as a person's new tab

returnVerification drove the agent browser entry point (browser.openUrl, the
IPC behind browser.open_url) with no requesting conversation. Since #4434 the
task host refuses that, and it never accepted an about:blank destination.
The tab only stands in for the person's own browser so the openwork:// return
link can be navigated without OS protocol registration, so create it the way a
person opens a new tab and find its CDP target by diffing the page targets.

* fix(app): re-read pending questions when a session reaches a terminal edge

An interrupted question tool leaves the engine's pending list through its
finalizer without a question.rejected event, so Stop on a delegated child
left its question (and option buttons) in the parent view. Reconcile
questions alongside permissions on terminal edges, for both engines.

* Revert "fix(app): re-read pending questions when a session reaches a terminal edge"

This reverts commit 9e70982.

* fix(app): withdraw the stopped tree's unanswered questions after Stop

OpenCode v1 runs tools on detached fibers: aborting a session marks the
question tool part as aborted but leaves its request in GET /question, so a
parent that stopped a delegated child kept showing the child's question and
its option buttons. After Stop confirms the tree idle, reject the pending
questions owned by the stopped sessions; other roots are left untouched.

* test(evals): temporary Z2 diagnostics around dashboard delete route change

* test(evals): saved-apps world.open returns once the destination page root has rendered

* test(evals): create the permission-stop-recovery workspace at its declared tmp path

Test 2 of parent-child-permission-approval ran bash without asking although the
world wrote permission.bash="ask" to the workspace opencode.json. The world
called seed.workspace() without create, so it adopted the first-launch default
workspace under the dev profile, which on Daytona lives inside the repo
checkout; the engine merges /workspace/.opencode/opencode.json
("permission": "allow") after the workspace file and the agent ruleset ends
as [* allow, bash ask, * allow] (last match wins; permissions/effective reported
shell allow, source engine, workspace file .../home/OpenWork Chat/opencode.jsonc).

Same trap and same remedy as #4747 for emptySession; opt-in so the other
splitPaneQuestions worlds keep their arrangement.

* fix(app): withdraw the stopped tree's unanswered permission requests after Stop

OpenCode v1 runs tools on detached fibers: aborting a session marks the tool
part as aborted but leaves its Permission.ask pending in /permission, exactly
as #4786 found for questions. The stopped tree would keep showing Allow once /
Deny in every pane and after reload although nothing can consume the answer.

After stopForegroundTree confirms every stopped session idle, also list pending
permissions and reject the ones owned by the stopped tree; other roots are
never touched and each withdrawal kind is best-effort on its own.

* test(evals): remove temporary Z2 diagnostics from saved-app-creation

* test(evals): make locate() misses list every candidate of the requested role plus route and page roots

A miss used to quote only the first 8 visible buttons in DOM order, which
are always the shell rail, so every miss read as "the page has no
buttons" (#4794's diagnosis detour). The browser-side report now lists
every rendered element of the requested role (buttons/links for
role-less targets), the current route/hash, and whether the
[data-app-header] / [data-dashboard-page] roots are mounted. The Node
side caps the list at 40 and says how many the page really had.
Matching is unchanged.

* test(evals): run the serialized locate() miss callback against a fake page DOM

Proves the browser-side branch the way Chromium will execute it: the
report lists every rendered menuitem on a dashboard whose shell rail has
nine buttons, names the route and mounted page roots, and a role-less
miss lists all nine buttons instead of the first eight.

This branch was successfully deployed

4 active deployments
Preview – openwork-landing — 05b752ef Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-app — 05b752ef Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-den — 05b752ef Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-diagnostics — 05b752ef Deployed Sep 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant