Skip to content

fix(app): isolate permission replies from renderer stream pressure - #5070

Merged
yomgui merged 3 commits into
devfrom
fix/permission-reply-isolated-path
Sep 16, 2026
Merged

yomgui merged 3 commits into
devfrom
fix/permission-reply-isolated-path

Conversation

@yomgui

@yomgui yomgui commented Sep 16, 2026

Copy link
Copy Markdown
Member

Summary

Permission buttons now send their finite replies through the existing isolated desktop loopback transport, so Allow once / Allow for session / Deny do not queue behind renderer event-stream sockets. In local isolated Electron, Allow once acknowledges in 54.6 ms while pressure remains held, versus a 10,032 ms timeout with zero wire replies on baseline. The target read proceeds while final inference is deliberately held. Deadlines, scoped cancellation, no replay, and native Stop withdrawal are preserved.

This does not fix the SSE-per-workspace connection-budget root cause or isolate all engine operations: ordinary prompt send and full Stop verification are owned by the coordinated fix/prompt-send-isolated-path lane; question replies, ordinary session metadata writes, and unrelated reads remain follow-ups owned by the transport audit/coordinator. #5063 owns the existing archive isolation precedent; #5014 bounds archive verification. The separate engine-reload/rollover setup defect described below is also left to the audit follow-up, not hidden with a fixture retry. No composer/retry UI, policy, provider-inference transport, or stream ownership changes.

The cause reproduced here is Chromium per-origin HTTP/1.1 pool starvation. Permission acknowledgment is a local renderer → server → engine operation that settles a pending deferred; it does not wait for resumed inference. The installed incident was not instrumented, so this proves the same failure mechanism, not definitive attribution of that particular incident. Full analysis/options/source chains: reports/rca-permission-reply-timeout-2026-09-16.md.

Implementation

  • Narrow POST permission-reply path selection uses desktopFetchViaMain; the existing explicit createClient(..., {desktopTransport: "main"}) API stays unchanged.
  • Infinite SSE remains native/unbuffered. Only exact plain-HTTP loopback hosts use Node networking; HTTPS/external origins retain Electron trust/proxy behavior. Loopback redirects remain rejected.
  • Permission transfer cancellation is recognized on both IPC ends; Request overrides/auth/body are preserved. A timeout cannot roll back an already-applied reply and introduces no retry.
  • Reuse the real archive SSE-pressure fixture; exercise real pending external-directory requests, not synthetic approval UI.

Before / after — isolated testkit Electron only

Before — permission card after Allow once under held SSE pressure, baseline c4356f0a2: Request timed out; no reply reached the engine.

Before: pending external-directory permission and request timeout

After — same permission action on head 9124552c4: card dismissed, read completed; SSE pressure and final-inference hold still active.

After: permission accepted and read completed while inference remains held

These are authentic, manually inspected reference captures, not testkit vision certifications. Raw source-Electron sidebar transparency is not a claimed visual fix. No layout/copy change; behavior changes visibly, so both captures are included.

Verification — local lane explicitly requested

Head 9124552c473cf94ca0349c27af81edd884b9b828; mise Node 24.20.0 / Bun 1.4.0 / pnpm 11.4.0. No installed-app CDP or engine database access.

Command Exit / result
OPENWORK_DEV_SHARED_STATE=0 OPENWORK_PERMISSION_PRESSURE_MODE=fixed pnpm evals:e2e permission-pressure --local --engine v1 --surface electron 0; 1 passed, 0 failed, 0 skipped. Allow 54.6 ms / POST 6.63 ms. Exactly one scoped Stop reject, no grants/duplicates; fresh work once
pnpm evals:pr specs/session-archive-transport.test.ts 0; 1 wrapper, 9 Node + 50 Bun passed, no skips; 255 Bun assertions
OPENWORK_DEV_SHARED_STATE=0 OPENWORK_ARCHIVE_PRESSURE_MODE=fixed pnpm evals:e2e session-archive-pressure --local --engine v1 --surface electron 0; 1 passed, 0 failed, 0 skipped. Archive 117.9 ms; one main PATCH, zero renderer PATCH; neighbors unchanged
pnpm typecheck 0
pnpm --filter @openwork/desktop typecheck:electron 0

Revert-fails: restore the three production transport files from b99617f10, keep the same fixed-mode pressure test: exit 1, 0 passed / 1 failed / 0 skipped, timeout 10,032.1 ms, zero wire/main replies. Restore fixed files immediately. This historical dirty-baseline receipt is explicitly not head-pass evidence.

Other checks retained, not misreported green: selected existing parent/child approval case passed (three other cases filtered). Existing Stop fixture fails before assertions at worlds/chat.ts:179, engine reload 503; the exact same command on a new clean origin/dev control c4356f0a2 reproduces the same error (each 0 passed / 1 failed / 3 filtered). Root cause is an endpoint copy stale across provider rollover. The new pressure fixture independently proves native Stop cleanup and fresh work without changing that failing fixture. Supplemental evals layer lint exits 54 on off-scope layer imports; no clean-control attribution or broad lint repair claimed.

All three commits are signed and DCO-signed-off. No policy files changed. Head evidence is published in PR comments; CI/review gates are checked live before merge.

@vercel

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

@yomgui

yomgui commented Sep 16, 2026 •

Copy link
Copy Markdown
Member Author

Test evidence — fixed: external-directory Allow once under real SSE pressure preserves unrelated approval and recovers independently of inference — ✅ passed

SHA 9124552 · engine v1

✅ 0/2 screenshots passed · 3 assertions · 3 expectations passed · 0 failed · 0 pending

[world] mock(mcp) · desktop(local) · workspace(/tmp/openwork-permission-pressure-1789598153098/workspace) · [seed:raw] evalIn() ×3
[probe] eventually(both sessions own real pending permissions)
[agent] run(session.open)
[user] see(text=Access an external folder?, timeoutMs=30000) · see(Allow once) · screenshot
[probe] eventually(SSE body bytes establish with excess streams queued) · eventually(canary cancellation before wire dispatch)
[user] Allow once · click(Allow once)
[probe] eventually(trusted Allow once produces timeout or acknowledgement)
[user] notSee(text=Request timed out.)
[probe] eventually(native read completes with inference still gated)
[user] notSee(Allow once) · screenshot · see(text=The external fixture document was read., timeoutMs=30000)
[probe] eventually(approved target final response is complete before Stop)
[agent] run(session.open)
[user] see(Allow once, timeoutMs=30000) · see(label=Stop) · label=Stop · click(label=Stop)
[probe] eventually(native Stop removes only the stopped request and interrupts its read)
[user] notSee(Allow once) · notSee(label=Stop) · type(composer, "Confirm fresh work after the external read was stopped.") · press(Enter) · see(text=Fresh work completed after Stop., timeoutMs=30000)
[probe] eventually(injected stream requests terminate in Chromium)
steps 1 ✅ two native external-directory requests exist and the selected card has a working unpressured control (1.5s) · 2 ✅ real HTTP/1.1 SSE saturates the pool without stopping renderer or engine (2.5s) · 3 ✅ the same approval settles once and its real read proceeds while final inference remains held (5.1s) · 4 ✅ native Stop clears the remaining approval with only a scoped rejection and no final inference (19.6s) · 5 ✅ fresh work completes after native Stop without resuming the interrupted read (0.6s)
verdict passed · 12 user observations (see ×6, screenshot ×2, notSee ×4) · 8 probes · steps 5/5

ℹ️ ASSERTION — 1. Permission acknowledgement does not need final inference

The real pending request disappeared, exactly one reply succeeded and the read output contains the fixture marker while the mock final response remains held and final text is absent; the unrelated request and transcript are unchanged.

  • ✅ PASS Permission acknowledgement does not need final inference — The real pending request disappeared, exactly one reply succeeded and the read output contains the fixture marker while the mock final response remains held and final text is absent; the unrelated request and transcript are unchanged.

