Skip to content

Likely full transcript traversal/materialization on writes causes I/O and memory amplification in tool-heavy sessions #404

Description

@baron

Impact

If transcript updates traverse or materialize full session history on each write, tool-heavy sessions can incur cumulative O(n²) work: slow saves, memory spikes, and disk churn.

Actual behavior

A low-cost probe reported likely full-history traversal/materialization/write amplification around tool-heavy sessions. This is consistent with large local AgentSession JSON and rollout footprints, but needs measurement before storage redesign.

Expected behavior

  • First deliverable: instrument and confirm or refute full-history write amplification.
  • If confirmed, session persistence should be incremental, append-oriented, or dirty-segment based rather than full-document rewrite per update.
  • Existing on-disk compatibility should be preserved or migrated deliberately.

Publishable evidence

  • Probe finding: likely full-history traversal/materialization/write amplification.
  • Local scan: about 2,075 AgentSession JSON files totaling about 64 MB.

Scope / non-goals

In scope:

  • measurement/instrumentation,
  • persistence strategy for AgentSession updates if confirmed.

Out of scope:

Likely affected areas

  • Sources/RepoPrompt/Features/AgentMode/Runtime/Transcript/
  • Sources/RepoPrompt/Infrastructure/Persistence/
  • Tests/RepoPromptTests/AgentMode/Transcript/
  • Tests/RepoPromptTests/Persistence/

Acceptance criteria

  • Instrumentation reports write count/bytes per session update for tool-heavy sessions.
  • Findings confirm or refute full-history write amplification with bounded numbers.
  • If confirmed, updates to a session of N turns cost O(delta) or otherwise demonstrably bounded work.
  • On-disk compatibility is preserved or migration is documented.

Interlinks

Part of #406. Related: #403.


Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agent-modeAgent Mode runtime and interfacebugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions