Skip to content

feat(agent): mirror session transcript into the workspace for snapshot resumes#3333

Draft
tatoalo wants to merge 2 commits into
mainfrom
posthog-code/mirror-session-transcript
Draft

feat(agent): mirror session transcript into the workspace for snapshot resumes#3333
tatoalo wants to merge 2 commits into
mainfrom
posthog-code/mirror-session-transcript

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Problem

Directory resume snapshots only cover the workspace (/tmp/workspace), not the Claude config dir where the native session transcript lives. So every snapshot resume is "cold": the transcript is rebuilt from the task's concatenated S3 notification logs, which cannot see in-session compaction and resurrects history the session had already compacted away. That is the mechanism behind resumes starting at 90%+ context (and, before #3331, exceeding the window outright and permanently failing the task with "Prompt is too long").

Follow-up to #3331.

Changes

  • After each completed turn, mirror the native session JSONL into <workspace>/.posthog/claude-sessions/ (same workspace state dir already used for skill bundles), so it rides along in directory snapshots. No-op for adapters without a Claude transcript on disk (codex).
  • On resume, when the native transcript is missing, restore it from the workspace mirror before falling back to S3-log hydration. The resume is then warm and reuses the real, compacted session.

…t resumes

Directory resume snapshots only cover the workspace, so the native
Claude transcript in the config dir never survives a resume and every
resume falls back to lossy S3-log hydration, which discards prior
in-session compaction. Mirror the transcript into .posthog/ after each
turn and restore it before the warm check on resume, so snapshot
resumes reuse the real session.

Generated-By: PostHog Code
Task-Id: c6065620-5694-4478-a20a-fec4ccde8f1a
@trunk-io

trunk-io Bot commented Jul 10, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 2e5a26b.

Generated-By: PostHog Code
Task-Id: c6065620-5694-4478-a20a-fec4ccde8f1a
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.

1 participant