Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
|
Important Review skippedAuto reviews are disabled on this repository. To trigger a review, include ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.Add a .trivyignore file to your project to customize which findings Trivy reports. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant refactoring of the message compaction system within the AI SDK harness. The core change involves transitioning to a segment-based approach for managing message history, which is supported by new, dedicated modules for compaction planning, policy, and orchestration. This centralization and modularization aim to improve the reliability and maintainability of context management. The changes are integrated across the TUI and headless runtimes, ensuring a unified and more robust handling of conversation context, including a new guard against empty message lists for model calls. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a significant and well-executed refactoring of the compaction system. By moving to a segment-based state in MessageHistory and extracting logic into dedicated compaction-policy, compaction-planner, and compaction-orchestrator modules, you've greatly improved modularity, reduced code duplication between the TUI and headless runners, and enhanced overall maintainability. The changes are robust and the addition of related tests is appreciated. My feedback includes a few minor suggestions to improve code clarity by removing some redundant checks in the new compaction-orchestrator.ts file.
There was a problem hiding this comment.
2 issues found across 18 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/tui/src/agent-tui.ts">
<violation number="1" location="packages/tui/src/agent-tui.ts:567">
P2: Rejected compaction can produce duplicate “Compaction skipped” notices because `onRejected` is invoked twice in the apply-ready path.</violation>
</file>
<file name="packages/harness/src/message-history.ts">
<violation number="1" location="packages/harness/src/message-history.ts:1216">
P1: `getMaterializedMessages()` is called on every iteration of the `every()` callback, re-cloning all messages each time. Cache the result in a local variable before the prefix checks to avoid O(N×M) allocations.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 618d458d80
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Summary
Verification
Summary by cubic
Ships the segment-first compaction system and a shared compaction orchestrator across
@ai-sdk-tool/harness,@ai-sdk-tool/tui, and@ai-sdk-tool/headless. This unifies compaction, improves reliability and performance, and updates the API and docs.Refactors
MessageHistoryto segment-based state and prepared artifacts (PreparedCompaction.segments,baseSegmentIds).CompactionOrchestratorwith shared cores (applyReadyCompactionCore,blockAtHardLimitCore,discardAllJobsCore); TUI and headless now use it.shouldStartSpeculativeCompaction,needsCompactionFromUsage,isAtHardContextLimitFromUsage,getRecommendedMaxOutputTokens,calculateCompactionSplitIndex).Migration
compactionConfigwithcompaction(usesummarizeFn,speculativeStartRatio).getMessagesForLLM();getMessagesForLLMAsync()remains as a deprecated wrapper.prepareSpeculativeCompaction()+applyPreparedCompaction()orcompact()(no fire-and-forget).messages/summaries/baseSummaryIdstosegments/baseSegmentIds.Written for commit c6e628f. Summary will update on new commits.