Skip to content

feat(app): add compact ui#15578

Merged
adamdotdevin merged 2 commits intoanomalyco:devfrom
neriousy:feat/compaction-ui
Mar 1, 2026
Merged

feat(app): add compact ui#15578
adamdotdevin merged 2 commits intoanomalyco:devfrom
neriousy:feat/compaction-ui

Conversation

@neriousy
Copy link
Contributor

@neriousy neriousy commented Mar 1, 2026

Issue for this PR

Closes #15576

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds compaction logic matching the tui

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

  1. Open session
  2. Run /compact

Screenshots / recordings

2026-03-01.15-06-06.mp4

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found several related PRs but no exact duplicates of PR #15578. Here are the potentially related PRs:

Most Related:

These recent PRs are working on similar compaction-related features and should be reviewed for any potential conflicts or integration points with PR #15578's compact UI addition.

The other results are older compaction-related PRs (from 2022-2024) that provide context on the existing compaction system but are unlikely to be duplicates.

@neriousy neriousy force-pushed the feat/compaction-ui branch from 1eb17dc to 0897ab2 Compare March 1, 2026 14:05
@neriousy neriousy marked this pull request as ready for review March 1, 2026 14:06
Copilot AI review requested due to automatic review settings March 1, 2026 14:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a visual compaction indicator to the web/desktop UI, matching the existing TUI (terminal UI) behavior. When /compact is run in a session, a horizontal divider with the label "History compacted" (localized) is now shown in the session turn UI.

Changes:

  • Added CompactionPartDisplay component registered to PART_MAPPING["compaction"] with matching CSS styles for a centered divider label
  • Added compaction memo and rendering in SessionTurn to show the compaction indicator after the user message content, using the Part component
  • Refactored working and SessionRetry.show from isLastUserMessage() to the new active() memo which more precisely identifies which turn currently has an in-progress assistant message
  • Added the ui.messagePart.compaction i18n key across all 17 supported locales

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/ui/src/components/message-part.tsx Adds CompactionPartDisplay component registered in PART_MAPPING
packages/ui/src/components/message-part.css Adds styles for the compaction divider component
packages/ui/src/components/session-turn.tsx Adds pending/active memos, compaction memo, renders the Part component for compaction; replaces isLastUserMessage with active()
packages/ui/src/components/session-turn.css Adds styles for the session-turn-compaction slot
packages/ui/src/i18n/en.ts + 16 locale files Adds ui.messagePart.compaction translation key to all locales
Comments suppressed due to low confidence (1)

packages/ui/src/components/session-turn.tsx:214

  • The lastUserMessageID memo (lines 203–212) and isLastUserMessage memo (line 214) are now dead code: both working and SessionRetry.show were switched from isLastUserMessage() to active(), so neither memo is referenced anywhere in the component anymore. These unused memos create unnecessary reactive overhead and add confusion. They should be removed along with the props.lastUserMessageID prop (or at least the memos), since the prop itself is also now unused internally.
  const lastUserMessageID = createMemo(() => {
    if (props.lastUserMessageID) return props.lastUserMessageID

    const messages = allMessages() ?? emptyMessages
    for (let i = messages.length - 1; i >= 0; i--) {
      const msg = messages[i]
      if (msg?.role === "user") return msg.id
    }
    return undefined
  })

  const isLastUserMessage = createMemo(() => props.messageID === lastUserMessageID())

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@neriousy neriousy requested a review from adamdotdevin as a code owner March 1, 2026 14:20
@adamdotdevin adamdotdevin merged commit b15fb21 into anomalyco:dev Mar 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web/Desktop does not show compaction UI

3 participants