openclaw - ✅(Solved) Fix [Bug]: /compact in Control UI (webchat) creates new session instead of compacting [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#53646Fetched 2026-04-08 01:25:24
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
closed ×1commented ×1cross-referenced ×1locked ×1

After upgrading to 2026.3.13, /compact in the Control UI now behaves like /new — it creates a fresh session with no context, no summary, no memory flush. All prior conversation is lost.

/compact in the Control UI (webchat) used to work correctly on 2026.2.14 — it would summarize context, do memory flush, and keep the session going with compacted history.

For reference, /compact still works correctly when triggered via Telegram on the same session — so the compaction logic itself is fine, only the Control UI path is broken.

Root Cause

After upgrading to 2026.3.13, /compact in the Control UI now behaves like /new — it creates a fresh session with no context, no summary, no memory flush. All prior conversation is lost.

/compact in the Control UI (webchat) used to work correctly on 2026.2.14 — it would summarize context, do memory flush, and keep the session going with compacted history.

For reference, /compact still works correctly when triggered via Telegram on the same session — so the compaction logic itself is fine, only the Control UI path is broken.

Fix Action

Workaround

Trigger /compact from Telegram on the same session key. Compaction executes correctly there.

Not tested on 2026.3.22/3.23 yet.

PR fix notes

PR #53843: Webchat: handle bare /compact as session compaction

Description (problem / solution / changelog)

Summary

  • intercept bare /compact in the shared chat UI view model instead of sending it as a normal chat turn
  • add transport support for sessions.compact in the macOS Control UI transport
  • cover the new behavior in ChatViewModelTests

Testing

  • git diff --check
  • attempted swift test --filter ChatViewModelTests in apps/shared/OpenClawKit, but the host only has Swift 6.0.3 while the package requires tools 6.2.0

Fixes

  • Fixes #53646

Changed files

  • apps/ios/Sources/Chat/IOSGatewayChatTransport.swift (modified, +7/-0)
  • apps/macos/Sources/OpenClaw/WebChatSwiftUI.swift (modified, +7/-0)
  • apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatTransport.swift (modified, +8/-0)
  • apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift (modified, +45/-0)
  • apps/shared/OpenClawKit/Tests/OpenClawKitTests/ChatViewModelTests.swift (modified, +118/-0)
RAW_BUFFERClick to expand / collapse

Summary

After upgrading to 2026.3.13, /compact in the Control UI now behaves like /new — it creates a fresh session with no context, no summary, no memory flush. All prior conversation is lost.

/compact in the Control UI (webchat) used to work correctly on 2026.2.14 — it would summarize context, do memory flush, and keep the session going with compacted history.

For reference, /compact still works correctly when triggered via Telegram on the same session — so the compaction logic itself is fine, only the Control UI path is broken.

Environment

  • OpenClaw: 2026.3.13 (61d171a)
  • Previous version (working): 2026.2.14
  • OS: Windows 11 (x64)
  • Node: v22.20.0
  • Gateway: local loopback

Steps to Reproduce

  1. Have a long-running session in Control UI (webchat) with significant context
  2. Type /compact
  3. Observe: new session is created, all prior context gone

Expected Behavior

Compaction: summarize older history, keep recent messages, preserve session continuity (as it worked on 2026.2.14).

Actual Behavior

  • Creates a new session (new sessionId)
  • No compaction summary
  • No memory flush
  • All prior context lost
  • Identical to /new or /reset

Workaround

Trigger /compact from Telegram on the same session key. Compaction executes correctly there.

Not tested on 2026.3.22/3.23 yet.

extent analysis

Fix Plan

To fix the issue with /compact in the Control UI, we need to update the handling of the /compact command to preserve the session context and perform the compaction logic as intended.

Here are the steps:

  • Check the compact function in the Control UI code to ensure it's calling the correct compaction logic.
  • Verify that the session ID is being preserved when the /compact command is triggered from the Control UI.
  • Update the code to handle the /compact command in the Control UI to match the working implementation in the Telegram path.

Example code snippet:

// Assuming a function handleCompact() that performs the compaction logic
app.post('/compact', (req, res) => {
  const sessionId = req.body.sessionId;
  // Preserve the session ID and context
  const session = getSession(sessionId);
  if (session) {
    // Call the compaction logic
    handleCompact(session);
    // Return the compacted session
    res.json({ session: session });
  } else {
    // Handle the case where the session is not found
    res.status(404).json({ error: 'Session not found' });
  }
});

Verification

To verify that the fix worked, follow these steps:

  • Test the /compact command in the Control UI with a long-running session.
  • Check that the session context is preserved and the compaction summary is displayed.
  • Verify that the session ID remains the same after compaction.

Extra Tips

  • Review the changelog for the 2026.3.13 version to see if there were any changes that might have affected the /compact command.
  • Test the fix on other versions, such as 2026.3.22 and 2026.3.23, to ensure it works as expected.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING