Repository navigation
fix(app): apply per-session bash 'ask' permission and withdraw orphaned permission requests after Stop - #4798
Conversation
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.
…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.
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.
…ce 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.
…d 'origin/e2e/fresh-session-send-gate' into e2e/child-checklist-after-stop
… 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.
…terminal edge" This reverts commit 9e70982.
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.
… into e2e/permission-ask-and-orphans-after-abort Stacks on #4747: creating the world's declared tmp workspace needs its desktop-runtime-boot fix so user.reload() reuses the running server instead of restarting the engine (which would drop every pending request). Its files are not modified here.
…lared 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.
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Passed · 12/12 tests · 18/18 assertions · 8 images Commit |
Warden review summary — ClearNative 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 (29727 ms), confidentiality-review (18183 ms), spec-provenance-review (48175 ms), desktop-den-sync-review (42643 ms). Blockers
Advisories
Needs recheck
Observed review-thread metrics
Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority. |
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (c2efbf936f24e557af5968783d89fcf0015fb2b8). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
…-orphans-after-abort # Conflicts: # evals/worlds/chat.ts
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (8eb2d35be65556086ef9949e8d1f347e3c7980df). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
Merged
|
…nd-orphans-after-abort
Deploying openwork with
|
| Latest commit: |
0912f4b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c739ac2b.openwork.pages.dev |
| Branch Preview URL: | https://e2e-permission-ask-and-orpha.openwork.pages.dev |
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (e68f9510a3e6742cfea6156e9b7a9810bd477d46). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (614ebb795e5c90567450886a81a13c8cdd28e3ae). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
Resync onto
|
| test | result |
|---|---|
| 1 switching and creating threads hydrate permissions… | ✓ 122 s |
| 3 a parent task surfaces and resolves its child session permission request | ✓ 130 s |
| 4 a parent answers and stops real child questions, then finishes fresh work… (delegated-question handoff + Stop, with #4837 present) | ✓ 292 s |
| 2 retry recovery and stopping a permission leave other requests and fresh work intact | × — steps 1–2 ok; step 3 fails at line 160 |
Inside test 2, this PR's two claims still hold: line 137 (bash asked via the workspace's own permission: { bash: "ask" } — the createWorkspace fix) passed in step 2, and line 150 native interruption cleanup removes the pending permission passed in step 3 (Stop withdrew the aborted tool's permission without a permission reply; notSee("Allow once"), notSee(Stop) ok). The step then fails right after user.reload(): pending(world.other.sessionId) is [] instead of the unrelated approval — the reload restarted the embedded server/engine and dropped every pending request. That is precisely what 561b5c03a prevented (this PR's body: "without its desktop-runtime-boot fix the spec's user.reload() would restart the embedded server/engine and drop every pending request"). So the spec's reload-persistence claim depended on the reverted #4747 product change; with #4870 on dev it is unproven on dev too, not something this PR should re-add. Owner call: either the spec's reload step waits for the composer-run-mode replacement fix, or the claim is re-expressed.
Earlier run at e68f9510a (before the revert landed; 561b5c03a still present): 3/4 with test 2 passing steps 1–3 (including the post-reload check) and hanging in step 4 after open(world.other) — see("Allow once") never returned for 745 s, screen dump unavailable (renderer main thread unresponsive after switching to the conversation with the pending approval). Per the audit note: attribute to #4837 first (Stop/interrupt path in session-surface.tsx), then #4838/#4844/#4846 (history/scroll). Not reproduced at 614ebb795 because step 3 now fails before it; noting it so it is not lost.
pnpm evals:e2e task-activity-shimmer --daytona (delegated-task journey) at e68f9510a → died in world provisioning: launch remote app-web runtime … EACCES: permission denied, mkdir '/private'. taskActivityWeb (rewritten by #4812/#4867, proven --local only) passes the host's macOS seed.tmpPath(...) as the appWeb workspacePath, and startRemoteRuntime mkdirs it inside the Linux sandbox. Deterministic harness defect on dev for every appWeb world under Daytona placement (the APP-ISOLATION case in saved-app-creation has the same shape); not this PR's. Not re-run.
All Daytona sandboxes from these runs were deleted by the runner. The squash diff of this PR shrinks to its own three commits once #4786 → #4757 land.
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (0912f4b5db02a8dc572c2e364d325a9a0e5a3ee4). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
Resync after #4786 squash-merged (
|
| test | result |
|---|---|
| 1 switching and creating threads hydrate permissions… | ✓ 137 s |
| 3 a parent task surfaces and resolves its child session permission request | ✓ 131 s |
| 2 retry recovery and stopping a permission… | × — same as at 614ebb795: steps 1–2 ok, line 137 (bash asked) and line 150 (Stop withdraws the aborted tool's permission without a reply) pass; fails right after user.reload() because the reload restarts the embedded engine and drops the unrelated pending approval — the claim that depended on the reverted #4747 product commit. Not re-added. |
| 4 a parent answers and stops real child questions… | × new since 614ebb795 (where it passed 7/7 steps): step 3 "reloading the parent restores the same unanswered requests" — after reload() the child row shows Choose delegated task format · General agent — Waiting for task result but never its question (Which format should the child task use?, 45 s). This is before any Stop, so this PR's helper is not on the path. |
Attribution for test 4: the only product changes between 858414c41 (green) and f6ab5f271 (red) are #4875 (revert of #4858 — removes the visible-session-refs / owner-checked release logic in session-sync.ts and deletes session-sync-permissions.test.ts), #4633 (message-list.tsx "Starting…" status), #4862 (mcp-app-frame.tsx), #4638 (model settings). Attribute to #4875 first, then #4633. Test 4 exists on dev itself (#4579), so a clean control at f6ab5f271 will settle it; not run here (another ~25 min sandbox cycle) — flagging instead.
Makes test 2 of
parent-child-permission-approval("retry recovery and stopping a permission leave other requests and fresh work intact") green on Daytona; tests 1, 3, 4 stay green. Follow-up to #4786 (its "Noticed, not touched" section names both points fixed here). Cluster context: 2026-09-09 E2E triage —parent-child-permission-approvaltest 2 (listed under Cluster 1, but the line-137/138 failure is not the send gate).Stacked on
origin/e2e/child-checklist-after-stop(#4786, which carries #4723 and #4757) and onorigin/e2e/workspace-permission-reload(#4747), both via merge commits; none of their files are modified here. #4747 is needed because a workspace created at its declared tmp path only exists in the server registry, and without itsdesktop-runtime-bootfix the spec'suser.reload()would restart the embedded server/engine and drop every pending request.Root cause
(a) spec line 137 —
bashran without asking although the world wrotepermission: { bash: "ask" }. Not a product bug in permission handling: it is the ancestor-.opencodeshadowing trap from #4747.splitPaneQuestionscalledseed.workspace()withoutcreate, so it adopted the first-launch default workspace, which the dev profile places inside the repo checkout on Daytona. A throwaway diagnostic spec run at0914332ffshowed:GET /workspace/:id/permissions/effective→shell: allow,source: "engine",files.workspace = /workspace/.openwork-daytona/profiles/…/openwork-dev-data/home/OpenWork Chat/opencode.jsonc(not the/tmp/openwork-permission-stop-recovery-…path the world declared);/config→permission: {"bash":"ask","*":"allow"}— the*: allowcomes from/workspace/.opencode/opencode.json("permission": "allow"), merged after the workspace file;openworkagent ruleset →[* allow, bash ask, * allow]; last match wins, so bash was allowed and the tool part completed with no/permissionentry.In isolation (
opencode serve1.18.25,/tmpworkspace with{"permission":{"bash":"ask"}}, OpenWork-styleOPENCODE_CONFIG) the engine yieldsbash * askfor the same agent — so the engine and the app apply the rule; only the arrangement pointed at the wrong workspace.(b) spec line 150 — after Stop, the aborted tool's permission stayed in
/permission. Same OpenCode v1 engine gap #4786 fixed forquestion: tools run on detached fibers, sosession/abortmarks the tool part aborted but leavesPermission.askpending; no event withdraws it. The spec prose ("Stop removes its cancelled approval without a permission reply") requires the app to withdraw it.What changed
evals/worlds/chat.ts—splitPaneQuestionstakes an opt-increateWorkspace;permissionStopRecoverycreates its workspace at the declared tmp path (mirrors fix(server): make workspace permission changes reach the engine's effective permissions (composer-run-mode) #4747'semptySessionfix). Opt-in so the four othersplitPaneQuestionsworlds keep their arrangement (see below). No assertion changed.apps/app/src/app/lib/opencode-interruption.ts— fix(app): hide the child checklist when a stopped parent receives a follow-up #4786's post-idle withdrawal helper (nowwithdrawRequests) also lists pending permissions and rejects the ones owned by the stopped tree (root + interrupted descendants). Other roots are never touched; each kind is best-effort on its own so a failed question withdrawal does not skip permissions. Works through the sharedClienton both engines (permission.list/permission.reply, the v2 adapter maps them per session).apps/app/tests/opencode-session-native.test.ts— the tree-stop test now also serves a/permissionlist with a stopped-tree entry and an unrelated root's entry and asserts only the stopped one receivesreply: "reject", after idle confirmation.Proof
pnpm evals:e2e parent-child-permission-approval --daytonawithOPENWORK_EVAL_REF=c2efbf936f24e557af5968783d89fcf0015fb2b8exported (source verified in every sandbox:==> source verified c2efbf936f…), fresh sandbox per surface, placement line:c2efbf936see(printf OTHER_PERMISSION_WITNESS), line 143/144 both approvals pending, line 150native interruption cleanup removes the pending permission, nofinalmock call for the stopped prompt, reload keeps the unrelated approval, and the follow-up completes onceOverall verdict for this spec file: Passed (4/4, 0 skipped).
Baseline on this branch before the fixes (
0914332ff, #4786 stack only): the diagnostic run reproduced (a) as described above (sawPermission: false, tool partcompleted).Unit:
bun test --isolate tests/opencode-session-native.test.ts→ 27 pass, 0 fail.pnpm --filter @openwork/app typecheckclean. All Daytona sandboxes from these runs were deleted.Noticed, not touched
splitPaneQuestionsconsumersdelegatedQuestionHandoff,restartUpdateTaskWorld(background-desktop-update),newSplitPrimary,sessionSubmitErrorIsolationstill adopt the default in-repo workspace, so theirpolicyblocks are shadowed by the repo's.opencode/opencode.jsontoo. They happen to write policies the repo config already implies (question: allow,bash: allow), so their claims hold, but any future workspace-levelask/denythere will silently not apply. FlippingcreateWorkspaceon for all of them is a one-line change once each spec is re-proven.permissions/effectiveattributes ancestor.opencode/opencode.jsonrules toengine, and a user whose workspace sits inside such a repo sees "Ask before actions" while the engine allows everything.pnpm --dir evals typecheckreports 389 pre-existing errors unrelated to these files (Promise.withResolverslib target,packages/emailjsx, app import extensions).