Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

feat(sessions): opt-in clear history and continue from plan - #3961

Closed
igennova wants to merge 3 commits into
PostHog:mainfrom
igennova:fix/704
Closed

feat(sessions): opt-in clear history and continue from plan#3961
igennova wants to merge 3 commits into
PostHog:mainfrom
igennova:fix/704

Conversation

@igennova

@igennova igennova commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds an opt-in plan-approval option: Approve, clear history, and continue from plan (alongside normal approve + reject).
  • Normal Approve and proceed keeps planning history unchanged.

Why

Issue PostHog/posthog#76316: after planning, clearing context before implementation avoids auto-compaction mid-implementation. This mirrors Claude’s clear-on-plan-accept flow as an explicit choice.

How it works

  1. User is in plan mode → agent proposes a plan
  2. Plan card offers:
    • Approve and proceed (keep context)
    • Approve, clear history, and continue from plan (fresh context)
    • Reject with feedback
  3. Clear path: resolve permission UI locally → cancelPromptcreateNewLocalSession with plan seed
  4. Same task / title; new task run (chat thread resets by design)

Video

Screen.Recording.2026-07-15.at.12.49.28.PM.mov

Test plan

  • Enter plan mode → create a plan → confirm new clear option appears
  • Approve and proceed → planning history remains; agent continues in-place
  • Clear history and continue → chat resets; agent starts from plan only; no ACP/error toast
  • Mode selector still applies on clear path (e.g. auto / acceptEdits)
  • Reject with feedback still works
  • Error-state New Session still reconnects in place (resetSession unchanged)
  • Unit tests: planContinuation, sessionServicePlanContinuation, permission-options, PlanApprovalSelector

Replaces #3462 , which was closed during the pre-migration PR sweep (not actually stale).

Closes PostHog#704. Lets users discard planning context and start a fresh local
run seeded with the approved plan, without changing resetSession.
@trunk-io

trunk-io Bot commented Jul 29, 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

@charlesvien

Copy link
Copy Markdown
Member

Hey @igennova, we've migrated this repo into the PostHog/posthog monorepo, so this PR needs to be recreated there.

Easiest path: check out the monorepo and run the /porting-code-prs skill with your agent pointed at this PR. It has the migration guide and path remappings baked in so the agent doesn't have to figure them out. You don't strictly need it though, just asking your agent to port the PR works fine too.

Shout if you get stuck.

@charlesvien charlesvien added the stale No recent changes to PR label Aug 3, 2026
@charlesvien charlesvien closed this Aug 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

stale No recent changes to PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants