Skip to content

fix(native-chat): resume large terminal conversations in a new native chat - #29056

Merged
brennanb2025 merged 8 commits into
mainfrom
brennanb2025/import-large-agent-transcripts
Oct 15, 2026
Merged

brennanb2025 merged 8 commits into
mainfrom
brennanb2025/import-large-agent-transcripts

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​228 $\color{#cf222e}{\Huge{\mathbf{−}}}$​84 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​144
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​301 $\color{#cf222e}{\Huge{\mathbf{−}}}$​164 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​137

ELI5

Resume in New Native Chat failed for long terminal conversations because Orca refused saved transcripts larger than 16 MiB. A Windows user hit this with a 321 MB Claude conversation and saw a chat that could not connect.

The import now reads large transcripts as a stream and shows their most recent history. The provider still resumes the original saved conversation, including context omitted from the chat display.

What Changed

  • Replace the whole-file size limit with a 16 MiB limit per record. Keep existing message trimming and retain the newest complete display items within a 16 MiB budget, always keeping the latest item. Count item identities in that budget and release discarded items immediately.
  • For Pi, preserve its chosen conversation branch and compacted context through an indexed temporary SQLite database on the execution host. Projection yields after limited bytes, elapsed time or visited rows. SQLite owns temporary-file lifetime; teardown errors are reported without discarding successfully prepared history.
  • Classify the temporary table in the existing storage inventory. No new dependency, setting, saved field or client/host message is added.

Claude, Codex, Grok, OMP and Pi use this import path. OpenCode's database import is unchanged.

Why

The imported copy supplies display history; the provider loads its context from the original conversation. Limiting the raw file rejected valid long conversations. Raising the limit would postpone the same problem, while keeping every message would let memory grow with the source. A finite recent-history window follows the common pattern.

Intended limits: oldest display history can be omitted without a notice. Individual records over 16 MiB remain unsupported. Pi uses temporary disk proportional to the source; SQLite selects the temporary-file location on the execution host. The complete file is still read. Single-record and database operations are synchronous, so the yield budget is not a hard latency guarantee, and retained-data/cache budgets are not maximum process-memory guarantees.

Linked Issue

Related to #27385. This removes its whole-file size obstacle; Codex history kept by reference is separate. Import-failure wording was addressed separately in #28261.

Visual Proof

Real rendered QA ran sequentially on Windows high spec, using hidden renderers and clipped Chrome DevTools Protocol screenshots. Main e8c7b32a9037 and exact PR head 39b3f8cd9f1 used the same Claude-shaped JSONL: 31,644,918 bytes, 1,400 linked records, with isolated homes and agent configuration. The driver used the real Resume in New Native Chat menu action on both builds.

Main: refuses the conversation with “Chat could not be started.” Its wording differs from the original report because #28261 separately corrected import-failure wording.

Main refuses the large conversation

Branch: opens Claude Chat alongside the original terminal and renders recent history, including msg-1399. The recent-marker assertion was scoped to the native chat pane; the history-list preview was excluded. Existing inline message trimming is preserved, with no new whole-history omission notice.

Branch renders recent conversation history

Provider continuation: not affected by this PR; unchanged provider resume path. This change imports display history; agent resume by conversation id is untouched. No sign-in or credential/configuration copying was needed.

Testing

  • Manually exercised on a remote machine (main/branch large-transcript resume)
  • Automated regressions added or updated

Regressions cover large-source recent-history retention, oversized-record refusal and stream closure, complete-item accounting, Pi branch/compaction selection, cooperative projection progress, and successful preparation when teardown reports an error after closing the real connection.

Full PR Checks run 38763244751 passed on exact merge head c0a0afa204a0dfe9c732a15bdd33cad58d46809a: static analysis/typecheck, all five Node test shards, relay integration, cross-version wire compatibility and Linux/Windows packaging passed. The required PR checks passed aggregate skipped under the documented fast path: routing validation passed, selectors were canonical, every selected dependency succeeded and every unselected dependency skipped.

The automatic ready-for-review workflow reused the identical successful source/workflow result. Ready to merge: out of draft, 0 unresolved review threads, and mergeStateStatus: CLEAN on exact head c0a0afa204a0dfe9c732a15bdd33cad58d46809a. The full readiness pr.yml run completed successfully; its required-check reuse and skipped aggregate were verified from the successful routing log. WSL and changed end-to-end specs passed. The separate Headless Node server workflow also passed persistence checks on Linux, Windows x64 and Windows ARM.

Remote targeted tests did not reach Vitest because the host lacked Bun. A Windows standalone Node 24.18.0 / SQLite 3.53.1 probe confirmed indexed ordered access and unnamed temporary database support with TEMP_STORE=1. This does not verify the shipped Electron binary's configuration. Rendered Claude resume is now verified above. Actual Electron SQLite configuration and Pi timing were not measured. Provider continuation is not affected by this PR; unchanged provider resume path.

Owned test apps, drivers and remote checkouts were cleaned up, and real Claude/Codex configuration hashes were unchanged. The rendered pass covered the Session History entry point; a separate small-transcript resume and terminal-header click were not exercised.

Review

Two adversarial rounds and fresh independent decisions led to fixes for Pi memory growth, complete-item accounting, ordered access, storage inventory and cleanup blocking successful preparation. Final independent source/readiness review accepted production head fcc2e0bb75b with no remaining proven code finding. The later 39b3f8cd9f1 assertion-only correction was inspected separately. The one final main sync is merge commit c0a0afa204a0dfe9c732a15bdd33cad58d46809a with main snapshot f4abedd7ec4a. Its only conflict moved the three Pi regressions into main’s registered test suite. All four production PR files remain byte-for-byte identical to the reviewed/QA head; the merged test registration and preserved cases were re-verified. Normal pre-commit passed; the incidental hook lockfile rewrite was restored, retaining main’s committed lockfile. No pnpm command ran outside the hook. Review and rendered QA are complete.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material copied.

Notes

Import and temporary storage stay on the host executing the agent, including SSH hosts. Paths use platform APIs. No transport, persisted schema, default, mobile surface or provider lifecycle changes.

Checklist

  • Focused on large-transcript import
  • Problem, user-facing change, mechanism and alternatives explained
  • Remote before/after screenshots attached
  • Correctness, performance, cross-platform, SSH and compatibility reviewed
  • Full PR workflow green on the current head

Authored for @BrennanKB5.

Resume in New Native Chat refused any saved conversation over 16 MiB, so long
Claude and Codex sessions could not move into a chat. The import now streams
the file, bounds each message as it is read, and keeps the newest messages
within the same 16 MiB budget; one line is still bounded at 16 MiB. The agent
resumes the full conversation itself, so only the chat's earliest messages
can fall outside the window.
@brennanb2025 brennanb2025 changed the title fix(native-chat): resume conversations of any size in a new native chat fix(native-chat): resume large terminal conversations in a new native chat Oct 15, 2026
@brennanb2025

brennanb2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

A Windows user could not resume a 321 MB Claude terminal conversation in native chat: Orca refused saved transcripts above 16 MiB, leaving a chat that could not connect. This PR streams large transcripts and displays their recent history. Agent resume by conversation id is unchanged.

Review and rendered QA are complete. Review fixes cover Pi’s indexed temporary storage, complete-item retention accounting, cooperative projection yields, storage inventory and cleanup that cannot discard prepared history. Two adversarial rounds, independent decisions and final source/readiness checks found no remaining proven code finding.

On Windows high spec, the same 31,644,918-byte Claude-shaped JSONL (1,400 linked records) was resumed through the real Resume in New Native Chat action in isolated homes:

Check Result
Main e8c7b32a9037 Refused with “Chat could not be started.” The wording was corrected separately in #28261.
Reviewed branch 39b3f8cd9f1 Opened Claude Chat alongside the original terminal and displayed recent history, including msg-1399, verified inside the chat pane.
Provider continuation not affected by this PR; unchanged provider resume path

Main refuses the large conversation

Branch displays recent history

The one final main sync is pushed as merge commit c0a0afa204a0dfe9c732a15bdd33cad58d46809a, merging origin/main snapshot f4abedd7ec4a. The sole conflict moved the three Pi regressions into main’s registered test suite. All four production PR files remain byte-for-byte identical to the reviewed/QA head. The normal pre-commit hook passed; its incidental lockfile rewrite was restored while preserving main’s committed lockfile. No pnpm command ran outside the hook.

Full PR workflow run 38763244751 passed on exact head c0a0afa204a0dfe9c732a15bdd33cad58d46809a: static analysis/typecheck, all five Node shards, relay integration, wire compatibility and Linux/Windows packaging passed. Its aggregate skipped under the documented fast path; the routing step passed with canonical selectors and every selected dependency succeeded. The automatic ready-for-review run 38765650907 reused that identical successful source/workflow result.

Ready to merge: out of draft, 0 unresolved review threads, and mergeStateStatus: CLEAN on exact head c0a0afa204a0dfe9c732a15bdd33cad58d46809a. The full readiness pr.yml run completed successfully; its required-check reuse and skipped aggregate were verified from the successful routing log. WSL and changed end-to-end specs passed. The separate Headless Node server workflow also passed persistence checks on Linux, Windows x64 and Windows ARM.

Intended limits remain: oldest display history may be omitted without a whole-history notice; existing inline message trimming remains; individual records over 16 MiB are refused; Pi uses temporary disk proportional to source size. No hard latency or process-memory maximum is claimed. Actual Electron SQLite configuration and Pi timing were not measured. Codex history kept by reference is separate. Owned QA rigs/checkouts were removed and real config hashes were unchanged. No sign-in was needed and no PR merge was performed.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 15, 2026 16:02
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cce94755-561e-49b0-80cc-e0acc1e28eb5
📥 Commits

Reviewing files that changed from the base of the PR and between f4abedd and c0a0afa.

📒 Files selected for processing: 9
  • src/main/native-chat/agent-session-journal/journal-legacy-import-record-bound.test.ts
  • src/main/native-chat/agent-session-journal/journal-legacy-import-source-bound.test.ts
  • src/main/native-chat/agent-session-journal/journal-legacy-import.test.ts
  • src/main/native-chat/agent-session-journal/journal-legacy-import.ts
  • src/main/native-chat/agent-session-journal/journal-pi-active-branch.ts
  • src/main/native-chat/agent-session-journal/journal-pi-context-import.spec.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-adopted-import.test.ts
  • src/main/native-chat/transcript-stream-lines.ts
  • src/shared/wsl-move/wsl-move-storage-dispositions.ts
💤 Files with no reviewable changes: 1
  • src/main/native-chat/agent-session-journal/journal-legacy-import-source-bound.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

📝 Walkthrough

Legacy transcript imports no longer reject a source only because its total size exceeds 16 MiB. Decoding enforces a 16 MiB per-record limit, while import preparation retains the newest complete items within a 16 MiB serialized-history budget and keeps the latest item. Pi transcript entries are stored in a temporary SQLite database and projected by active-branch ancestry. Tests cover oversized records, large imports, Pi projection, and database teardown.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to c0a0a

No actionable code risk remains from this review. Resolve the reported merge conflicts and complete normal validation before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly identifies the main user-facing change: resuming large terminal conversations in a new native chat.
Description check Passed The description is comprehensive. It includes the user impact, implementation details, rationale, linked issue, visual proof, testing, review status, compatibility considerations, and checklist result…
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@brennanb2025
brennanb2025 merged commit 7f492dc into main Oct 15, 2026
64 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/import-large-agent-transcripts branch October 15, 2026 22:00
KUOCHIUHSIANG pushed a commit to KUOCHIUHSIANG/orca that referenced this pull request Oct 16, 2026
… chat (stablyai#29056)

* fix(native-chat): resume conversations of any size in a new native chat

Resume in New Native Chat refused any saved conversation over 16 MiB, so long
Claude and Codex sessions could not move into a chat. The import now streams
the file, bounds each message as it is read, and keeps the newest messages
within the same 16 MiB budget; one line is still bounded at 16 MiB. The agent
resumes the full conversation itself, so only the chat's earliest messages
can fall outside the window.

* test(native-chat): adopt preflight refuses one line past the record bound, not a large file

* fix(native-chat): bound retained Pi import state and identities

* fix(native-chat): keep Pi branch projection responsive

* fix(native-chat): classify temporary Pi import table

* fix(native-chat): keep Pi resume independent of import scratch cleanup

* test(native-chat): match legacy Pi identity by shape

(cherry picked from commit 7f492dc)
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