feat(agent): mirror session transcript into the workspace for snapshot resumes#3333
Draft
tatoalo wants to merge 2 commits into
Draft
feat(agent): mirror session transcript into the workspace for snapshot resumes#3333tatoalo wants to merge 2 commits into
tatoalo wants to merge 2 commits into
Conversation
…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
|
Merging to
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 |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Generated-By: PostHog Code Task-Id: c6065620-5694-4478-a20a-fec4ccde8f1a
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
<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).warmand reuses the real, compacted session.How did you test this?
prepareNativeResumerestores the transcript from the workspace mirror, reportswarm: true, and never fetches S3 logs.pnpm exec vitest run src/server/agent-server.test.ts src/adapters/claude/session/jsonl-hydration.test.ts— 158 passed, 1 pre-existing failure (sanitizeSessionJsonlwarn-path test) that also fails onmain.Automatic notifications
Created with PostHog Code