feat: history truncation + lazy message rehydrate (daemon + IPC)#9295
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96701cd10c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Contributor
Author
|
Addressed in #9315 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add server-side text and tool result truncation to history responses, plus a new
message_content_requestendpoint for on-demand full-content retrieval. This is the daemon/IPC foundation for client-side memory optimization — clients can now request lightweight history (truncated text, no heavy payloads) and fetch full content only when needed.Implementation
IPC Contract Changes (
ipc-contract/sessions.ts)HistoryRequest: AddedmaxTextCharsandmaxToolResultCharsoptional fields for server-side truncationMessageContentRequest/MessageContentResponsemessage types for single-message full-content fetchHistoryResponsemessages: AddedwasTruncatedboolean flagServer Handler (
handlers/sessions.ts)handleHistoryRequest: Applies text truncation (maxTextChars) and tool result truncation (maxToolResultChars) with… [truncated]suffix. SetswasTruncated: trueon affected messages.handleMessageContentRequest: Fetches a single message by ID from the conversation store, parses and renders its content (text + tool calls), returns full untruncated data.Data Layer (
conversation-store.ts)getMessageById(messageId, conversationId?)for efficient single-message lookup.Generated Types (
IPCContractGenerated.swift)IPCMessageContentRequest,IPCMessageContentResponse,IPCMessageContentResponseToolCall, plus updatedIPCHistoryRequestandIPCHistoryResponseMessage.Files Changed
assistant/src/daemon/ipc-contract/sessions.ts— contract extensionsassistant/src/daemon/handlers/sessions.ts— truncation logic + new handlerassistant/src/memory/conversation-store.ts—getMessageByIdassistant/src/daemon/ipc-contract-inventory.json— new message typesassistant/src/__tests__/ipc-snapshot.test.ts— test fixturesassistant/src/__tests__/__snapshots__/ipc-snapshot.test.ts.snap— updated snapshotsclients/shared/IPC/Generated/IPCContractGenerated.swift— regenerated Swift typesTesting
history_requestwithmaxTextChars: 100→ verify truncated text withwasTruncated: truemessage_content_requestfor a truncated message → verify full content returnedContext
Part of the text-retention-fix blitz (epic #9272). M1 of 5 milestones.
Closes #9273
🤖 Generated with Claude Code