Skip to content

/compact — provider compaction + summary banner#105

Merged
harrryyd merged 1 commit into
mainfrom
feat/compact-provider-compaction-summary-banner
Jun 8, 2026
Merged

/compact — provider compaction + summary banner#105
harrryyd merged 1 commit into
mainfrom
feat/compact-provider-compaction-summary-banner

Conversation

@harrryyd
Copy link
Copy Markdown
Owner

@harrryyd harrryyd commented Jun 8, 2026

Implements /compact: asks the provider to summarize conversation history, then trims context and shows a summary banner.

Changes

  • Add thread.context.compact + thread.context.summarize command/event schemas
  • Add optional summary to ContextTrimPoint and ThreadContextTrimCommand
  • Decider: validate and emit events for compact and summarize
  • ProviderAdapter: add compactThread method (Codex via thread/compact/start RPC, others unsupported)
  • ProviderCommandReactor: two-phase flow — call provider → summarize → trim
  • Composer: /compact parsing, autocomplete registration, dispatch in ChatView
  • ContextSummaryBanner: blue-tinted callout showing Context compacted + summary
  • Summary rendered above trim divider when trim point has summary
  • Fallback: trim proceeds without summary when compaction fails/unsupported

Acceptance criteria

  • ProviderAdapter gains compactThread method
  • CodexSessionRuntime implements via Codex JSON-RPC thread/compact/start
  • thread.context.summarize command + thread.context-summarized event schemas
  • ContextTrimPoint gains optional summary field
  • Two-phase /compact flow: compact → summarize → trim
  • /compact parses in composer
  • ContextSummaryBanner renders above trim divider
  • Fallback: trim proceeds when compaction fails
  • Compaction duration recorded on summary event
  • Tests: contracts, decider, composer parsing

Closes #87

- 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
@github-actions github-actions Bot added the size:L label Jun 8, 2026
Copy link
Copy Markdown

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

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: 721b974621

ℹ️ 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 Avoid displaying encrypted compaction payloads as summaries

When Codex emits a compaction item, the generated schema exposes encrypted_content as the opaque context payload for the provider, not a human-readable summary. Copying that field into summary means the later trim point and ContextSummaryBanner will show users an encrypted/base64-looking blob after a real /compact; if there is no plaintext summary field available, this should be left empty or sourced from an actual readable summary.

Useful? React with 👍 / 👎.

@harrryyd harrryyd merged commit 5811529 into main Jun 8, 2026
4 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/compact — provider compaction + summary banner

1 participant