ℹ️ ASSERTION — 2. Native Stop cleans up its pending external-directory request

After pressure release and the approved target's final reply, a trusted user Stop click removes the remaining native request through exactly one successful main-process reject reply scoped to it, with no once/always grant, duplicate, or renderer reply. Its read remains in error with no output and no final inference; the completed target transcript and earlier approval replies are unchanged. This verifies existing native Stop behavior, not an isolation improvement.

  • ✅ PASS Native Stop cleans up its pending external-directory request — After pressure release and the approved target's final reply, a trusted user Stop click removes the remaining native request through exactly one successful main-process reject reply scoped to it, with no once/always grant, duplicate, or renderer reply. Its read remains in error with no output and no final inference; the completed target transcript and earlier approval replies are unchanged. This verifies existing native Stop behavior, not an isolation improvement.

ℹ️ ASSERTION — 3. Fresh work after native Stop

A fresh composer turn completes exactly once without reload, new pending permissions, additional replies or grants for the stopped request, final inference for the stopped turn, or changes to its interrupted read and the approved target transcript. The stopped request retains exactly one scoped main-process reject reply and no renderer reply.

  • ✅ PASS Fresh work after native Stop — A fresh composer turn completes exactly once without reload, new pending permissions, additional replies or grants for the stopped request, final inference for the stopped turn, or changes to its interrupted read and the approved target transcript. The stopped request retains exactly one scoped main-process reject reply and no renderer reply.

⚪ UNVALIDATED — 4. fixed: external-directory Allow once under real SSE pressure preserves unrelated approval and recovers independently of inference artifact 2

  • ⚪ UNVALIDATED — no visual expectations recorded.

fixed: external-directory Allow once under real SSE pressure preserves unrelated approval and recovers independently of inference artifact 2

⚪ UNVALIDATED — 5. fixed: external-directory Allow once under real SSE pressure preserves unrelated approval and recovers independently of inference artifact 8

  • ⚪ UNVALIDATED — no visual expectations recorded.

fixed: external-directory Allow once under real SSE pressure preserves unrelated approval and recovers independently of inference artifact 8


Test run created 2026-09-16T22:35:53.057Z · Source: evals/results/test-runs/2026-09-16T22-35-53-056Z-fixed-external-directory-allow-once-under-real-sse-pressure-preserves-unrelated-/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 5070 --test-run 2026-09-16T22-35-53-056Z-fixed-external-directory-allow-once-under-real-sse-pressure-preserves-unrelated-

@yomgui

yomgui commented Sep 16, 2026 •

Copy link
Copy Markdown
Member Author

Test evidence — finite archive and permission IPC preserve scoped requests, cancellation, no retries and external trust boundaries — 0/0 screenshots passed · 2 assertions

SHA 9124552 · engine v1

✅ 0/0 screenshots passed · 2 assertions · 2 expectations passed · 0 failed · 0 pending

verdict unknown · 0 user observations · 0 probes · steps 0/0

ℹ️ ASSERTION — 1. Archive and permission transport retain safety and external networking policy

node --test --test-concurrency=1 apps/desktop/electron/finite-http-fetch.test.mjs apps/desktop/electron/no-bare-external-fetch.test.mjs
Exit 0
✔ finite loopback GET and PATCH preserve authentication, directory, body and HTTP error without retries (14.321708ms)
✔ main permission replies preserve once/always/reject bodies and HTTP failures without replay (8.056167ms)
✔ main cancellation admission matches only permission reply POSTs and the existing read/archive/Stop allowlist (1.865917ms)
✔ main permission cancellation closes the upstream POST during held headers without retry (2.164583ms)
✔ main permission cancellation closes the upstream POST during held body without retry (1.999333ms)
✔ remote, lookalike loopback, and HTTPS retain the exact Chromium fetch and its trust policy (0.321375ms)
✔ loopback redirects are rejected even when the caller asks to follow (2.096333ms)
✔ cancellation includes held body consumption and preserves the caller reason (1.094583ms)
✔ desktop electron source does not use unmarked bare fetch (19.428333ms)
ℹ tests 9
ℹ suites 0
ℹ pass 9
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 122.581208

  • ✅ PASS Archive and permission transport retain safety and external networking policy — node --test --test-concurrency=1 apps/desktop/electron/finite-http-fetch.test.mjs apps/desktop/electron/no-bare-external-fetch.test.mjs
    Exit 0
    ✔ finite loopback GET and PATCH preserve authentication, directory, body and HTTP error without retries (14.321708ms)
    ✔ main permission replies preserve once/always/reject bodies and HTTP failures without replay (8.056167ms)
    ✔ main cancellation admission matches only permission reply POSTs and the existing read/archive/Stop allowlist (1.865917ms)
    ✔ main permission cancellation closes the upstream POST during held headers without retry (2.164583ms)
    ✔ main permission cancellation closes the upstream POST during held body without retry (1.999333ms)
    ✔ remote, lookalike loopback, and HTTPS retain the exact Chromium fetch and its trust policy (0.321375ms)
    ✔ loopback redirects are rejected even when the caller asks to follow (2.096333ms)
    ✔ cancellation includes held body consumption and preserves the caller reason (1.094583ms)
    ✔ desktop electron source does not use unmarked bare fetch (19.428333ms)
    ℹ tests 9
    ℹ suites 0
    ℹ pass 9
    ℹ fail 0
    ℹ cancelled 0
    ℹ skipped 0
    ℹ todo 0
    ℹ duration_ms 122.581208

ℹ️ ASSERTION — 2. Archive and permission transport retain safety and external networking policy

bun test --isolate tests/opencode-archive-transport.test.ts tests/opencode-stream-timeout.test.ts
Exit 0
bun test v1.4.0 (34cbb9a40)

50 pass
0 fail
255 expect() calls
Ran 50 tests across 2 files. [20.07s]

  • ✅ PASS Archive and permission transport retain safety and external networking policy — bun test --isolate tests/opencode-archive-transport.test.ts tests/opencode-stream-timeout.test.ts
    Exit 0
    bun test v1.4.0 (34cbb9a40)

50 pass
0 fail
255 expect() calls
Ran 50 tests across 2 files. [20.07s]


Test run created 2026-09-16T22:38:05.301Z · Source: evals/results/test-runs/2026-09-16T22-38-05-300Z-finite-archive-and-permission-ipc-preserve-scoped-requests-cancellation-no-retri/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 5070 --test-run 2026-09-16T22-38-05-300Z-finite-archive-and-permission-ipc-preserve-scoped-requests-cancellation-no-retri

@yomgui

yomgui commented Sep 16, 2026 •

Copy link
Copy Markdown
Member Author

Test evidence — regression: sidebar archive succeeds while real same-origin HTTP/1.1 SSE pressure remains held — ✅ passed

SHA 9124552 · engine v1

✅ passed · 2 expectations passed · 0 failed · 0 pending

[world] desktop(local) · [seed:raw] evalIn() · mock(mcp) · workspace(/tmp/openwork-session-archive-1789598362658-48880-a) · [seed:raw] evalIn() ×24
[agent] run(session.open)
[probe] hash · eventually(selected fixture session opens)
[user] see(composer, editable)
[agent] run(session.list_sessions)
[probe] eventually(unpressured renderer control uses HTTP/1.1) · eventually(real SSE body bytes arrive (including the server's quiet-stream heartbeat) and excess streams remain pending) · eventually(CDP observes cancellation without response headers for the saturated renderer GET)
[user] hover(testId=sidebar-session-ses_f53a01047ffeftl6DwRZBYblIT) · testId=session-archive-ses_f53a01047ffeftl6DwRZBYblIT · click(testId=session-archive-ses_f53a01047ffeftl6DwRZBYblIT)
[probe] eventually(fixed sidebar archive reaches an observed toast outcome)
[user] notSee(text=This session is still working) · see(text=Session archived: Archive idle neighbor) · notSee(text=Couldn't archive session)
[probe] eventually(independent engine confirms the UI archive while pressure is held) · hash · eventually(all observed injected stream requests terminate in Chromium)
steps 1 ✅ the isolated fixture has two workspaces and idle nonpinned short sessions before transport pressure (2.1s) · 2 ✅ real SSE responses occupy the shared origin pool while timers and animation frames continue (2.5s) · 3 ✅ fixed regression archives only its target before any injected stream is released (5.0s) · 4 ✅ releasing only injected streams restores the same renderer HTTP pool (0.0s)
verdict passed · 4 user observations (see ×2, notSee ×2) · 9 probes · steps 4/4

ℹ️ ASSERTION — 1. Network pressure is real rather than a blocked JavaScript promise

4 injected SSE streams delivered bytes on distinct HTTP/1.1 connections; excess streams and the two-second GET had no headers. Renderer timers/frames advanced and runner-side engine reads succeeded.

  • ✅ PASS Network pressure is real rather than a blocked JavaScript promise — 4 injected SSE streams delivered bytes on distinct HTTP/1.1 connections; excess streams and the two-second GET had no headers. Renderer timers/frames advanced and runner-side engine reads succeeded.

ℹ️ ASSERTION — 2. Fixed-mode UI archive succeeds under sustained real connection pressure

The target was archived by the trusted sidebar click while the same 4 injected SSE connections stayed open; a subsequent raw renderer GET still queued. All neighbors remained unarchived and idle.

  • ✅ PASS Fixed-mode UI archive succeeds under sustained real connection pressure — The target was archived by the trusted sidebar click while the same 4 injected SSE connections stayed open; a subsequent raw renderer GET still queued. All neighbors remained unarchived and idle.

Test run created 2026-09-16T22:39:02.360Z · Source: evals/results/test-runs/2026-09-16T22-39-02-359Z-regression-sidebar-archive-succeeds-while-real-same-origin-http-1-1-sse-pressure/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 5070 --test-run 2026-09-16T22-39-02-359Z-regression-sidebar-archive-succeeds-while-real-same-origin-http-1-1-sse-pressure

@yomgui

yomgui commented Sep 16, 2026 •

Copy link
Copy Markdown
Member Author

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

Commit 9124552c473cf94ca0349c27af81edd884b9b828 · selected evidence

Open review report

@github-actions

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 (224288 ms), confidentiality-review (79477 ms), spec-provenance-review (128219 ms), desktop-den-sync-review (231586 ms), design-spec-review (202556 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 1
  • Distinct heads in retained window: 1
  • 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: 1/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 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 (9124552c473cf94ca0349c27af81edd884b9b828). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@yomgui

yomgui commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Merge gate verified at head 9124552: openwork-tests-required SUCCESS; both warden check runs SUCCESS; all CodeQL analyses/aggregate SUCCESS; exact-head diff-warden APPROVED; zero unresolved review threads (no pagination); mergeStateStatus CLEAN. All three commits have verified signatures and matching DCO; no policy files changed. Head permission/native-Stop/fresh-work, transport and archive-pressure evidence is published above. No stacked PR targets this branch. Proceeding with explicitly authorized squash merge; retaining branch/worktree.

This branch was successfully deployed

4 active deployments
Preview – openwork-landing — 9124552c Deployed Sep 16, 2026 by vercel[bot]
Preview – openwork-app — 9124552c Deployed Sep 16, 2026 by vercel[bot]
Preview – openwork-den — 9124552c Deployed Sep 16, 2026 by vercel[bot]
Preview – openwork-diagnostics — 9124552c Deployed Sep 16, 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