Skip to content

fix(companion): rollback session when POST /sessions fails after create - #14

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-8039
Draft

fix(companion): rollback session when POST /sessions fails after create#14
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-8039

Conversation

@cursor

@cursor cursor Bot commented Jul 23, 2026

Copy link
Copy Markdown

Bug and impact

POST /sessions could leave orphaned Chromium browser contexts when createSession() succeeded but response validation or serialization failed afterward. Retries accumulated live contexts with no sessionId returned to the client.

Root cause

The companion handler had no compensating closeSession when errors occurred after runtime session creation.

Fix

Track createdSessionId and call runtime.closeSession() in the error path before returning the failure response.

Validation

  • pnpm --filter @webchain/companion test — 14 tests pass, including new rollback test.
Open in Web View Automation 

createSession could leave orphaned browser contexts when response validation
or serialization failed after the runtime session was created.

Co-authored-by: esadrianno <esadrianno@gmail.com>
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