Skip to content

Stop buffering full conversation history in memory for session saves #23740

@spencer426

Description

@spencer426

What happened?

ChatRecordingService currently maintains the entire conversation history in a single cachedConversation:
ConversationRecord object in memory. Every time a new message or tool output is added, it performs a massive
JSON.stringify on the entire array and overwrites the session-*.json file on disk. In long sessions with heavy tool
usage, this unbounded accumulation linearly increases peak heap usage, causes severe garbage collection pauses, and eventually causes the application to crash.

What did you expect to happen?

We should redesign the recording service to use an append-only architecture

Client information

Client Information

Run gemini to enter the interactive CLI, then run the /about command.

> /about
# paste output here

Login information

No response

Anything else we need to know?

No response

Metadata

Metadata

Assignees

Labels

area/agentIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Qualityhelp wantedWe will accept PRs from all issues marked as "help wanted". Thanks for your support!status/possible-duplicate🔒 maintainer only⛔ Do not contribute. Internal roadmap item.

Type

No type
No fields configured for issues without a type.

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions