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(provider-acp): preserve Grok answers after early task completion - #32229
When an unpolled Grok background command finishes before the root prompt settles, T3 queues a continuation without any native wake output. That empty run replaces the child's completed answer in the delegated result, so its parent receives Child task completed without an assistant result. A later native answer does not repair the already published result.
Require the existing assistant-output/completed-tool evidence predicate when offering a continuation from finalization or a late task mutation. Keep the unreported completion pending until the native wake arrives, using the existing bounded idle-session retention. The real wake still creates and completes its own turn.
Extend the existing early-completion and staggered-completion cases to cover reportless notices, reasoning-only traffic, duplicate completions, native answer delivery, and release of pending work after the wake.
Scope and approval
This is a focused exception for an obvious result-loss bug in an established workflow. The production change is confined to the ACP adapter's continuation eligibility and retention. Grok is the only production flavor enabling this continuation path; no client, contract, prompt, or product default changes are needed.
I checked related PR diffs, including #32109 (commands keeping the root running), #17779 (native subagent lifetime), #21877 (nested follow-ups), and #21094 (native subagent wait_all/will_wake). They address different cases and do not remove this reportless command continuation.
Verification
Windows, Node 26.12.1, local frozen-lockfile dependencies; base 32a0531748c44b25072d7495ce0b9bd7e9450a87.
From apps/server:
vp test run src/orchestration-v2/Adapters/AcpAdapterV2.test.ts -t "retains early Grok" --maxWorkers 1
Before: 2 failed, 92 skipped.
Both failed: a task completion without native wake output must not replace the root answer
expected continuation requests length 0, got 1.
After: 2 passed, 92 skipped.
vp test run src/orchestration-v2/Adapters/AcpAdapterV2.test.ts -t "retains early Grok|staggered pre-settle completion" --maxWorkers 1
After the final test assertions: 3 passed, 91 skipped.
vp run check:changed --concurrency 1 was attempted. It stalled before the check stages in the ignored-file git ls-files junction scan described in #32023. I stopped that retained session and ran every exact selected stage serially; the wrapper itself is not claimed passed.
Selected ACP adapter and context-budget files: 96 tests passed.
vp test run --passWithNoTests src/orchestration-v2/Adapters/AcpAdapterV2.test.ts src/provider/AgentContextBudget.test.ts --maxWorkers 1
vp test run src/orchestration-v2/testkit/GrokReplayFixtures.integration.test.ts --maxWorkers 1
vp test run src/orchestration-v2/DelegatedCompletionDelivery.test.ts --maxWorkers 1
Actual integrated reproduction used the production T3 CLI with a fresh temporary home, authenticated HTTP/WebSocket RPC, the real Grok adapter and a deterministic ACP subprocess. A parent called T3's real MCP delegate_task; the child sent its background task completion before settling its root answer. The parent's real MCP task_status read the published result, then a network gate released a later native wake. Both runs used byte-identical verifier/fixture scripts; observations came from persisted projections over the real WebSocket connection.
node %TEMP%/slot8-22865-e2e.mjs baseline
published summary: Child task completed without an assistant result.
child runs: 1 completed, 2 completed, 3 completed
child answers: EARLY_SUCCESS_DONE, LATE_NATIVE_ANSWER
node %TEMP%/slot8-22865-e2e.mjs fixed
published summary: EARLY_SUCCESS_DONE
child runs: 1 completed, 2 completed
child answers: EARLY_SUCCESS_DONE, LATE_NATIVE_ANSWER
Each CLI used an explicit isolated --base-dir, loopback port, and private bootstrap FD. Both captured server PIDs were stopped in finally. The fixture launches Node directly with a per-provider preload and imports the shipping client's 15-second PING_TIMEOUT; no lifecycle timeout was changed. This verifies the production service/protocol path with deterministic Grok wire traffic, not a live paid Grok turn or UI. The direct Node fixture's separate skill-discovery inspect probe was unavailable; the ACP turn handshake completed.
Implemented with OpenAI GPT-6 via the Codex harness.
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Macroscope's review found this PR approvable — The change preserves early Grok task answers by waiting for substantive wake output before starting a continuation and retaining pending completion state. Its effects are confined to existing ACP lifecycle handling, with no product-default or permission changes.
You can add or adjust custom eligibility rules. Learn more.
No actionable comments were generated in the recent review.
Walkthrough
The ACP adapter now requires qualifying wake evidence and no running background tasks before offering a continuation. Background task completion notices alone do not count as pending work. Tests cover completion notices, reasoning, and assistant output.
Changes: Background continuation gating
Layer / File(s)
Summary
Continuation offer and pending-work checks packages/provider-acp/src/server/adapter.ts
Continuation offers require qualifying wake evidence and no running background tasks. Completed task IDs no longer make background work pending by themselves.
Tests verify that task-completion notices and reasoning alone do not offer a continuation. Assistant output offers one, and the continuation turn receives that output and clears pending work.
sequenceDiagram
participant BackgroundTask
participant ACPAdapter
participant AssistantOutput
BackgroundTask->>ACPAdapter: Send task-completion notice
ACPAdapter->>ACPAdapter: Keep work pending without offering continuation
AssistantOutput->>ACPAdapter: Provide qualifying wake evidence
ACPAdapter->>ACPAdapter: Offer continuation when no background tasks are running
Loading
Suggested labels:bugfix
Suggested reviewers:juliusmarminge
Merge Risk: Minimal · up to b9f88
No actionable merge-blocking risk is established for the background-command completion change.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title clearly describes the Grok answer-loss fix.
Description check
The description includes the problem, change, scope justification, and detailed verification results. It also states the verification limits and identifies the model and harness.
Linked Issues check
[#22865] The adapter requires native wake evidence before it offers a continuation and retains unreported completions while waiting. The changed tests cover early and staggered completions, reasoning-…
Out of Scope Changes check
[#22865] The adapter changes address continuation eligibility and retention. The test changes cover the same background-completion behavior. No unrelated changes are evident.
Full details: Linked Issues check
Explanation
[#22865] The adapter requires native wake evidence before it offers a continuation and retains unreported completions while waiting. The changed tests cover early and staggered completions, reasoning-only traffic, duplicate notices, native answer delivery, and pending-work release. The reported integrated reproduction shows that the fixed task_status publishes the root answer instead of the empty-result placeholder.
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; 4 remain after this review.
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:S10-29 changed lines (additions + deletions).vouch:unvouchedPR author is not yet trusted in the VOUCHED list.
2 participants
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.
Problem
When an unpolled Grok background command finishes before the root prompt settles, T3 queues a continuation without any native wake output. That empty run replaces the child's completed answer in the delegated result, so its parent receives
Child task completed without an assistant result.A later native answer does not repair the already published result.Fixes #22865.
Change
Require the existing assistant-output/completed-tool evidence predicate when offering a continuation from finalization or a late task mutation. Keep the unreported completion pending until the native wake arrives, using the existing bounded idle-session retention. The real wake still creates and completes its own turn.
Extend the existing early-completion and staggered-completion cases to cover reportless notices, reasoning-only traffic, duplicate completions, native answer delivery, and release of pending work after the wake.
Scope and approval
This is a focused exception for an obvious result-loss bug in an established workflow. The production change is confined to the ACP adapter's continuation eligibility and retention. Grok is the only production flavor enabling this continuation path; no client, contract, prompt, or product default changes are needed.
I checked related PR diffs, including #32109 (commands keeping the root running), #17779 (native subagent lifetime), #21877 (nested follow-ups), and #21094 (native subagent wait_all/will_wake). They address different cases and do not remove this reportless command continuation.
Verification
Windows, Node 26.12.1, local frozen-lockfile dependencies; base
32a0531748c44b25072d7495ce0b9bd7e9450a87.From
apps/server:vp run check:changed --concurrency 1was attempted. It stalled before the check stages in the ignored-filegit ls-filesjunction scan described in #32023. I stopped that retained session and ran every exact selected stage serially; the wrapper itself is not claimed passed.RAYON_NUM_THREADS=1and tests used one worker.Exact selected commands
From the repository root:
From
apps/server:Standalone verifier, native ACP fixture, and reproduction steps.
Actual integrated reproduction used the production T3 CLI with a fresh temporary home, authenticated HTTP/WebSocket RPC, the real Grok adapter and a deterministic ACP subprocess. A parent called T3's real MCP
delegate_task; the child sent its background task completion before settling its root answer. The parent's real MCPtask_statusread the published result, then a network gate released a later native wake. Both runs used byte-identical verifier/fixture scripts; observations came from persisted projections over the real WebSocket connection.Each CLI used an explicit isolated
--base-dir, loopback port, and private bootstrap FD. Both captured server PIDs were stopped infinally. The fixture launches Node directly with a per-provider preload and imports the shipping client's 15-secondPING_TIMEOUT; no lifecycle timeout was changed. This verifies the production service/protocol path with deterministic Grok wire traffic, not a live paid Grok turn or UI. The direct Node fixture's separate skill-discoveryinspectprobe was unavailable; the ACP turn handshake completed.Implemented with OpenAI GPT-6 via the Codex harness.