Skip to content

fix(app): clarify run activity and protect follow-up admission - #4635

Merged
reachjalil merged 1 commit into
devfrom
fix/session-activity-visibility
Sep 8, 2026
Merged

reachjalil merged 1 commit into
devfrom
fix/session-activity-visibility

Conversation

@reachjalil

Copy link
Copy Markdown
Member

Summary

Long-running conversations can remain on an unexplained “Working” label even when no meaningful progress arrives. A later follow-up can also leave delegated work above the new message, obscuring what is still active.

  • After 60 seconds without meaningful progress, show No new activity and revalidate the existing run. Heartbeats, repeated busy status, identical snapshots, and unrelated sessions do not reset the clock. Silence never marks work completed or automatically resends it.
  • Keep active delegated tasks beneath the latest follow-up, with task descriptions, safe activity categories, elapsed/last-activity times, and child-chat navigation. Retain a static historical receipt rather than duplicate live cards. Distinguish running, waiting, retrying, errors, and unconfirmed child results.
  • Bound native prompt admission to 30 seconds, including response-body reads. Hold uncertain sends behind Check acceptance / Stop and reconcile their exact native message ID instead of blindly replaying them.
  • Share send ownership across direct sends, queue promotion, and background draining. Preserve immediate optimistic user messages from fix(app): show sent messages immediately across new chats #4631, protect newer composer edits, invalidate late preflight/requeue callbacks after Stop, and avoid unreverting an uncertain replacement.
  • Enroll snapshot-only busy sessions in status reconciliation, recover parked streams after connectivity returns, and present interrupted provider responses with recovery context.

Normal long tools and native same-parent follow-ups remain supported. No provider gateway, model-routing, or runtime retry policy changes are included. A follow-up does not silently replace an already-running child's original instructions.

Verification — Incomplete

Rebased onto ca0a4bd6f93ed7e54f02a546959753197ed2b544, preserving the current v2 lifecycle and immediate-message changes. Focused checks passed on the resulting source tree:

From apps/app:

pnpm exec bun test --isolate tests/composer-focus-continuity.test.tsx
# 1 passed

pnpm exec bun test --isolate tests/composer-state-store.test.ts tests/queued-drain-admission-wedge.test.ts tests/safe-edit-resend.test.ts tests/opencode-stream-timeout.test.ts tests/opencode-session-native.test.ts tests/opencode-v2-adapter.test.ts
# 113 passed

pnpm exec bun test --isolate tests/session-sync-run-status.test.ts tests/session-sync-tool-parts.test.ts tests/session-sync-permissions.test.ts tests/session-sync-lifecycle.test.ts tests/session-sync-stream-generation-restart.test.ts tests/session-sync-token-rotation.test.ts tests/session-admission-terminal-invariant.test.ts tests/message-list-loading.test.tsx tests/subagent-run-line.test.tsx tests/session-error-resilience.test.tsx
# 144 passed

pnpm typecheck
# passed

258 focused tests passed; no skips in those passing runs. These are regression checks, not runtime journey proof.

Missing / unsuccessful checks

  • A pre-rebase pnpm evals:e2e task-activity-shimmer attempt selected placement: daytona (daytona CLI authenticated) but stopped during import with missing @openwork/paths; no test or sandbox launched. The dependency link was repaired. Runtime rerun is deferred to PR verification, not claimed passed.
  • The extended task-activity-shimmer journey covers rendered status, one live task card, retained history, and prompt privacy. Actual native child progress, follow-up delivery, cancellation ownership, and heartbeat-only silence still require exact-head runtime evidence; the synthetic display fixture alone does not prove that lifecycle.
  • An additional standalone composer-editable-on-snapshot-error.test.tsx check fails because its fixture lacks DesktopConfigProvider. A combined mock-heavy run also encountered a missing getNativeSession mock export; the native suite passes separately. Neither failure is classified as pre-existing without a clean control.
  • An earlier browser-code check reported fixture/type diagnostics, starting with missing DesktopShotSurface.workspaceId; this is not runtime evidence and is not claimed resolved.

Please retain Incomplete until the required PR checks and runtime assertions finish. No merge or release is included.

@vercel

vercel Bot commented Sep 8, 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 8, 2026 7:46pm UTC
openwork-den Ready Ready Preview Sep 8, 2026 7:46pm UTC
openwork-diagnostics Ready Ready Preview Sep 8, 2026 7:46pm UTC
openwork-landing Ready Ready Preview, v0 Sep 8, 2026 7:46pm UTC

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

@reachjalil
reachjalil merged commit fc8c985 into dev Sep 8, 2026
27 checks passed
yomgui added a commit that referenced this pull request Sep 11, 2026
…loads (#4757)

* 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.
yomgui added a commit that referenced this pull request Sep 11, 2026
…sk (#4723)

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.
yomgui added a commit that referenced this pull request Sep 11, 2026
…ollow-up (#4786)

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

* 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.
yomgui added a commit that referenced this pull request Sep 11, 2026
… person's tab, not agent browser control (#4779)

* 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 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.
yomgui added a commit that referenced this pull request Sep 11, 2026
…re the spec acts on it (#4794)

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

* 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): remove temporary Z2 diagnostics from saved-app-creation
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
…ed permission requests after Stop (#4798)

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

* 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): 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.
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.
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 — 98eef62e Deployed Sep 8, 2026 by vercel[bot]
Preview – openwork-den — 98eef62e Deployed Sep 8, 2026 by vercel[bot]
Preview – openwork-app — 98eef62e Deployed Sep 8, 2026 by vercel[bot]
Preview – openwork-diagnostics — 98eef62e Deployed Sep 8, 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