Skip to content

fix(app): open workspace New task without waiting for the engine - #4577

Merged
benjaminshafii merged 6 commits into
devfrom
fix/new-task-responsiveness
Sep 6, 2026
Merged

benjaminshafii merged 6 commits into
devfrom
fix/new-task-responsiveness

Conversation

@benjaminshafii

@benjaminshafii benjaminshafii commented Sep 6, 2026 •

Copy link
Copy Markdown
Member

Opening New task from a workspace waited for session creation before showing the composer, making a slow engine request feel like an unresponsive click. Ordinary primary New task now opens the existing empty composer immediately and creates the engine session when the prompt is submitted. Grouped tasks, side chats, and workspace-error Retry keep their existing creation behavior.

Validation: Passed on OpenCode v2 in an isolated, cold-booted Daytona desktop. The existing workspace New task journey verifies:

  • The long workspace name does not intercept the New task plus.
  • The composer appears within one second despite an injected five-second session POST delay; opening creates no session.
  • Typing works and another New task click retains the draft without creating a session.
  • Submission uses the mock model, creates exactly one session in the intended workspace, receives the mock reply, and preserves existing sessions and expansion state.

Reproduce on this PR head:

OPENWORK_EVAL_REF=2fe6f4cead418ee317f2d52b39b24f9ea20fd608 OPENWORK_EVAL_ENGINE=v2 pnpm evals:e2e workspace-new-task-hit-target

Placement: daytona (daytona CLI authenticated). Verdict: 1 passed, 0 failed, 0 skipped. Exact-head assertion evidence is published in the test-evidence comment.

pnpm typecheck passed. The optional pnpm evals:typecheck exits 2 with the same 337 diagnostics on the change and unchanged base ec5a74546, after normalizing checkout paths; first failure is TS1294 in apps/server/src/agent-context-cloud-probe.ts:216.

@vercel

vercel Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

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

4 Skipped Deployments
Project Deployment Actions Updated
openwork-app Ignored Ignored Preview Sep 6, 2026 8:54pm UTC
openwork-den Ignored Ignored Preview Sep 6, 2026 8:54pm UTC
openwork-diagnostics Ignored Ignored Preview Sep 6, 2026 8:54pm UTC
openwork-landing Ignored Ignored Preview Sep 6, 2026 8:54pm UTC

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 6, 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 (6c28856dd913956c88eefe2f18d8e8fef061aa75). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 6, 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 (b3adf4be829c5cc9b7a25acc392fcfb591a1e465). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 6, 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 (f235ad63bfae27de6aea9c01e93c4db12eecbde1). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 6, 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 (46b2229a347b055beb864ac23ab391671a157663). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

Comment thread evals/worlds/session-shell.ts Resolved

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

@benjaminshafii

Copy link
Copy Markdown
Member Author

Test evidence — workspace-new-task-opens-an-editable-composer-immediately-and-creates-one-task-o — ✅ passed

SHA 2fe6f4c · engine v2

✅ passed · 4 expectations passed · 0 failed · 0 pending

[world] mock(mcp) · den(daytona) · desktop(daytona) · workspace(/tmp/openwork-openwork-workspace-new-task-long-name-1788728545642-1788728545642) · [seed:raw] evalIn() · sessions(1) · [seed:raw] evalIn()
[user] hover(label=openwork-openwork-workspace-new-task-long-name-1788728545642-1788728545642)
[probe:raw] [probe:raw] eval()
[agent] listSessions
[probe:raw] [probe:raw] eval() ×2
[user] label=New session · openwork-openwork-workspace-new-task-long-name-1788728545642-1788728545642 · click(label=New session · openwork-openwork-workspace-new-task-long-name-1788728545642-1788728545642) · see(text=What do you need done?)
[probe:raw] [probe:raw] eval()
[probe] hash
[probe:raw] [probe:raw] eval()
[agent] listSessions
[user] type(placeholder=Describe your task..., "Confirm the new task is ready") · hover(label=openwork-openwork-workspace-new-task-long-name-1788728545642-1788728545642) · label=New session · openwork-openwork-workspace-new-task-long-name-1788728545642-1788728545642 · click(label=New session · openwork-openwork-workspace-new-task-long-name-1788728545642-1788728545642)
[probe:raw] [probe:raw] eval() ×2
[user] see(text=New task model) · placeholder=Describe your task... · click(placeholder=Describe your task...) · press(Enter)
[agent] listSessions ×7
[probe] eventually(submitting creates exactly one session after the slow engine responds)
[user] see(text=The new task is ready.)
[probe] hash
[probe:raw] [probe:raw] eval()
[agent] listSessions
[probe:raw] [probe:raw] eval()
steps 1 ✅ the plus remains the topmost hit target (0.1s) · 2 ✅ the empty composer accepts and keeps a draft without creating a session (1.9s)
verdict passed · 3 user observations (see ×3) · 12 probes · steps 2/2

