Repository navigation
fix(browser-capture): preserve temporary chats and attachments - #2376
Conversation
Problem: ChatGPT temporary chats do not expose a normal /c/<id> route, and the browser-capture fallback was dropping turn attachments. A non-native raw preservation payload could also route through the ChatGPT native parser and produce a zero-message indexed session. Claude.ai native capture still needed an on-demand bridge for reliable live proof. Ref #2308. What changed: add deterministic temporary ChatGPT session ids, preserve turn attachments through shared envelopes, extract ChatGPT DOM file-tile metadata with false-positive guards, add a Claude.ai main-world native bridge, and require native raw payload shape before using provider-native parsers. Verification: npm run validate && npm run lint && npm run build && npm test -- tests/common.test.js tests/content/chatgpt.test.js tests/content/claude.test.js tests/build.test.js; devtools test tests/unit/sources/test_browser_capture.py -k 'non_native_raw_payload_keeps_envelope_turns or parses_session_metadata_and_deduplicates_turns'; devtools verify --quick.
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughAdds a new MAIN-world ChangesClaude Bridge, ChatGPT Attachments & Temp-Chat Session IDs
Sequence Diagram(s)sequenceDiagram
participant Page as Claude Page (MAIN world)
participant Bridge as claude_bridge.js
participant ContentScript as claude.js (content-script)
participant ClaudeAPI as Claude API
rect rgba(100, 149, 237, 0.5)
note over Bridge: Passive fetch interception
Page->>Bridge: window.fetch(chat_conversations URL)
Bridge->>ClaudeAPI: original fetch (pass-through)
ClaudeAPI-->>Bridge: JSON with chat_messages
Bridge->>Bridge: remember capture in __polylogueClaudeCapturedFetches
Bridge-->>Page: response (unmodified)
end
rect rgba(144, 238, 144, 0.5)
note over ContentScript,Bridge: On-demand native capture
ContentScript->>Bridge: postMessage(nativeFetchRequest, {requestId, conversationId})
Bridge->>Bridge: inferConversationApiUrl(conversationId)
Bridge->>ClaudeAPI: fetch(inferredUrl, credentials: include)
ClaudeAPI-->>Bridge: conversation JSON
Bridge-->>ContentScript: postMessage(nativeFetchResponse, {requestId, capture})
ContentScript->>ContentScript: parseNativeCapture + rememberNativeAttempt
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b2a5100cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
This updates browser capture so ChatGPT temporary chats without
/c/<id>routes get deterministic local ids, browser-observed turn attachments survive through the shared envelope, and non-native preservation payloads no longer get misparsed as empty native ChatGPT sessions. It also adds the Claude.ai main-world native capture bridge that was live-proven locally.Problem
A live ChatGPT temporary tab at
https://chatgpt.com/?temporary-chat=truewas important enough to preserve immediately, but temporary chats do not expose the normal provider-native conversation id. The first emergency envelope also showed a parser bug: a non-nativeraw_provider_payloadwrapper was sent through the ChatGPT native parser and materialized a zero-message session. Separately, browser DOM fallback had an attachment model downstream but the extension droppedturn.attachmentsbefore storage could see them.Ref #2308.
Solution
temporary:<hash>ids for ChatGPT temporary-chat URLs.turn.attachmentsthroughbrowser-extension/src/common.js.mapping, Claude.aichat_messages.Live preservation proof for the urgent tab:
chatgpt-export:temporary:867d1acac2bf4997857fa0a7./realm/inbox/chatgpt-temporary-preserve-20260624-165817.state=archived,raw_row_exists=true,indexed_session_exists=true,indexed_message_count=25.Verification
npm run validate && npm run lint && npm run build && npm test -- tests/common.test.js tests/content/chatgpt.test.js tests/content/claude.test.js tests/build.test.js— passed, 72 tests.devtools test tests/unit/sources/test_browser_capture.py -k 'non_native_raw_payload_keeps_envelope_turns or parses_session_metadata_and_deduplicates_turns'— passed, 2 selected.devtools verify --quick— passed, run id20260624T151252Z-quick-2819319-6a00faa2.git pushpre-push quick gate — passed, run id20260624T151412Z-quick-2821092-f9098ead.Residuals
Seven observed temporary-chat attachment names were preserved without local bytes because matching local files were not found under the checked download/snapshot roots. The archive stores their names and message refs; the preservation directory records the unmatched set for later recovery if the original upload files are found.
Summary by CodeRabbit
New Features
Bug Fixes