Skip to content

feat(sessions): show progress bar and elapsed time while compacting#3330

Draft
tatoalo wants to merge 3 commits into
mainfrom
posthog-code/compaction-progress-bar
Draft

feat(sessions): show progress bar and elapsed time while compacting#3330
tatoalo wants to merge 3 commits into
mainfrom
posthog-code/compaction-progress-bar

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Problem

When the agent compacts the conversation, the "Compacting conversation history..." row showed only a static spinner. That gives no signal about whether compaction is making progress or has stalled, and since compaction can take 10-20s on long sessions a motionless spinner tends to read as frozen.

Changes

  • Add an indeterminate progress bar and a live elapsed-time counter to the in-flight compaction row (StatusNotificationView), keeping the existing spinner.
  • Compaction is a single streaming summarization call with no measurable percent-complete (the SDK only reports pre-compaction token count at the boundary, i.e. after the fact). So rather than fabricate a percentage, the bar is intentionally indeterminate (constant motion, so it never reads as frozen) and the elapsed timer carries the concrete progress signal.
  • The bar reuses the existing section-loading swoop keyframe, is tinted to match the row's blue accent, and degrades to a static filled track under prefers-reduced-motion.

Note on approach: I checked how other harnesses handle this before picking indeterminate. No coding-agent harness ships a verified real-percentage compaction bar — the Claude Code CLI request for one (anthropics/claude-code#30115) was closed "not planned", and the "percentage" it references from the desktop app has no documented mechanism. An indeterminate bar plus a real elapsed timer is both honest and directly fixes the "appears frozen" complaint.

How did you test this?

  • biome check on the changed files: clean, no fixes needed.
  • turbo typecheck --filter=@posthog/ui: passes.
  • Not visually verified in the running app (headless environment) — the change is UI-only and reuses existing primitives (the formatDuration timer helper and the section-loading keyframe).

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

The in-flight compaction row previously showed only a static spinner, so there was no signal about whether compaction was progressing or stuck.

Add an indeterminate progress bar plus a live elapsed-time counter to the "Compacting conversation history..." row. Compaction is a single streaming summarization call with no measurable percentage, so the bar is intentionally indeterminate (constant motion, so it never reads as frozen) and the elapsed timer carries the concrete progress signal. The bar reuses the existing section-loading keyframe, is tinted to match the row's blue accent, and falls back to a static track under prefers-reduced-motion.

Generated-By: PostHog Code
Task-Id: 1a85695f-6d34-4d9c-9a78-c2f4c836acf4
@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 a218439.

tatoalo added 2 commits July 10, 2026 09:45
React Doctor flagged the indeterminate compaction bar for using role="progressbar" on a div (prefer-tag-over-role). The bar is decorative — its status is already carried by the visible "Compacting conversation history..." text and the spinner — so drop the role/aria-label and mark it aria-hidden, matching the existing quill-section-loading swoop loader and the decorative spinners in the same feature.

Generated-By: PostHog Code
Task-Id: 1a85695f-6d34-4d9c-9a78-c2f4c836acf4
Drop the redundant startedAt state cell and the inert [startedAt] effect dependency; capture the start time inside the effect and run it once on mount, matching the sibling GeneratingIndicator's timer. Behavior is unchanged.

Generated-By: PostHog Code
Task-Id: 1a85695f-6d34-4d9c-9a78-c2f4c836acf4
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