Skip to content

Simplify saved sessions and context compaction - #608

Merged
fazxes merged 34 commits into
mainfrom
fazxes/session-conversation-compaction
Sep 4, 2026
Merged

Simplify saved sessions and context compaction#608
fazxes merged 34 commits into
mainfrom
fazxes/session-conversation-compaction

Conversation

@fazxes

@fazxes fazxes commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Save native conversation history in one append-only JSONL file with separate metadata and tool-result artifacts, replacing the old cache, pointer, and generation writers.
  • Convert older saved chats once on writable resume, preserving their summaries, retained messages, and available tool-result bytes.
  • Use one checkpoint transaction for automatic and manual compaction: automatic compaction continues the turn; manual compaction stops.
  • Summarize older context while retaining complete recent chat and tool exchanges, including their result bodies after restart.
  • Target 10% summary and 5% recent context, allowing an oversized newest exchange to remain intact when it fits the model's usable window.
  • Use the currently selected model and provider credentials for compaction.
  • Allow model requests up to 120 seconds for response headers while preserving cancellation and existing request deadlines.
  • Save completed in-flight work before the checkpoint without replaying its effects or duplicating conversation records.
  • Avoid duplicating a completed turn when a queued follow-up starts before its finalization event is processed.
  • Recover one provider context overflow even after an earlier compaction in the same turn.
  • Keep the full transcript available while sending the summary and retained recent context to the model.
  • Keep explicit recovery separate from fresh prompts, including queued prompts and persistent-child work.
  • Keep interrupted chats discoverable after a torn final record or a checkpoint before the first turn finishes.
  • Refresh the session list without rescanning it on every page operation.

@fazxes fazxes added the type: improvement Improves existing user-facing behavior label Sep 3, 2026
@fazxes
fazxes force-pushed the fazxes/session-conversation-compaction branch 2 times, most recently from a7f2d1d to de5b9bd Compare September 3, 2026 06:34
@fazxes
fazxes marked this pull request as ready for review September 3, 2026 10:16
@fazxes
fazxes marked this pull request as draft September 3, 2026 10:39
@fazxes
fazxes marked this pull request as ready for review September 3, 2026 10:58
@fazxes
fazxes marked this pull request as draft September 3, 2026 16:19
@fazxes
fazxes marked this pull request as ready for review September 3, 2026 17:03
Release the in-process session mutex before js-host snapshot commits, and update CLI coverage to use direct schema-v4 session fixtures instead of deleted cache files.
Prepare one durable history turn across TUI, CLI, ACP, and subagents. Externalize committed and synthetic tool results, store relative image locators, and persist the first derived session title.
Include the verified tool-results directory in the bounded active-session descriptor budget.
Cover JSONL tail repair, incomplete-turn recovery, and fail-closed committed corruption instead of deleted authority and watermark transactions.
Keep portable relative image locators in converted JSONL while resolving the returned live session state exactly once.
Wait for events.jsonl instead of the removed checkpoint cache before inspecting a persisted failed tool result.
Persist permission feedback and command replay references with tool results, preserve rich usage snapshots in usage-v2.json, and move E2E oracles to their current owners.
Keep typed tool results, turn summaries, and file evidence intact across conversation-log reloads. Materialize resume history on the first frame and remove assertions for retired cache and watermark files.
Apply active conversation transitions directly, compact oversized tool arguments through a bounded semantic projection, and preserve renamed metadata. Update recovery and stress fixtures to exercise the current conversation format.
- Compact and replay a request once when the provider reports context exhaustion.
- Reserve requested summary output inside the compactor context window.
- Keep the pending user prompt after compacted history.
Assert the bounded capacity failure and single tool effect when request serialization is unavailable.
Remove the remaining full-state and cache-backed paths. Older sessions now convert once on writable resume, and optional artifact and recovery stores stay lazy until needed.
@fazxes
fazxes force-pushed the fazxes/session-conversation-compaction branch from 1b6970f to 2e638c5 Compare September 3, 2026 22:10
@fazxes
fazxes marked this pull request as draft September 3, 2026 22:23
@fazxes
fazxes marked this pull request as ready for review September 4, 2026 01:55
@fazxes
fazxes merged commit a0aff4d into main Sep 4, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: improvement Improves existing user-facing behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant