Skip to content

feat(chatgpt): record assistant sandbox file links as unfetchable attachments - #2666

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/sandbox-file-attachments
Jul 10, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/sandbox-file-attachments

Conversation

@Sinity

@Sinity Sinity commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

Assistant-generated Code Interpreter deliverables (sandbox:/mnt/data/... links) become first-class attachment rows with attachment_kind="sandbox_file", honest non-acquired status, and source_url carrying the sandbox path. One parser change covers both export files and browser captures (native payloads route through chatgpt.parse).

Problem

Ten GPT-Pro fork conversations captured 2026-07-10 each end with a kit ZIP deliverable reachable only through expiring sandbox links. The archive recorded nothing: no attachment row, no name, no queryable trace that the files ever existed. Bytes are unrecoverable post-expiry; even the existence was invisible.

Solution

  • _sandbox_file_paths: ordered, per-message-deduplicated extraction of /mnt/data paths from assistant text (markdown links and bare mentions; trailing prose punctuation stripped; user-message mentions ignored).
  • Emitted as ParsedAttachment(provider_attachment_id="sandbox:<msg>:<path>", attachment_kind="sandbox_file", source_url="sandbox:<path>") — the existing Attachments are metadata-only: bytes never preserved (8.4 GB referenced, 0 blobs present) #2468 acquisition plumbing records them as non-acquired without fabricating hashes.
  • Byte acquisition at capture time (authenticated fetch in the extension) is deliberately out of scope — tracked in beads (polylogue-ptx extension lane); this slice gives it stable rows to fill.

Verification

  • tests/unit/sources/test_parsers_chatgpt.py → 85 passed (3 new: extraction/dedup/shape, user-message negative control, punctuation stripping).
  • Real fork capture (Sinex Proof Obligation Compiler conversation) parsed through the new code → 87 sandbox_file attachments including the kit ZIP + checksum.
  • devtools verify --quick green (89.9s).

Ref polylogue-ptx (extension attachments lane).

🤖 Generated with Claude Code

https://claude.ai/code/session_01BeVDxsVhLuoG5w7bp5cmNU

…achments

Problem: Code Interpreter deliverables surface only as sandbox:/mnt/data
links inside assistant prose. Exports and browser captures carry no
bytes and no metadata attachment row for them, and the links expire
with the sandbox container — so generated ZIPs/reports were invisible
to the archive: not queryable, not even recorded as having existed.
Observed live 2026-07-10: ten GPT-Pro fork conversations whose final
messages each deliver a kit ZIP reachable only through such links.

What changed: chatgpt.parse (shared by export files and browser-capture
envelopes with native payloads) extracts sandbox:/mnt/data/... links
from assistant messages into ParsedAttachment rows with
attachment_kind="sandbox_file" and source_url="sandbox:<path>". No
acquisition is attempted — there is nothing local to fetch — so storage
records them with the standard non-acquired status instead of guessing.
Links are deduplicated per message and trailing prose punctuation is
stripped; user-message mentions are ignored.

Byte acquisition (fetching sandbox files through the authenticated
browser session at capture time) is extension-side scope tracked in
beads; this slice makes the deliverables' existence queryable and gives
the acquisition path stable attachment rows to fill.

Verification: tests/unit/sources/test_parsers_chatgpt.py 85 passed
(3 new tests); real fork capture parsed through the new code yields 87
sandbox_file attachments incl. the kit ZIP; devtools verify --quick
green (89.9s).

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4d973a75-4f7b-43ea-be77-6af5e5d37352

📥 Commits

Reviewing files that changed from the base of the PR and between 0cccef1 and 7f31248.

📒 Files selected for processing (2)
  • polylogue/sources/parsers/chatgpt.py
  • tests/unit/sources/test_parsers_chatgpt.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/sandbox-file-attachments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity merged commit eeb05be into master Jul 10, 2026
14 checks passed
@Sinity
Sinity deleted the feature/fix/sandbox-file-attachments branch July 10, 2026 18:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f31248b3f

ℹ️ 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".

return None


_SANDBOX_FILE_RE = re.compile(r"sandbox:(/mnt/data/[^\s)\]\"'>]+)")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve parentheses in sandbox file paths

When an assistant Markdown link points at a generated file whose name contains parentheses, such as [Download](sandbox:/mnt/data/report_(final).zip), this regex stops at the first ) and _sandbox_file_paths records only /mnt/data/report_(final. The resulting attachment row gets the wrong name, native id, and source_url, so the archive still misses the actual deliverable for those valid Code Interpreter filenames; parse the Markdown destination or otherwise allow balanced/encoded parentheses instead of treating every ) as a terminator.

Useful? React with 👍 / 👎.

Sinity added a commit that referenced this pull request Jul 10, 2026
…2669)

## Summary
Implements `polylogue-5k5l`: the browser extension now fetches
assistant-produced files (Code Interpreter sandbox deliverables,
file-service assets) through the authenticated page session at capture
time and ships the bytes as envelope attachments; the parser merges them
onto the attachment rows it already derives, landing them in the
content-addressed blob store with `acquired` status. Also deepens
ChatGPT citation fidelity: file citations keep their cited-document
identity, and inline citation markers are preserved as anchored
constructs.

## Problem
Ten GPT-Pro fork conversations captured 2026-07-10 each delivered a kit
ZIP reachable only through `sandbox:` links that expire with the
container — the archive recorded links (after #2666), never bytes.
Worse, on the native-payload parse path (the path every rich capture
takes), envelope attachments were **silently dropped**, so even
extension-acquired bytes could never have landed. Separately, file
citations were flattened to bare spans (source identity nests under
`metadata`/`extra`), and stripped citation markers (#2668) discarded
turn/file/line-range tokens that metadata often lacks (`line_range` is
frequently null).

## Solution
- **Extension**: page-bridge asset fetch (interpreter/download +
files/download → signed URL → bytes), descriptor collection from the
native payload with parser-matching ids (`sandbox:<msg>:<path>`, upload
ids, asset pointers), 25MB/file / 75MB/capture budget, per-asset outcome
disclosure in `provider_meta.asset_acquisition`; failures never fail the
capture — expired links are normal.
- **Parser**: `_merge_envelope_attachments` folds envelope rows into
native-delegated sessions; byte-carrying rows win on id collision while
preserving `attachment_kind`, so bytes land on the same row the
sandbox-link extractor creates.
- **Citations**: nested `metadata`/`extra` lookup (document name, file
id, source, cloud URL); inline markers become `inline_citation_marker`
constructs anchored in original-text coordinates — the same system as
citation `start_ix`/`end_ix`, so anchors correlate.

## Verification
- Extension vitest **93 passed**; new descriptor tests caught a real bug
pre-merge (`file-service://` scheme matched as the file id); eslint
clean.
- `test_browser_capture.py` **31 passed** (merge regression +
no-envelope-attachments no-op); `test_parsers_chatgpt.py` **90 passed**;
mypy clean on all changed Python.
- Real fork capture re-parsed: **11/11 file citations** carry source
name + file id; **50 inline markers** preserved, spans aligned with
citation anchors.
- `devtools verify --quick` green.
- Not run: live end-to-end browser capture with the updated extension
(requires reloading the unpacked extension in the agent browser — noted
for the capture owner; the bridge endpoints mirror the page's own
download flow).

Ref polylogue-5k5l.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01BeVDxsVhLuoG5w7bp5cmNU

Co-authored-by: Claude <[email protected]>
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