Skip to content

feat: provider compaction + context trim + archive-and-new + review flow#108

Open
harrryyd wants to merge 3 commits into
mainfrom
feat/compact-provider-compaction-summary-banner
Open

feat: provider compaction + context trim + archive-and-new + review flow#108
harrryyd wants to merge 3 commits into
mainfrom
feat/compact-provider-compaction-summary-banner

Conversation

@harrryyd

@harrryyd harrryyd commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Compaction: /compact command — provider compaction with summary banner context
  • Context trim: /clear + /clear N — core trim infrastructure; expand/collapse trimmed messages behind a divider
  • Archive-and-new: /new — archives current thread and creates a new inheriting one
  • Active-turn guardrails: blocks trim/archive commands while generation is running
  • Review: submit review to GitHub; PR diff source; RuntimeMode.review toggle
  • Comment lifecycle: authoring UI for GitHub PR comments + fetch/display
  • Per-request stream usage: tracks context-window occupancy per stream event
  • Bug report: adds token-usage bug report for ClaudeAdapter

Testing

  • Added comprehensive decider tests for thread.archive-and-new (archiveAndNew), thread.context.trim (contextTrim), and projector
  • Added/updated ClaudeAdapter, CodexAdapter, ProviderService, ProviderAdapterRegistry tests
  • Added ReviewDraftStore and ReviewService (inc. draft) tests; GitVcsDriver tests
  • Added component tests: ContextSummaryBanner, ContextTrimPointDivider, MessagesTimeline
  • Added logic tests: MessagesTimeline.logic, composer slash-command search, session-logic, orchestrationEventEffects
  • Added DiffCommentPanel tests; updated Contracts/orchestration schema tests
  • Not run: manual provider-compaction E2E across all adapter backends

harrryyd added 3 commits June 8, 2026 18:13
- Add thread.context.compact + thread.context.summarize command schemas
- Add thread.context-compacted + thread.context-summarized event schemas
- Add optional summary field to ContextTrimPoint and ThreadContextTrimCommand
- Decider: validate and emit events for compact and summarize commands
- Decider: include summary in trim point when provided via thread.context.trim
- ProviderAdapter: add compactThread method to interface
- CodexSessionRuntime: implement compactThread via thread/compact/start RPC
- Claude/OpenCode/Cursor adapters: return unsupported error for compactThread
- ProviderService: delegate compactThread to adapter
- ProviderCommandReactor: process thread.context.compact — call provider, emit summarize + trim
- Composer: parse /compact, register in autocomplete, dispatch in ChatView
- ContextSummaryBanner component: blue-tinted 'Context compacted' callout
- MessagesTimeline: render summary banner above trim divider when summary present
- Tests: contracts schemas, decider validation, composer parsing
- Capture token usage from message_start/message_delta stream events
- Stop emitting token-usage events from task_progress/task_notification
- Accumulated totals still tracked as totalProcessedTokens for cost
@github-actions github-actions Bot added size:XL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Jun 8, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b9cef7d08

ℹ️ 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".

Comment on lines +1352 to +1354
summary = String(
(item as Record<string, unknown>).encrypted_content ?? "",
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not use encrypted compaction content as the summary

When Codex compaction succeeds, this stores the encrypted_content field as the human-readable summary that is later dispatched into thread.context.trim and rendered in ContextSummaryBanner. The generated Codex schema describes compaction/context_compaction items as encrypted content, not plaintext, so successful /compact runs will persist and display an opaque encrypted blob instead of a readable context summary. Use a plaintext summary source from the provider, or leave the summary empty when only encrypted content is available.

Useful? React with 👍 / 👎.

Comment on lines +1335 to +1336
yield* client
.handleServerNotification("thread/compacted", (_payload) =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid leaking one-shot compaction notification handlers

Each call to compactThread registers another thread/compacted notification handler, but handleServerNotification appends handlers to the client's internal list and this code never removes or reuses them. In a long-lived Codex session, every later /compact will invoke all stale handlers and issue extra thread/read requests, growing linearly with the number of previous compactions. Register a single handler for the runtime or add a cleanup/unsubscribe path for this one-shot wait.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant