Skip to content

perf(sessions): move a resumed transcript instead of cloning it - #6446

Open
Hmbown wants to merge 2 commits into
mainfrom
perf/resume-moves-transcript
Open

Hmbown wants to merge 2 commits into
mainfrom
perf/resume-moves-transcript

Conversation

@Hmbown

@Hmbown Hmbown commented Sep 23, 2026

Copy link
Copy Markdown
Owner

No-Issue: resume memory for large sessions from the 0.10.1 memory notes; no public issue.

Resuming a large session held the transcript three times: the loaded
SavedSession, a cloned journal, and a cloned restore projection of its
messages. apply_loaded_session_with_goal and
apply_loaded_session_config_snapshot now take the SavedSession by
value; App::restore_api_messages_from_owned moves the journal and the
history out of it and runs the owned restore projection, so a resume
holds one copy (memory note M3). Callers keep only the ids and counts
they report afterwards.

The borrowing project_messages_for_restore lost its last production
caller, so its test callers move to project_owned_messages_for_restore
and it is removed rather than suppressed.

Mined from the unreviewed 0.10.1 WIP branch (app/apply/event_loop/
handlers and test call sites); the dead-helper migration is new. No
read of the moved fields remains after the move point. The memory
saving is structural; no RSS measurement was taken.

Evidence: 1296 passed, 0 failed (11,961 skipped) across runtime_handoff,
client::chat, session_peek, session_manager, runtime_store_binding,
resume, restore, apply_loaded and tui::ui::tests. TUI all-target/all-
feature Clippy with CI flags and fmt passed; dead-code budget 279.

🤖 Generated with Claude Code

Resuming a large session held the transcript three times: the loaded
SavedSession, a cloned journal, and a cloned restore projection of its
messages. apply_loaded_session_with_goal and
apply_loaded_session_config_snapshot now take the SavedSession by
value; App::restore_api_messages_from_owned moves the journal and the
history out of it and runs the owned restore projection, so a resume
holds one copy (memory note M3). Callers keep only the ids and counts
they report afterwards.

The borrowing project_messages_for_restore lost its last production
caller, so its test callers move to project_owned_messages_for_restore
and it is removed rather than suppressed.

Mined from the unreviewed 0.10.1 WIP branch (app/apply/event_loop/
handlers and test call sites); the dead-helper migration is new. No
read of the moved fields remains after the move point. The memory
saving is structural; no RSS measurement was taken.

Evidence: 1296 passed, 0 failed (11,961 skipped) across runtime_handoff,
client::chat, session_peek, session_manager, runtime_store_binding,
resume, restore, apply_loaded and tui::ui::tests. TUI all-target/all-
feature Clippy with CI flags and fmt passed; dead-code budget 279.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 23, 2026 16:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Pins memory note M3: after App::restore_api_messages_from_owned the
journal's entry buffer is the same allocation the loaded session held,
and the restored state matches the borrowing path exactly (current and
legacy journal-less sessions). Mined from the 0.10.1 WIP branch; the
comparison now uses the owned projection, since the borrowing one was
removed.

Evidence: owned_restore_moves_the_journal_and_matches_the_borrowing_restore
1 passed, 0 failed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

2 participants