Summary#
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
packages/provider-acp/src/server/adapter.ts,apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.tshandleSessionUpdateskips 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.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.tsEstimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
_metafields, which these changes do not confirm as fixed.Suggested reviewers:
juliusmarmingeMerge Risk:
Minimal · up to
24b51Wake 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
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
#42568as 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)
592d9d2a-7156-4bd0-a379-7c666e5855cfReviewing files that changed from the base of the PR and between 6632511cd8f523c2b9439272d776fb44c2bce110 and 24b51027425b7c65478e047a457edb86aacd6c32.
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.tsapps/server/src/orchestration-v2/Adapters/GrokAdapterV2.test.tsapps/server/src/orchestration-v2/testkit/fixtures/index.tsapps/server/src/orchestration-v2/testkit/fixtures/simple/grok_output.tspackages/provider-acp/src/server/adapter.tspackages/provider-grok/src/server/adapter.tsIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.