Skip to content

feat(agent): natively resume prior session on cloud resume - #2896

Merged
tatoalo merged 2 commits into
mainfrom
fix/modal-vm-failures
Jun 25, 2026
Merged

feat(agent): natively resume prior session on cloud resume#2896
tatoalo merged 2 commits into
mainfrom
fix/modal-vm-failures

Conversation

@tatoalo

@tatoalo tatoalo commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Problem

we used to resume restored context by flattening the prior conversation into a markdown summary and replaying it as a synthetic You are resuming a previous conversation… prompt. That is lossy (token-budget truncation, tool results clipped) and the agent continued from a recap rather than the real thread.

Changes

Resume the real session instead of replaying a summary

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 196ea73.

@greptile-apps

greptile-apps Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(agent): natively resume prior sessi..." | Re-trigger Greptile

Comment thread packages/agent/src/sagas/resume-saga.test.ts
@tatoalo
tatoalo force-pushed the fix/modal-vm-failures branch from 919aa0e to 72e2235 Compare June 24, 2026 12:51
@tatoalo
tatoalo marked this pull request as ready for review June 24, 2026 13:06
@greptile-apps

greptile-apps Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "feat(agent): natively resume prior sessi..." | Re-trigger Greptile

Comment thread packages/agent/src/server/agent-server.ts
Cloud task resumes restored conversation context by flattening the prior
log into a summary blob and replaying it as a synthetic prompt. Instead,
recover the prior Claude session id from the run_started notification,
hydrate its JSONL (warm from a filesystem snapshot, or rebuilt from the
log), and resumeSession so the SDK continues the real conversation. The
new user message is then a plain continuation. The summary path remains
as a last-resort fallback.

Reuse the already-loaded resume conversation when hydrating the JSONL so
the prior run's log is not fetched twice, and share the post-prompt turn
handling between the native and summary resume paths.
@tatoalo
tatoalo force-pushed the fix/modal-vm-failures branch from 72e2235 to 86cda4c Compare June 24, 2026 13:13
@tatoalo
tatoalo requested a review from a team June 24, 2026 13:28
@tatoalo
tatoalo requested a review from skoob13 June 25, 2026 10:48

@skoob13 skoob13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, PostHog AI is unblocked:love_letter:

: [
{
type: "text",
text: "Continue from where you left off. The user is waiting for your response.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a case when we need a resume message?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old plimbing is still needed for the fallback path where native resume is unavailable, for example no prior session id, JSONL hydration failed. Kinda defensive but still worth keeping for the moment imho

@tatoalo
tatoalo merged commit dfc8729 into main Jun 25, 2026
23 checks passed
@tatoalo
tatoalo deleted the fix/modal-vm-failures branch June 25, 2026 11:08
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.

2 participants