Repository navigation
fix(native-chat): resume large terminal conversations in a new native chat - #29056
Conversation
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.
…ound, not a large file
|
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:
The one final main sync is pushed as merge commit Full PR workflow run 38763244751 passed on exact head Ready to merge: out of draft, 0 unresolved review threads, and 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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
… 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)


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
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
e8c7b32a9037and exact PR head39b3f8cd9f1used 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.
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.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
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: CLEANon exact headc0a0afa204a0dfe9c732a15bdd33cad58d46809a. The full readinesspr.ymlrun 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
fcc2e0bb75bwith no remaining proven code finding. The later39b3f8cd9f1assertion-only correction was inspected separately. The one final main sync is merge commitc0a0afa204a0dfe9c732a15bdd33cad58d46809awith main snapshotf4abedd7ec4a. 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
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
Authored for @BrennanKB5.