Skip to content

feat(protocol)!: runs report a compacting activity (CX4) - #252

Merged
lg2m merged 6 commits into
mainfrom
feat/eng-997-cx4-compacting-activity
Oct 7, 2026
Merged

lg2m merged 6 commits into
mainfrom
feat/eng-997-cx4-compacting-activity

Conversation

@lg2m

@lg2m lg2m commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

CX4: runs report a compacting activity

Spec: docs/plans/compaction.md § CX4 · Linear: ENG-997 (plan ENG-992)

Why

A compaction takes long enough that clients showing "waiting for model" look stuck (compaction plan Goal 4).

What changed

  • RunActivity::Compacting (compacting on the wire); PROTOCOL_VERSION 30 → 31.
  • Compaction runs (between-run, /compact, in-run) publish Compacting once before their first provider poll, and never publish their summarizer's provider activity.
  • Prompt runs publish Compacting just before calling the in-run compactor. Their next turn reports WaitingForProvider as usual.
  • Reducer (qq-client): run_finished clears the activity only if it belongs to the run that finished. An in-run compaction run finishes while its prompt run still holds the session, and this used to blank the prompt run's label.
  • TUI: the composer rule and the sidebar row read "compacting context".
  • Fixtures: v31 wire and headless goldens are added; v30 stays as decode-only. Harbor traces are regenerated (only protocol_version changed).

Verification

  • cargo test --workspace: 2 101 passed, 13 ignored. Minimal qq-provider profile: 210 passed. fmt and clippy -D warnings are clean.
  • New tests:
    • a_compaction_run_reports_compacting_and_nothing_else (between-run events, plus a snapshot taken mid-compaction)
    • in-run order assertions in one_run_spanning_several_windows…
    • reducer test compacting_is_the_activity_until_the_run_moves_on_and_an_inner_compaction_keeps_it (fails without the guard)
    • a TUI composer-rule assertion
    • goldens event_run_activity_compacting and completed_after_in_run_compaction

Compatibility

Performance

One extra durable event per compaction run and per in-run compaction step. That is negligible next to a summarizer turn.

lg2m added a commit that referenced this pull request Oct 5, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T16:52:22.801156Z db2dc21 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 6ac0bd7d55

ℹ️ 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 thread crates/qq-tui/src/view/tests.rs Resolved
Comment thread crates/qq-tui/src/view/sidebar.rs Resolved

@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: 7e87d40430

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

lg2m added a commit that referenced this pull request Oct 7, 2026
…un as Server

- InRunCompactionError gains Persistence: start, activity, cancellation
  read and commit failures. The loop fails the prompt run as Server with
  the store error instead of Policy advising /compact.
- The in-run compaction headless golden reports the compaction run's
  summaries as compacting, as the runtime does; a runtime test pins it.

Addresses the second Codex review on #252.

Refs: ENG-992, ENG-997

@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: 323a03841c

ℹ️ 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 thread docs/plans/progress/compaction.md Resolved
Comment thread crates/qq-client/src/state/reduce.rs Resolved
lg2m added a commit that referenced this pull request Oct 7, 2026
…ction

- Every compaction start (between-run, manual, in-run) writes the
  compacting activity and its event with RunStarted, so a cancel before
  the first poll cannot leave a started run unreported. The separate
  appends (and their failure path) are gone.
- The shared reducer applies an activity only for the session's active
  run; the inner compaction's own report no longer replaces the prompt's.
- The in-run headless golden includes SessionCompacted, as the runtime
  emits it.
- Ledger: merged slices read Shipped (sha).

Addresses the third Codex review on #252.

Refs: ENG-992, ENG-997

@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: dec3f5f007

ℹ️ 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 thread docs/plans/compaction.md Resolved
lg2m added a commit that referenced this pull request Oct 7, 2026
…n sequence

- transcript.md § Run Activity: the activity is the active run's; an inner
  compaction does not replace or end it; `compacting context` outranks a
  stale rail tail; compaction draws no transcript row. layout.md links it.
- The Harbor compaction trace now carries the real v31 in-run sequence
  (prompt compacting, compaction run start/activity/finish,
  SessionCompacted under that run, prompt waiting again).

Addresses the fourth Codex review on #252.

Refs: ENG-992, ENG-997
lg2m added 6 commits October 7, 2026 09:45
Clients now see that a session is compacting instead of a stale "waiting
for model" for the minutes a summarizer takes.

- RunActivity::Compacting (`compacting`); PROTOCOL_VERSION 30 -> 31.
- Every compaction run, between-run or in-run, publishes Compacting once
  before its first provider poll, and never its summarizer's provider
  activity. A prompt run publishes Compacting before it asks the in-run
  compactor; its next turn reports WaitingForProvider as usual.
- The shared reducer clears activity on run_finished only for the run that
  finished, so an in-run compaction no longer blanks its prompt run's label.
- TUI composer rule and sidebar read "compacting context".
- v31 wire and headless goldens (new: event_run_activity_compacting,
  completed_after_in_run_compaction); v30 retained decode-only; Harbor
  traces regenerated.

BREAKING CHANGE: protocol 31. Older clients reject the new activity value
and refuse a 31 server, as for every protocol bump. No store schema change.

Refs: ENG-992, ENG-997
…r failure kind

- The sidebar shows "compacting context" over a stale streamed tail; the
  sessions golden pins it.
- A failed compacting-activity write settles the in-run compaction as a
  Server failure, not ProviderResponse; the provider was never polled.
- The in-run activity write no longer wakes settlement waiters.

Refs: ENG-992, ENG-997
…un as Server

- InRunCompactionError gains Persistence: start, activity, cancellation
  read and commit failures. The loop fails the prompt run as Server with
  the store error instead of Policy advising /compact.
- The in-run compaction headless golden reports the compaction run's
  summaries as compacting, as the runtime does; a runtime test pins it.

Addresses the second Codex review on #252.

Refs: ENG-992, ENG-997
…ction

- Every compaction start (between-run, manual, in-run) writes the
  compacting activity and its event with RunStarted, so a cancel before
  the first poll cannot leave a started run unreported. The separate
  appends (and their failure path) are gone.
- The shared reducer applies an activity only for the session's active
  run; the inner compaction's own report no longer replaces the prompt's.
- The in-run headless golden includes SessionCompacted, as the runtime
  emits it.
- Ledger: merged slices read Shipped (sha).

Addresses the third Codex review on #252.

Refs: ENG-992, ENG-997
…n sequence

- transcript.md § Run Activity: the activity is the active run's; an inner
  compaction does not replace or end it; `compacting context` outranks a
  stale rail tail; compaction draws no transcript row. layout.md links it.
- The Harbor compaction trace now carries the real v31 in-run sequence
  (prompt compacting, compaction run start/activity/finish,
  SessionCompacted under that run, prompt waiting again).

Addresses the fourth Codex review on #252.

Refs: ENG-992, ENG-997
@lg2m
lg2m force-pushed the feat/eng-997-cx4-compacting-activity branch from eec5c28 to db2dc21 Compare October 7, 2026 16:48
@lg2m
lg2m merged commit fc3205d into main Oct 7, 2026
6 checks passed
@lg2m
lg2m deleted the feat/eng-997-cx4-compacting-activity branch October 7, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant