Skip to content

fix(app)/test(evals): attachment upload shows its uploading state and the composer recovers (attachment-upload-loading-state) - #4811

Merged
yomgui merged 19 commits into
devfrom
e2e/attachment-upload-loading-state
Sep 11, 2026
Merged

yomgui merged 19 commits into
devfrom
e2e/attachment-upload-loading-state

Conversation

@yomgui

@yomgui yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member

TL;DR

No code of its own. This branch is origin/dev + origin/e2e/v2-reload-owner-change-race (#4797, which carries #4781 and #4757) via merge commit 2d1209665. With that stack merged, attachment-upload-loading-state is green on Daytona (2/2). Merge #4797's stack; then this PR has an empty diff and should be closed, not merged. It exists to record the Cluster 10 verdict for this spec.

Root cause (triage: reports/e2e-red-2026-09-09/triage.md §Cluster 10, bullet attachment-upload-loading-state)

The triage bullet conflated three things; after re-reading the evidence against the current spec they resolve as:

  1. "attachment uploading state observed: false" + New task not found — already fixed on dev, stale evidence. Those messages come from the pre-fix(chat): show sent attachments immediately and preserve reading position #4687 spec (attaching an image in … retains the draft until the upload is ready, label: "attachment uploading state observed", { role: "button", label: /^New task$/ }). The nightly that produced them (daytona-e2e.yml run 34387590503, Sep 9 18:12Z at 52a028817) ran 24 min before 10d589b43 (fix(chat): show sent attachments immediately and preserve reading position #4687) landed, and the triage runner's worktree (ea1e9546e) still had that old spec. fix(chat): show sent attachments immediately and preserve reading position #4687 changed the product (send moves attachments into the thread immediately) and rewrote the spec's claim; feat(composer): click a draft image attachment to view it full-size #4690 (df3b1670b) updated the button to "New session". On current dev the "new task" test — which clicks New session and asserts __attachmentUploadingSeen === true — passes (nightly 34444536682 at 88b1eec4a: 1 passed / 1 failed). So the uploading indicator neither moved nor regressed; the claim was already re-expressed upstream. No bisect between fix(composer): wait for image readiness before showing sent text #4652/fix(chat): show sent attachments immediately and preserve reading position #4687 was needed.

  2. The live failure on dev is the reload owner-flip race, owned by fix(app): keep a v2 session's snapshot query alive across the routing-status flip on reload #4797. Nightly 34444536682 (88b1eec4a, spec = current): the "existing chat" test times out at spec line 165 user.see({ text: "pasted-recording.mp4" }) right after user.reload(); on-screen dump shows Session snapshot owner changed before the local read completed. over an empty transcript with the draft Continue after upload. correctly retained. That is exactly fix(app): keep a v2 session's snapshot query alive across the routing-status flip on reload #4797's root cause (readOwnedSnapshotTarget rejects when sessionOwner flips under an unchanged query key and nothing refetches). It is intermittent (only one of the two tests hit it in that nightly; fix(app): keep a v2 session's snapshot query alive across the routing-status flip on reload #4797 measured ~1 in 3), which is why the "new task" test passed. Not the Cluster 1 send gate (fix(app): keep a brand-new session sendable while its first snapshot loads #4757 B): both tests get past the send and past attachment upload loading proof; the failure is post-reload.

  3. Local 2 ms 403 (triage author's Mac) — runner environment, not chased, as briefed. startManualApprovalServer (evals/worlds/chat.ts:516) spawns the standalone server with env: { ...process.env, OPENWORK_RUNTIME_DB: <fresh tmp> }. The runtime DB override is complete (apps/server/src/runtime-db.ts:36 returns the override before consulting any config dir), so the persisted-managed-policy 403 policy_unavailable path is isolated, and a Den session can only arrive via host-token PUT /den-session, not env. Remaining inherited env that can still produce an instant 403 on POST /workspace/:id/files/content before requireApproval runs: OPENWORK_TOKEN_STORE / XDG_CONFIG_HOME (token store → requireClientScope → 403 forbidden if the host's tokens.json gives owt_spec_token a viewer scope). Also OPENWORK_DEV_MODE is inherited. Noted only; the world could additionally pin OPENWORK_TOKEN_STORE to the same tmp dir. In this run the write gate behaved (writeElapsedMs ≥ 2900 assertion passed in both tests).

What changed

Nothing besides the stack merge (2d1209665). Cross-check on the merged tree: bun test --isolate tests/session-snapshot-owner-flip.test.tsx tests/opencode-session-native.test.ts → 28 pass / 0 fail; pnpm --filter app typecheck clean.

Proof

OPENWORK_EVAL_REF=2d1209665b93248491f1f5cb1951806aa88de878 pnpm evals:e2e attachment-upload-loading-state --daytona (single spec, sandbox printed source verified 2d1209665b93248491f1f5cb1951806aa88de878 for both tests):

 ✓ |e2e| specs/attachment-upload-loading-state.e2e.test.ts (2 tests) 525509ms
   ✓ sending an image in existing chat immediately moves it into the thread while upload is pending  266605ms
   ✓ sending an image in new task immediately moves it into the thread while upload is pending  258904ms
      Tests  2 passed (2)
{"command":"evals:e2e","lane":"e2e","daytona":true,"placement":"daytona","engine":"legacy","surface":"legacy",…,"files":["attachment-upload-loading-state"],"passed":2,"failed":0,"skipped":0,"skips":[],"consented":["OPENWORK_EVAL_E2E_TESTS"],"verdict":"passed"}

Passed — 2 passed / 0 failed / 0 skipped, placement daytona. No owner changed text anywhere in the run log. Clean control = nightly 34444536682 on origin/dev @ 88b1eec4a (1 failed / 1 passed, "owner changed" on screen). All four sandboxes from this run (…-46948-…) were removed by the runner; verified with daytona sandbox list.

Verdict is stacked: it is only valid together with #4797 → #4781 → #4757.

Noticed, not touched

…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.
…ace-engine-upgrade

Since #4577 the sidebar New session controls open the workspace's empty
New task composer at once and the session is created by the first send,
so waiting for a ses_ route on click never resolves. Re-express the three
sidebar steps: the click lands on the empty New task route without a
session surface and a prompt-ready composer; the send must land in a
session no earlier turn used (same claim shape as bench-openwork-app-v1
in #4738). Palette steps still create their session up front.
The empty New task composer creates its session on submit and hands the
prompt over through a scoped auto-send mark. The mark was keyed with the
workspace's default endpoint URL (always /opencode), while the session
surface under OpenCode v2 routing owns the session as /opencode2, so the
lookup missed and the prompt silently vanished: the person landed on an
empty new session. Key the mark with the endpoint that created the
session (createRouteSessionWithEndpoint), which is the URL the surface
will own it under.
The surface mounts under the v1 URL before chat routing resolves; the owned
read 404s, parks for its retry, and the routing flip changes the owner while
it is in flight. The read rejects with 'Session snapshot owner changed' and
the (workspace, session) query never refetches, so the transcript stays empty.
The snapshot query is keyed on (workspace, session) with retry off on the
desktop loopback path. When chat routing resolves to /opencode2 after boot
(or the draft scope resolves once identity verifies) while the owned read is
in flight, the read rejects with 'Session snapshot owner changed' and nothing
refetched, leaving the error card over an empty transcript. Cancel the doomed
read and refetch under the new owner; a bare invalidate would only join the
in-flight promise because the first load has no data yet.
@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 11, 2026 2:45am UTC
3 Skipped Deployments
Project Deployment Actions Updated
openwork-den Ignored Ignored Preview Sep 11, 2026 2:45am UTC
openwork-diagnostics Ignored Ignored Preview Sep 11, 2026 2:45am UTC
openwork-landing Ignored Ignored Preview Sep 11, 2026 2:45am 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 (20985 ms), confidentiality-review (7973 ms), desktop-den-sync-review (15091 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 3
  • Distinct heads in retained window: 3
  • 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: 3/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 (2d1209665b93248491f1f5cb1951806aa88de878). 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 b1fe66fdd34a0afaf80c897e816ecde13a7d40ad · 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: 7ee5951
Status: ✅  Deploy successful!
Preview URL: https://2267ffc3.openwork.pages.dev
Branch Preview URL: https://e2e-attachment-upload-loadin.openwork.pages.dev

View logs

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 (7ee59513f6e69d91867cd31e77bafbd17001ce35). 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 / #4781 conflict resolution

Proof at the pushed head — Failed (1/2)

OPENWORK_EVAL_REF=7ee59513f6e69d91867cd31e77bafbd17001ce35 pnpm evals:e2e attachment-upload-loading-state --daytona (placement: daytona, source verified 7ee59513f…, fresh Den + desktop sandboxes per test, all deleted by the runner):

test result
sending an image in existing chat immediately moves it into the thread while upload is pending ✓ passed (293.5 s) — including the post-reload() transcript read; no "owner changed" text
sending an image in new task immediately moves it into the thread while upload is pending × failed at spec line 125: Timed out waiting for one decoded thread preview and cleared composer while upload is held after 30000ms

"passed":1,"failed":1,"skipped":0. The failure screenshot shows the New task composer still holding Describe the attached image. + the image chip after Run task — the send never left the composer. This is the New-task (fresh session) send path, which on this stack is broken by dev's #4838 (sendDraft awaits ensureFullSnapshot() → ensureQueryData(snapshotKey), cancelled on the new ses_… route → CancelledError) — the same failure AI reproduced 2/2 on #4781 752240264 and I reproduced on #4797 152974edb plus a control at 752240264 in workspace-engine-upgrade step 2. The existing-chat test passes because the snapshot is already cached there. Attribution for this spec is a strong hypothesis, not yet a clean control: the previous green (this PR's 2d1209665) predates #4838, and the dev nightly cited in the body (88b1eec4a) also predates it. I will run this spec on 752240264 (no #4797 fix) as a control and append the result here.


Control result (appended): OPENWORK_EVAL_REF=7522402647a1715c7bc693ed6baa218beb2f84f7 pnpm evals:e2e attachment-upload-loading-state --daytona on origin/e2e/new-session-route-after-reload (dev + #4757 + #4781, without #4797's fix; source verified 752240264…) → identical "passed":1,"failed":1: existing-chat ✓ (260.5 s), new task × at the same spec line 125 (Timed out waiting for one decoded thread preview and cleared composer while upload is held after 30000ms). So the red New-task case is pre-existing on the #4781 stack and not introduced by #4797's owner-flip effect; attribute to dev #4838's sendDraft → ensureFullSnapshot() on the fresh-session send path (see #4781 / #4797 comments). All four control sandboxes deleted by the runner.

@yomgui

yomgui commented Sep 11, 2026

Copy link
Copy Markdown
Member Author

Status: CONFLICTING again after dev 858414c41 — waiting on the #4781 owner call, not touching the file.

A fresh git merge origin/dev here conflicts only in evals/specs/workspace-engine-upgrade.e2e.test.ts: dev's #4869 (51a769f97) rewrote that spec wholesale, and this branch carries #4781's edits to the old spec body (0ad717693). AI's analysis on #4781 (comment) is that every commit unique to #4781 is superseded on dev (#4777 + #4869), so the honest resolution is to drop #4781's spec edits — but that is #4781's file and its owner's call (close as superseded vs. re-express). Once #4781 is either closed or resynced, this PR (which merges #4797) only needs git merge origin/dev (taking dev's spec) and a re-run of attachment-upload-loading-state; this branch has no commits of its own and should be closed once #4797 lands. Merge attempt aborted; worktree remains at 7ee59513f.

@yomgui

yomgui commented Sep 11, 2026

Copy link
Copy Markdown
Member Author

Resynced — merge commit b1fe66fdd34a0afaf80c897e816ecde13a7d40ad — MERGEABLE

Merged the updated e2e/v2-reload-owner-change-race (#4797 at 7af859637, which contains origin/dev ea1ef4f5c and resolves the workspace-engine-upgrade spec conflict by taking dev's #4869 rewrite); git merge origin/dev afterwards was Already up to date. No conflicts here (ort reused #4797's resolution), no rebase/amend/force-push. Signed (G).

As this PR states ("no code of its own"), the branch now differs from origin/dev only by #4797's two files. #4757 has landed (ae69a0368); #4781 is being closed as superseded by #4777 + #4869.

Checks at b1fe66fdd: pnpm --filter @openwork/app typecheck clean; bun test --isolate tests/session-snapshot-owner-flip.test.tsx tests/opencode-session-native.test.ts tests/workspace-routes.test.ts → 66 pass / 1 fail — the same pre-existing session-snapshot-owner-flip failure documented on #4797 (red since #4797's own 152974edb, green at ef4c88939).

@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 (b1fe66fdd34a0afaf80c897e816ecde13a7d40ad). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

This branch was successfully deployed

4 active (3 outdated) deployments
Preview – openwork-app — b1fe66fd Deployed Sep 11, 2026 by vercel[bot]
Preview – openwork-landing — 7ee59513 Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-den — 7ee59513 Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-diagnostics — 7ee59513 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