Skip to content

feat: /compact — provider compaction + summary banner#107

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

feat: /compact — provider compaction + summary banner#107
harrryyd merged 2 commits into
mainfrom
feat/compact-provider-compaction-summary-banner

Conversation

@harrryyd
Copy link
Copy Markdown
Owner

@harrryyd harrryyd commented Jun 8, 2026

Summary

  • Implements /compact command: provider-level compaction with duration tracking + summary banner
  • Adds active turn guardrails: block /clear, /new, and /compact during generation
  • Adds /new command: archives current thread, creates a new inheriting one
  • Implements /clear + /clear N core context trim infrastructure
  • Adds context trim point divider UI (expand/collapse earlier messages)
  • Implements comment lifecycle: GitHub PR comment authoring UI + fetch/display
  • Adds submit review to GitHub functionality
  • Adds PR diff source handling + RuntimeMode.review toggle
  • Adds token usage bug report for ClaudeAdapter
  • Extends orchestration schemas, projector, and decider with trim point, archive-and-new, and compaction handling
  • Adds provider adapter registry test improvements, VCS driver updates, and WebSocket RPC client updates
  • Adds extensive test coverage across decider, projector, review service, and UI components

Testing

  • Unit tests for decider.contextTrim (1027 lines) covering trim point creation, keepLastNTurns, active turn rejection, idempotent empty trim
  • Unit tests for decider.archiveAndNew (377 lines) covering archive-and-new flow, active turn guard, collision rejection
  • Unit tests for projector (317 lines) and orchestration event effects
  • Unit tests for review service draft flows (275 lines)
  • Unit tests for diff comment panel (224 lines), messages timeline (179+438 lines), composer logic (50+82 lines), session logic (100 lines)
  • Contract orchestration tests extended (488 lines)
  • Provider adapter and service unit tests
  • Not run: E2E integration tests (requires live provider session)
  • Not run: manual verification of summary banner rendering across browser widths

harrryyd added 2 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
@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
@harrryyd harrryyd merged commit b0955e9 into main Jun 8, 2026
5 of 11 checks passed
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: 8955033a19

ℹ️ 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 +1348 to +1350
if (
(itemType === "compaction" || itemType === "context_compaction") &&
"encrypted_content" in (item as Record<string, unknown>)
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 Read the compaction summary from a reachable payload

When /compact succeeds for Codex, this scan reads thread/read turn items, but the generated Codex ThreadItem shape uses type: "contextCompaction" with only an id; the "compaction" / "context_compaction" variants with encrypted_content are response-item shapes, not what parseThreadSnapshot() returns. In practice this leaves summary as "" for every successful compaction, so the new trim summary and banner are never populated.

Useful? React with 👍 / 👎.

Comment on lines +988 to +993
yield* orchestrationEngine.dispatch({
type: "thread.context.trim",
commandId: trimCommandId,
threadId,
summary: compactResult.summary,
createdAt: nowIso,
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 pruning turns created while compacting

After provider compaction finishes, this dispatch trims the current read model with no boundary or keepLastNTurns, while the earlier compact intent does not mark the thread busy. If a user submits and completes a turn during a long compaction, the provider summary was started before that turn but this later trim can still prune the new messages from the UI/read model; record the pre-compaction boundary or block/preserve turns created after compaction starts.

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