Skip to content

fix(chatgpt-web): reuse persistent CDP sessions and current app mentions - #15935

Open
ElioBonfim wants to merge 4 commits into
diegosouzapw:release/v3.8.52from
ElioBonfim:codex/chatgpt-persistent-cdp-upstream
Open

ElioBonfim wants to merge 4 commits into
diegosouzapw:release/v3.8.52from
ElioBonfim:codex/chatgpt-persistent-cdp-upstream

Conversation

@ElioBonfim

Copy link
Copy Markdown
Contributor

ChatGPT Web connections using CDP currently create isolated contexts/pages and lose native Codex message IDs during routing sanitation. A logged-in operator browser can therefore fail validation or tool preflight, while repeated attempts accumulate pages. The current ChatGPT composer, model picker, and app-mention markup also differ from the vendored selectors.

This adds an opt-in CHATGPT_WEB_CODEX_USE_CDP_PROFILE=1 mode that leases the existing ChatGPT page, verifies the account/workspace, preserves refreshed session state, and releases ownership without closing the operator's page. It refuses overlapping leases or multiple ChatGPT pages, preserves unrelated operator tabs, clears stale drafts, and resets temporary conversations between turns. The default CDP context/recovery behavior on the current release is retained.

Native message IDs are preserved only for ChatGPT Web so environment and permission checks remain enforceable. Current app-mention markup, keyboard highlight (aria-current), selected app identity, composer, model family, and assistant response markers are supported alongside existing markup. Selection still requires exact identity; no account or permission checks are bypassed.

Validation:

  • Focused persistent-session, message-provenance, and reasoning-sanitation tests.
  • Real-browser fixture covering old/current selected app markup, exact identity, prompt text, and keyboard activation.
  • Core TypeScript checks on the current upstream release branch.
  • Production build and native Responses verification on v3.8.51, including a real Codex CLI tool turn using the configured tunnel.

The operator guide documents loopback-only CDP, dedicated profiles, one active turn, session recovery, and deployment constraints. Headless behavior depends on ChatGPT security checks; this does not promise permanent login or CAPTCHA avoidance.

@diegosouzapw

Copy link
Copy Markdown
Owner

Hi @ElioBonfim — closing this pull request to clear the open queue. The branch codex/chatgpt-persistent-cdp-upstream is kept, so the commits stay. Comment here if it should be reopened.

@diegosouzapw

Copy link
Copy Markdown
Owner

Hi @ElioBonfim — reopening this pull request. The close was a mistake, and it is back in the merge queue. The branch codex/chatgpt-persistent-cdp-upstream was kept.

@diegosouzapw diegosouzapw reopened this Oct 10, 2026

This branch has not been deployed

No deployments
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.

2 participants