Skip to content

fix(ego-browser): refresh session after opening tab - #290

Open
mameikagou wants to merge 1 commit into
citrolabs:devfrom
mameikagou:agent/refresh-new-tab-session-dev
Open

fix(ego-browser): refresh session after opening tab#290
mameikagou wants to merge 1 commit into
citrolabs:devfrom
mameikagou:agent/refresh-new-tab-session-dev

Conversation

@mameikagou

Copy link
Copy Markdown

Summary

  • invalidate the cached CDP session after newTab() creates a target
  • prefer the created target for the next page-scoped CDP command
  • add a regression test that starts on an old session and verifies the next command attaches to the new target

Why

newTab() returned the new target ID without updating session selection. Because ensureSession() caches the current session for two seconds, an immediate wait or page command could continue operating on the previously active tab. switchTab() already invalidates the session and sets a preferred target; this applies the same transition after native tab creation.

Impact

Commands issued immediately after newTab() or the new-tab branch of openOrReuseTab() now attach to the created tab instead of briefly reusing the prior tab's session.

Validation

  • npm test — 312 tests passed
  • Prettier check passed
  • TypeScript typecheck passed
  • Site-skill validation passed
  • Vulnerability audit found 0 issues
  • Real-browser navigation helper case passed; the full local E2E run finished 42/45, with unrelated existing/environmental failures in ffmpeg discovery, the concert inventory fixture, and canvas zigzag stroke counting

@mameikagou
mameikagou marked this pull request as ready for review August 17, 2026 09:04
@mameikagou
mameikagou force-pushed the agent/refresh-new-tab-session-dev branch from 91d015b to 0de746f Compare August 21, 2026 05:06
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