ℹ️ ASSERTION — 1. The workspace New task plus remains clickable over a long workspace name

The painted element at the plus center belongs to the plus, not the truncated title.

  • ✅ PASS The workspace New task plus remains clickable over a long workspace name — The painted element at the plus center belongs to the plus, not the truncated title.

ℹ️ ASSERTION — 2. New task opens without waiting for engine session creation

The visible composer appeared 60.799999952316284 ms after clicking; the limit was 1000 ms. Session POSTs were delayed 5000 ms, but opening issued none and left all existing session IDs unchanged.

  • ✅ PASS New task opens without waiting for engine session creation — The visible composer appeared 60.799999952316284 ms after clicking; the limit was 1000 ms. Session POSTs were delayed 5000 ms, but opening issued none and left all existing session IDs unchanged.

ℹ️ ASSERTION — 3. The empty composer accepts a draft and preserves it on another New task click

Typing was verified in the visible editor; clicking New task again retained the exact draft text and still issued no session creation request.

  • ✅ PASS The empty composer accepts a draft and preserves it on another New task click — Typing was verified in the visible editor; clicking New task again retained the exact draft text and still issued no session creation request.

ℹ️ ASSERTION — 4. Submitting creates exactly one task in the intended workspace and receives the mock reply

The mock model was visible before submission and its reply appeared afterward. Exactly one session POST targeted the selected workspace, one session was added, every existing session remained, and the workspace expansion state was unchanged.

  • ✅ PASS Submitting creates exactly one task in the intended workspace and receives the mock reply — The mock model was visible before submission and its reply appeared afterward. Exactly one session POST targeted the selected workspace, one session was added, every existing session remained, and the workspace expansion state was unchanged.

Test run created 2026-09-06T20:58:42.316Z · Source: evals/results/test-runs/2026-09-06T20-58-42-316Z-workspace-new-task-opens-an-editable-composer-immediately-and-creates-one-task-o/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4577 --test-run 2026-09-06T20-58-42-316Z-workspace-new-task-opens-an-editable-composer-immediately-and-creates-one-task-o

@benjaminshafii
benjaminshafii marked this pull request as ready for review September 6, 2026 21:04

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

@benjaminshafii
benjaminshafii merged commit b4ed5f4 into dev Sep 6, 2026
30 checks passed
yomgui added a commit that referenced this pull request Sep 11, 2026
… picker (#4738)

* test(evals): create the bench workspace folder instead of adopting the first-launch default

Since 51c0ab9 (#4608) a fresh desktop boots into its default "OpenWork Chat"
workspace, so createAndSelectWorkspace(app, { path }) no longer passes through
/welcome and adopts that workspace instead of the bench folder carrying the
witness provider in opencode.json. The engine then never sees bench-witness and
"Bench Model listed in picker" can only pass by racing the persisted
active-workspace id. Ask for the folder explicitly with create: true.

* test(evals): pin the bench viewport so the sidebar completion indicator is observable

The completion milestone reads the sidebar row's per-session loading
indicator, which only renders at desktop width. On a runner whose window
manager tiles new windows (observed: Amethyst squeezed the eval Electron to a
195x1029 viewport) the sidebar never mounts and the first send never counts as
complete. Emulate the 1280x900 viewport the benchmark is meant to measure, as
the other layout-sensitive specs already do.

* test(evals): re-express the bench New task claim for submit-time session creation

Since b4ed5f4 (#4577) the sidebar New task control opens the workspace's
empty composer immediately and the session is created by the first send, so
no ses_ id can appear in the route on click and the old "new session route"
wait could never resolve. Readiness is now the empty New task route with no
session surface and a prompt-ready composer; the send that follows must land
in a session no earlier turn used, which keeps the distinct-session claim.
yomgui added a commit that referenced this pull request Sep 11, 2026
…-status flip on reload (#4797)

* 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): open sidebar New session as the empty composer in workspace-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.

* fix(app): send the New task prompt under v2 chat routing

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.

* test(app): reproduce the snapshot owner flip after a v2 session reload

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.

* fix(app): re-read a session snapshot when its owning endpoint changes

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.
yomgui added a commit that referenced this pull request Sep 11, 2026
… the composer recovers (attachment-upload-loading-state) (#4811)

* 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): open sidebar New session as the empty composer in workspace-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.

* fix(app): send the New task prompt under v2 chat routing

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.

* test(app): reproduce the snapshot owner flip after a v2 session reload

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.

* fix(app): re-read a session snapshot when its owning endpoint changes

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.
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