Skip to content

Browser mode loses completed Pro answer after recoverable CDP disconnect (0.16.0) #326

Description

@hoyanhan

Summary

With @steipete/oracle 0.16.0 in browser mode, a long Pro run submitted successfully and ChatGPT later completed a full answer, but Oracle lost its target-level CDP client shortly before completion and reported:

ERROR: Chrome window closed before oracle finished. Please keep it open until completion.
Chrome disconnected before completion; keeping session running for reattach.

Chrome did not close. The persistent browser process remained running, its loopback CDP endpoint remained reachable, and the same page target was still present in /json/list. ChatGPT completed the response server-side around two minutes later, and the full answer was recoverable manually, but Oracle never captured it.

Environment

  • Oracle: unmodified npm @steipete/oracle 0.16.0
  • Node.js: 24.14.1
  • OS: Ubuntu 24.04, x86_64
  • Chrome: 150
  • Engine: browser
  • Model: gpt-5-pro
  • Manual-login persistent browser profile with Chrome already running over loopback CDP
  • Browser response timeout: 20 minutes
  • CLI timeout: 60 minutes
  • Heartbeat: 30 seconds
  • Approximately 17.6k input tokens, with seven text files inlined using --browser-attachments never

Command shape:

oracle --engine browser \
  --model gpt-5-pro \
  --browser-attachments never \
  --timeout 60m \
  --heartbeat 30 \
  --browser-archive never \
  -p "<structured prompt>" \
  --file "<file>" ...

Timeline

  1. At T+0, Oracle verified the Pro picker and recorded promptSubmitted=true.
  2. Every 30 seconds through T+16m, Oracle logged that no thinking status was detected.
  3. At approximately T+16m43s, the target-level CDP client disconnected and Oracle reported that the Chrome window had closed.
  4. The browser service had not restarted, CDP remained reachable, the same target still existed, and there was no kernel OOM or Chrome crash evidence.
  5. ChatGPT completed the full response at approximately T+18m.
  6. Oracle left the session and model run in running state with incompleteReason=chrome-disconnected.
  7. The stored runtime had only the root https://chatgpt.com/ URL and no conversation ID.
  8. A later oracle session <id> --harvest captured a generic ChatGPT error banner rather than the completed answer. Follow-up recovery also failed because the session contained no ChatGPT conversation URL.
  9. No transcript or response artifact was written.

The initiating cause of the CDP WebSocket disconnect is not yet proven. The confirmed problem is that Oracle classified a recoverable client disconnect as a closed Chrome window and could not reconnect to the still-live target.

Source-level behavior

In src/browser/index.ts, any client disconnect is mapped to:

Chrome window closed before oracle finished

In src/cli/sessionRunner.ts, the connection-loss path keeps the session marked as running and prints reattach guidance, but it did not automatically reconnect in this run.

Recovery was then ineffective because no /c/... conversation URL had been persisted. Keeping the session in running state is insufficient when the target is still available but Oracle cannot resolve the completed conversation.

Expected behavior

When the CDP client disconnects:

  1. Distinguish a client/WebSocket disconnect from an actually closed browser or target by probing the CDP endpoint and recorded target.
  2. If the target remains alive, reconnect to it and continue waiting or harvest the completed response.
  3. Apply the existing auto-reattach concept to the connection-lost path, not only assistant timeouts.
  4. Persist the conversation URL/ID as early as possible after submission.
  5. If the URL is unavailable, retain a recovery fallback based on the recorded target ID and prompt preview.
  6. Reconcile a recovered completed response to status=completed rather than leaving the session permanently running.
  7. Preserve the underlying disconnect reason instead of replacing every client disconnect with “Chrome window closed.”

Related issues

I have retained the detailed local logs privately. The prompt, response, project names, paths, account details, session IDs, conversation IDs, hostnames, and process IDs have intentionally been omitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Urgent regression or broken agent/channel workflow affecting real users now.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossThis issue is about lost, duplicated, misrouted, or suppressed channel messages.impact:session-stateThis issue is about session, memory, transcript, context, or agent state drift.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions