Skip to content

feat(desktop): split model switch and session summary - #96034

Merged
trunk-io[bot] merged 2 commits into
masterfrom
posthog/model-switch-and-session-summary
Sep 7, 2026
Merged

feat(desktop): split model switch and session summary#96034
trunk-io[bot] merged 2 commits into
masterfrom
posthog/model-switch-and-session-summary

Conversation

@puemos

@puemos puemos commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Problem

A person who changes the model mid-session can get stuck in the dialog. Pressing "Copy summary" starts an AI turn that takes about 35 seconds, and while it runs the dialog disables Cancel and Switch now, and ignores Esc.

  • One dialog carries three jobs: the cache cost, the model change, and handing work to another agent.
  • "Copy summary" reads as a clipboard action, so nothing warns that a long job starts.
  • The progress and the result appear in the side-question card, which sits behind the modal that started them.
  • The card titles itself with the raw internal prompt, and nothing clears it when the switch ends.

Changes

Before After
dialog-before dialog-after

The before shot is a Storybook render of the dialog on master. The after shot is the running app.

  • The dialog asks one question: the models, the cost to resend history, then Cancel or Switch model.
  • Esc and Cancel stay live. Only the switch request holds the dialog, and it resolves in about a second.
  • The task overflow menu gains "Summarize for another agent", which works whether or not a model changes.
  • The summary lands in its own panel above the composer. It reports the wait, then offers Copy and Dismiss.
  • The panel says "Writing the summary. About 30 seconds." while it runs, because the wait surprised people.
  • "Stop waiting" drops the summary. The panel says the agent still finishes the turn, because nothing can cancel it.
  • The dialog no longer requests the task's cost so far. The context indicator beside the model selector already shows it.

Note

The dialog no longer says that a switch keeps the same environment, files and permissions. That line was reviewed and cut as clutter, so the belief that a model switch restarts a task stays uncorrected in the product.

Mechanical: the side-question store gains a kind, a label and an askedAt, so one store can back two surfaces. SideQuestionCard drops its Radix imports. The panel splits into a container and a view, which is what makes the view storyable.

How did you test this code?

The person driving this work ran the desktop app and exercised the dialog and the panel. This agent did not run the app.

Automated, by this agent:

  • SessionSummaryPanel.test.tsx is new. It catches a panel that renders for a prior task run, and a dismiss that leaves the entry in the store.
  • SideQuestionCard.test.tsx gains one case: a summary entry must render nothing in the /btw card. Without it, both surfaces would show the same answer.
  • ModelSwitchCacheDialog.test.tsx loses the task-cost cases with the feature, and follows the renamed button.
  • Storybook stories cover the panel's writing, written, long and failed states, and the dialog's four pricing cases.

Not checked: every desktop suite outside features/sessions, and the e2e suite. CI reports those.

Automatic notifications

  • Publish to changelog?

Docs update

None. No documented workflow changes.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code (Opus 5) in PostHog Desktop, directed step by step over one session.

Skills invoked: /writing-tests, /writing-pr-descriptions, /writing-user-facing-copy, /writing-code-comments, posthog:building-html-canvases, posthog:validating-and-publishing-canvases.

Decisions across the session:

  • An abort path for the summary was planned and dropped. The agent protocol has no cancel for a side question, so a "Stop" that claimed to abort would have been false.
  • The task's cost so far first got a skeleton row to stop a layout jump, then came out entirely once the duplicate on the context indicator was confirmed.
  • The dialog's facts row went through pills and a single-line layout. Both failed: quill Badge is a 10px scale, which made the model names the smallest text in the dialog, and the one-line version wrapped and stranded the price at the real dialog width.
  • Related open PR: fix(desktop): stop offering a handoff summary on a finished cloud run #95056 hardens sessionSupportsSideQuestion for finished cloud runs. It touches no file in this PR, and the new menu item consumes that same guard.

Public artifact: this work started from a report of one person's session. No part of that material reaches this PR. The screenshots show the agent's own test session, the sample summary in the Storybook story is invented, and no customer data, ticket or log is quoted.

The mid-session model switch dialog carried three jobs: the cache cost, the
model change, and handing work to another agent. Writing a handoff summary
took about 35 seconds, and while it ran the dialog disabled both buttons,
refused to close, and showed its progress in a card behind the modal.

The dialog now states one decision. The summary is its own task action with
its own panel above the composer, which reports progress, offers copy and
dismiss, and clears itself.

Generated-By: PostHog Desktop
Task-Id: 26078657-9de2-461d-acbf-931d591f92f6
@puemos puemos self-assigned this Sep 7, 2026
@trunk-io

trunk-io Bot commented Sep 7, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

React Doctor found 3 issues in 2 files · 3 warnings.

3 warnings

packages/ui/src/features/sessions/components/ModelSwitchCacheDialog.tsx

packages/ui/src/features/sessions/components/SessionView.tsx

Reviewed by React Doctor for commit a6bd604.

@puemos puemos added desktop-skip-backend-check Skip the check that blocks desktop and backend changes in one PR stamphog Request AI approval (no full review) labels Sep 7, 2026
@github-actions github-actions Bot added the feature/desktop Feature Tag: Desktop label Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

Trunk lane — non-backend lane (fe:product:desktop)

This PR is assigned to the non-backend lane (fe:product:desktop). It does not run backend Python tests and may merge in parallel with PRs in other lanes.

@hosthog

hosthog Bot commented Sep 7, 2026

Copy link
Copy Markdown

HostHog preview — posthog-desktop-web

The previews for this PR have been torn down and no longer serve.

@puemos
puemos marked this pull request as ready for review September 7, 2026 12:31
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team September 7, 2026 12:33

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved.

Contained desktop UI refactor by an owning-team author with no touches to auth, billing, data models, public APIs, or CI/build tooling; tests were updated/added for the new components and no unresolved review concerns exist.

  • Author wrote 66% of the modified lines and has 49 merged PRs in these paths (familiarity MODERATE).
  • 14 of the 14 changed files are governed by products/desktop/AGENT_APPROVALS.md.
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 684L, 11F substantive, 838L/14F incl. docs/generated/snapshots — within ceiling
tier T1-agent / T1d-complex (838L, 14F, single-area, feat)
stamphog 2.0.0b4 .stamphog/policy.yml @ a6bd604 · reviewed head a6bd604

@puemos

puemos commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

/trunk merge

@trunk-io
trunk-io Bot merged commit 9811d19 into master Sep 7, 2026
333 of 340 checks passed
@trunk-io
trunk-io Bot deleted the posthog/model-switch-and-session-summary branch September 7, 2026 13:14
@deployment-status-posthog

deployment-status-posthog Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-09-07 13:35 UTC Run
prod-us ✅ Deployed 2026-09-07 13:48 UTC Run
prod-eu ✅ Deployed 2026-09-07 13:50 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop-skip-backend-check Skip the check that blocks desktop and backend changes in one PR feature/desktop Feature Tag: Desktop stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant