You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(acp): preserve Grok context usage on wake replay - #42610
replay wake notification
+ skip context-usage extraction
project wake output
Follow-up to #42568. Wake-buffer replays no longer overwrite a newer live contextUsage snapshot. The Grok end-to-end assertion now uses the recorded provider fixture through OrchestratorV2 and persisted projections.
Evidence
Before: A buffered wake carrying usedTokens: 100 could replace a newer live 200 snapshot during drain. After:AcpAdapterV2 regression test keeps the latest 200; the relevant 178 affected tests pass.
Recorded Grok simple replay fixture passes through the orchestrator and asserts { usedTokens: 22_271, maxTokens: 500_000 } in the persisted provider thread.
Formatting, lint, knip, GraphQL, focused typechecks, and git diff --check pass. check:changed only reports an unrelated duplicate HostProcess import error in apps/desktop/src/preview/BrowserSession.test.ts on the merged upstream commit.
Merge Danger
Door: two-way
Blast Radius: provider-ACP wake replay and Grok replay-fixture coverage. The behavior change is limited to suppressing context extraction for buffered wake replays.
No actionable comments were generated in the recent review.
Walkthrough
ACP wake replays no longer project context usage. Grok resolves the default model’s context window using the session’s current model ID when available. Tests check ACP continuation summaries and Grok projected context usage.
Changes: Provider context usage
Layer / File(s)
Summary
ACP wake replay and usage checks packages/provider-acp/src/server/adapter.ts, apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
ACP wake-buffer drains mark notifications as replays, and handleSessionUpdate skips context-usage projection for those notifications. The test checks that buffered wake processing preserves the latest observed usage and that completed-task summaries use task IDs as command labels.
Grok context window and fixture checks packages/provider-grok/src/server/adapter.ts, apps/server/src/orchestration-v2/Adapters/GrokAdapterV2.test.ts, apps/server/src/orchestration-v2/testkit/fixtures/simple/grok_output.ts, apps/server/src/orchestration-v2/testkit/fixtures/index.ts
The default Grok model selection uses the trimmed session model ID when available. The simple fixture checks for 22,271 used tokens and a 500,000-token maximum. A live metadata replay test was removed.
Wake replay no longer overwrites newer context-usage values, and Grok resolves the default model's context window from the session model ID. No concrete merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(acp): preserve Grok context usage on wake replay" matches the main change. The adapter now skips context-usage extraction for replayed wake notifications, so a buffered wake no longer o…
Description check
The description follows the template's main sections. It has a Summary that explains the change and a Verification section with concrete before/after evidence and the checks that passed. It also notes…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(acp): preserve Grok context usage on wake replay" matches the main change. The adapter now skips context-usage extraction for replayed wake notifications, so a buffered wake no longer overwrites a newer live contextUsage snapshot. The title is a conventional commit with a specific scope and describes the primary fix. The Grok fixture and test-removal changes are secondary.
Full details: Description check
Explanation
The description follows the template's main sections. It has a Summary that explains the change and a Verification section with concrete before/after evidence and the checks that passed. It also notes what could not be verified (check:changed reports an unrelated HostProcess import error). The Problem, Change, and Scope sections are not labeled as in the template. The Scope section does not link an issue (it references #42568 as a follow-up, not as a bug report), and it does not say why no issue is needed. The model/harness line from the template is missing. These gaps are minor, so the description is mostly complete.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:M30-99 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
replay wake notification + skip context-usage extraction project wake outputFollow-up to #42568. Wake-buffer replays no longer overwrite a newer live
contextUsagesnapshot. The Grok end-to-end assertion now uses the recorded provider fixture through OrchestratorV2 and persisted projections.Evidence
usedTokens: 100could replace a newer live200snapshot during drain.After:
AcpAdapterV2regression test keeps the latest200; the relevant 178 affected tests pass.simplereplay fixture passes through the orchestrator and asserts{ usedTokens: 22_271, maxTokens: 500_000 }in the persisted provider thread.git diff --checkpass.check:changedonly reports an unrelated duplicateHostProcessimport error inapps/desktop/src/preview/BrowserSession.test.tson the merged upstream commit.Merge Danger
Door: two-way
Blast Radius: provider-ACP wake replay and Grok replay-fixture coverage. The behavior change is limited to suppressing context extraction for buffered wake replays.