Skip to content

fix(app): isolate archive HTTP from renderer stream pressure - #5063

Merged
yomgui merged 8 commits into
devfrom
fix/archive-timeout-ui-path
Sep 16, 2026
Merged

yomgui merged 8 commits into
devfrom
fix/archive-timeout-ui-path

Conversation

@yomgui

@yomgui yomgui commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to #5014 (merged). Preserve archive's safety state machine and isolate its finite desktop HTTP requests from Chromium's SSE connection pool.

  • Archive/restore opt into IPC. Default clients and SSE routing are unchanged.
  • Main uses Node networking only for validated plain HTTP loopback, rejecting redirects. External/HTTPS requests retain Electron networking, OS trust and proxy support.
  • Preserve Stop's transport cancellation specifically for POST /session/:id/abort; prompt/command admission POSTs retain their existing contract.
  • Add real socket-pressure and independent mailbox-liveness proof. Extend the test-only HTTP witness below IPC, without production test hooks.

RCA and boundaries

reports/rca-archive-timeout-ui-path-2026-09-16.md

A controlled empty, idle, non-pinned session reproduced the exact ten-second archive toast: the ownership GET received no headers while independent engine reads succeeded. #5014 alone still timed out under that pressure. The fixed sidebar archive completes while SSE blockers remain held.

The main-hosted affordance invokes the same renderer hook; it was not an independent native archive implementation. Generic main electronNet.fetch also timed out in calibration, so changing only IPC routing would not suffice.

A separate held-poll-body test proves registration can expire while the renderer and unrelated HTTP stay healthy. This is a possible mechanism, not attribution of the original installed incident. This PR does not relax the mailbox lease, weaken preflight, raise deadlines, or redesign SSE subscriptions. Eight injected streams across two workspaces are deliberate pressure, not a claim to recreate every retained tab. No visual UI redesign.

Verification — Passed

Final head: 2b15b906a47f896395a3d005b113fbced7f5dd06.

Combined head-specific evidence: all eight test sections

Local isolated source-built Electron / engine v1: 8 testkit tests passed, 0 failed, 0 skipped. Includes the full working-session/approval/queue/child/Undo matrix, accepted-command admission, pressure regression, pinned/held-preflight recovery, independent live-renderer mailbox expiry, deadline suite (117 native tests), and transport/cancellation boundaries. App, Electron and evals typechecks and the 976-callback browser check passed.

The final-head pressure case observed archive success in 119.1 ms, exactly one successful main PATCH, zero renderer PATCHes, no abort/prompt replay, and unchanged neighbors while raw renderer GETs still timed out behind the held SSEs.

Revert-fails control: restore #5014's archive hook, retain tests/witness; the identical fixed-mode oracle fails at 10008.9 ms. Signed fix restored and green again. Historical deliberately dirty control is not fixed-head evidence.

Unmount-oracle provenance: clean #5014-only control reproduced the old late-success expectation failing after unmount. The revised step explicitly asserts cancellation, no late mutation/retry, and Settings navigation safety; production was not changed to resurrect canceled work.

CI openwork-tests-required passes, Warden approves this exact head, all branch commits are signed and signed off, and no policy/workflow files are changed. Final merge-gate receipt is in the PR comments.

@vercel

vercel Bot commented Sep 16, 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 16, 2026 8:23pm UTC
openwork-den Ignored Ignored Preview Sep 16, 2026 8:23pm UTC
openwork-diagnostics Ignored Ignored Preview Sep 16, 2026 8:23pm UTC
openwork-landing Ignored Ignored Preview Sep 16, 2026 8:23pm UTC

@yomgui

yomgui commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Revert-fails evidence — intentional historical red control, not a final-head failure

Restored only apps/app/src/react-app/domains/session/sidebar/use-session-archive.tsx from #5014 merge d16d4a1aa9b4d8b8cf081b213ac9fa50628032b0, retaining the native HTTP witness and all tests. Ran the SAME oracle: OPENWORK_ARCHIVE_PRESSURE_MODE=fixed pnpm evals:e2e session-archive-pressure --local --engine v1 --surface electron.

Result: exit 1; 0 passed / 1 failed / 0 skipped. Assertion at session-archive-pressure.e2e.test.ts:198: expected failureMs null; received 10008.899999976158. The sidebar reached the ten-second failure toast instead of archiving under the held real SSE pressure. The signed implementation was restored immediately, and the same fixed-mode test passed again (1/0/0).

Immutable local receipt: evals/results/test-runs/2026-09-16T19-58-48-558Z-regression-sidebar-archive-succeeds-while-real-same-origin-http-1-1-sse-pressure/test-run.json. It records HEAD cb6cca1 but production was deliberately dirty: this is NOT fixed-head evidence. Earlier separate pre-fix and #5014-only investigative runs also asserted the exact Request timed out GET and release recovery. Final-head passing receipts are published separately without force or SHA overrides.

A wider safety sweep subsequently caught missing Stop POST cancellation through IPC; 379c1c3 narrows cancellation to the abort endpoint at both IPC ends and adds an explicit prompt/command non-cancellation negative test. The original working-session E2E assertions are unchanged and are rerunning before this PR is marked ready.

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run

Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (290022 ms), confidentiality-review (108856 ms), spec-provenance-review (463515 ms), desktop-den-sync-review (385879 ms), design-spec-review (413047 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 2
  • Distinct heads in retained window: 2
  • 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: 2/20 run attempts retained; truncated: false
  • Transition snapshot: 0/0 current attributed threads retained (limit 500); truncated: false

Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority.

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 16, 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 (379c1c3f7e04e04cee97ca707d04d171a06cb675). 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

Unmount-oracle provenance (2b15b90)

The broader Stop cases now pass with abort-POST cancellation preserved. The next failing step was an older E2E expectation that a PATCH held BEFORE upstream dispatch would complete and announce success after the route unmounted.

I checked that oracle on an initially clean dedicated worktree at origin/dev/#5014 merge d16d4a1, with the identical command pnpm evals:e2e session-archive-button --local --engine v1. Result: exit 1, 1 passed / 1 failed / 0 skipped. The SAME unmount step failed at line 361 waiting 30000 ms for Session archived while Settings remained visible. Control receipt: 2026-09-16T20-18-39-627Z-archiving-exits-only-the-viewed-conversation-and-working-sessions-require-a-conf/test-run.json in the dedicated archive-5063-dev-control worktree. The main witness detects cancellation earlier as No pending archive request to release; these are different boundary errors at the same incompatible expectation, not claimed identical signatures.

#5014 deliberately aborts pending archive on unmount and returns an unknown write outcome. The updated step now requires cancellation to reach the held native PATCH, exactly one canceled attempt, no late mutation/retry over two seconds, no successful-archive announcement, Settings navigation preserved, and the original unarchived session still accessible on return. Production was NOT changed to complete a canceled request just to satisfy the old oracle. The rest of the working/approval/admission/queue/Undo matrix remains intact. Full final-head sweep is running before readiness/merge.

@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 (2b15b906a47f896395a3d005b113fbced7f5dd06). 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

Final-head test evidence — Passed

Commit 2b15b906a47f896395a3d005b113fbced7f5dd06 · local isolated source-built Electron / engine v1 · 8 testkit tests passed, 0 failed, 0 skipped.

Every section below comes from a completed head-matching evals/specs receipt. Individual publisher calls were performed, but the single-run publisher replaces its sticky comment; this combined comment retains all eight sections together. No screenshots were needed to decide these assertions. The app-less wrapper publisher's legacy verdict unknown label is not an unrun test: Vitest exited 0 and the recorded assertions passed. No SHA override or forced fixed-head evidence was used.

1. Finite archive IPC preserves scoped requests, cancellation, no retries and external trust boundaries — Passed

Command: pnpm evals:pr specs/session-archive-transport.test.ts

Result: exit 0; 1 passed / 0 failed / 0 skipped (5 Node tests, 2 Bun tests).

Assertion evidence: real loopback GET/PATCH preserved authentication, directory scope and request body; HTTP rejection did not trigger another request; held-body cancellation settled; a redirect target received zero requests; external, HTTPS-loopback and lookalike hosts retained the supplied Chromium fetch. Archive GET/PATCH used IPC while default clients and SSE kept their original routes. Stop's ten-second deadline reached __cancelTransfer; prompt/command POSTs did not gain read cancellation.

Receipt: evals/results/test-runs/2026-09-16T20-24-59-232Z-finite-archive-ipc-preserves-scoped-requests-cancellation-no-retries-and-externa/test-run.json.

2. Archive deadlines settle stalled reads and uncertain writes, preserve caller cancellation, and retain pin and working-session contracts — Passed

Command: pnpm evals:pr specs/session-archive-deadline.test.ts

Result: exit 0; 1 passed / 0 failed / 0 skipped, wrapping 117 native tests passed / 0 failed.

Assertion evidence: stalled preflight/body waits settled before the bridge deadline without a late PATCH; dispatched but unconfirmed writes returned unknown rather than false cancellation; holds/busy state recovered; unmount and effective Request signals remained bounded; pin, working-target refusal and approval contracts remained intact.

Receipt: evals/results/test-runs/2026-09-16T20-25-00-667Z-archive-deadlines-settle-stalled-reads-and-uncertain-writes-preserve-caller-canc/test-run.json.

3. Mailbox registration expires after a poll gap, independently of pin or engine work; a fresh poll restores it — Passed

Command: pnpm evals:pr specs/session-archive-mailbox.test.ts

Result: exit 0; 1 passed / 0 failed / 0 skipped.

Assertion evidence: receipt expired at five seconds and rejected a late reply; registration stayed connected at 20,000 ms but not 20,001 ms; disconnected context was refused before enqueue; a fresh poll restored a successful request/reply. This proves the mailbox contract, not the historical outage's trigger.

Receipt: evals/results/test-runs/2026-09-16T20-25-27-973Z-mailbox-registration-expires-after-a-poll-gap-independently-of-pin-or-engine-wor/test-run.json.

4. Archiving exits only the viewed conversation, and working sessions require a confirmed stop without replay — Passed

Command: pnpm evals:e2e session-archive-button --local --engine v1

Result for this case: Passed. Combined two-case command: exit 0, 2 passed / 0 failed / 0 skipped.

Assertion evidence: idle and cross-workspace archive/Undo preserved the correct route and transcript; retry, permissions and questions required confirmation; cancel did not stop/archive work; false/error/timeout/unconfirmed aborts remained retryable without archive; confirmed Stop handled queued, background and child work without replay. Side-chat and tab identities remained scoped. On unmount, exactly one held native PATCH was canceled before upstream dispatch; zero late mutation/retry over two seconds, no false success announcement, and Settings retained navigation. This updated unmount oracle is supported by the clean #5014-only control described in the provenance comment, not a production change to force success after cancellation.

Receipt: evals/results/test-runs/2026-09-16T20-25-29-619Z-archiving-exits-only-the-viewed-conversation-and-working-sessions-require-a-conf/test-run.json.

5. Accepted commands require exact engine admission before archive and never replay after Undo — Passed

Command: pnpm evals:e2e session-archive-button --local --engine v1

Result for this case: Passed. Combined command counts are reported once in section 4.

Assertion evidence: the configured native command and fixture model were observed; unconfirmed command admission blocked unsafe archive; exact accepted work was reconciled without a duplicate dispatch; archive/Undo did not replay the command or its canceled queued work.

Receipt: evals/results/test-runs/2026-09-16T20-29-13-443Z-accepted-commands-require-exact-engine-admission-before-archive-and-never-replay/test-run.json.

6. Sidebar archive succeeds while real same-origin HTTP/1.1 SSE pressure remains held — Passed

Command: OPENWORK_ARCHIVE_PRESSURE_MODE=fixed pnpm evals:e2e session-archive-pressure --local --engine v1 --surface electron

Result: exit 0; 1 passed / 0 failed / 0 skipped.

Assertion evidence: eight actual SSE requests across two fixture workspaces produced established HTTP/1.1 connections and queued excess requests. A previously successful raw renderer GET timed out under pressure while timers/frames and independent engine reads stayed healthy. The trusted sidebar click archived the idle, non-pinned empty target in 119.1 ms on this head, with exactly one successful main PATCH, zero renderer PATCHes, no abort/prompt replay, unchanged neighbors, and all initially established blockers still held. A subsequent raw renderer GET still timed out, proving the test did not clear pressure to obtain success. All injected streams were cleaned up.

Receipt: evals/results/test-runs/2026-09-16T20-31-29-451Z-regression-sidebar-archive-succeeds-while-real-same-origin-http-1-1-sse-pressure/test-run.json.

7. Pinned idle sessions archive from sidebar/mailbox; held preflight fails promptly without late PATCH and recovers — Passed

Command: pnpm evals:e2e session-archive-pinned --local --engine v1

Result: exit 0; 1 passed / 0 failed / 0 skipped.

Assertion evidence: pinned UI and cross-workspace mailbox archive completed without a focused conversation; unpin-then-archive also worked; pin preference and unrelated sessions were preserved. The main HTTP witness held a real transcript body: structured verification_failed arrived before five seconds, no PATCH followed its late release, and a fresh archive succeeded without restarting.

Receipt: evals/results/test-runs/2026-09-16T20-32-09-006Z-pinned-idle-sessions-archive-from-the-sidebar-and-mailbox-without-a-focused-sess/test-run.json.

8. A synthetic single-poll body gap expires registration while the renderer remains live; release restores context — Passed

Command: pnpm evals:e2e session-mailbox-liveness --local --engine v1 --surface electron

Result: exit 0; 1 passed / 0 failed / 0 skipped.

Assertion evidence: after one actual pending-poll body was held for more than 21 seconds, the exact no-connected-window response arrived in under one second while the same document, route, composer, interval/RAF heartbeats and unrelated renderer/runner HTTP stayed healthy. Session inventory/metadata/transcript/todo digests were unchanged and no engine write was attempted. Releasing the one body resumed real polling and restored context without replay: two contexts delivered across three completed requests. No SSE saturation was injected in this test. This is an independent possible mechanism, not attribution of the installed incident.

Receipt: evals/results/test-runs/2026-09-16T20-33-49-370Z-investigative-a-synthetic-single-poll-body-gap-expires-mailbox-registration-whil/test-run.json.

Additional verification and negative controls

All exited 0 on this head: pnpm --filter @openwork/app typecheck, pnpm --filter @openwork/desktop typecheck:electron, pnpm evals:typecheck (461 sources), and pnpm evals:check-browser (976 callbacks).

@yomgui
yomgui marked this pull request as ready for review September 16, 2026 20:42
@yomgui

yomgui commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Final merge gate: Passed at 2b15b90. Eight head-matching testkit tests passed, zero failed/skipped; all eight evidence sections verified together in comment 5704161887. App/Electron/evals typechecks and 976-callback check passed. Live required set verified from dev rules: openwork-tests-required, PASS (run 35146246650). Warden APPROVED this exact SHA (run 35146246582); zero unresolved review threads; all eight branch commits verified G signatures and matching DCO trailers; no .github/, .warden/, or warden.toml PR changes. PR is ready, MERGEABLE, CLEAN. Merge is explicitly authorized for this bug. Historical red controls are labeled separately and are not fixed-head failures. Original installed incident attribution remains unconfirmed; the scoped pressure remediation and safety behavior are proven.

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