Skip to content

feat(session): read-time truncation only, preserve full history on disk#791

Open
seanly wants to merge 1 commit intosipeed:mainfrom
seanly:feat/session-history-read-time-truncation
Open

feat(session): read-time truncation only, preserve full history on disk#791
seanly wants to merge 1 commit intosipeed:mainfrom
seanly:feat/session-history-read-time-truncation

Conversation

@seanly
Copy link

@seanly seanly commented Feb 25, 2026

  • summarizeSession: remove TruncateHistory(sessionKey, 4); keep SetSummary + Save
  • forceCompression: return []providers.Message, do not SetHistory/Save; use for retry only
  • runLLMIteration: use forceCompression return value for BuildMessages, no disk write
  • Process: cap history to maxHistoryMessagesForContext (200) before BuildMessages
  • session.Save: optional cap at maxStoredMessages (500) when writing to limit file size

Session file no longer truncated to last 4 messages; truncation happens only when building context for the LLM (read-time), aligning with OpenClaw behavior.

📝 Description

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

🔗 Related Issue

📚 Technical Context (Skip for Docs)

  • Reference URL:
  • Reasoning:

🧪 Test Environment

  • Hardware:
  • OS:
  • Model/Provider:
  • Channels:

📸 Evidence (Optional)

Click to view Logs/Screenshots

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.

- summarizeSession: remove TruncateHistory(sessionKey, 4); keep SetSummary + Save
- forceCompression: return []providers.Message, do not SetHistory/Save; use for retry only
- runLLMIteration: use forceCompression return value for BuildMessages, no disk write
- Process: cap history to maxHistoryMessagesForContext (200) before BuildMessages
- session.Save: optional cap at maxStoredMessages (500) when writing to limit file size

Session file no longer truncated to last 4 messages; truncation happens only when
building context for the LLM (read-time), aligning with OpenClaw behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
@seanly seanly force-pushed the feat/session-history-read-time-truncation branch from d82fb06 to 95847bc Compare February 25, 2026 23:52
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