refactor(acp): extract provider prompt executor - #778
Merged
Conversation
Codex ReviewVerdict: mergeable No actionable findings. Summary: Static inspection found no concrete merge-blocking defect introduced by this pull request. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
AcpRuntimestill owned the external provider prompt lifecycle: provider probes, prompt/update racing, acceptance timing, supersession checks, notification routing, terminal capture, and provider-specific outcome normalization. This kept provider execution state coupled to application finalization and made the runtime harder to reason about and test independently.Proposed change
AcpProviderPromptExecutor.execute(...)as the owner of one external provider prompt attempt;AcpRuntimeresponsible for durable application effects after an authoritative stop: Context, Artifact, events, usage reconciliation, and auto-compaction.Scope and non-goals
provider-prompt-executor.ts: 188; Runtime additions/deletions: 116/172), within the approved 550-line ceiling.runtime.tsdecreases from 2,941 to 2,885 lines on the current base.Ownership and sequence
stopped,superseded, ornot-dispatchedoutcome.stoppedoutcome.Probe helpers and best-effort reporting remain fail-open. Prompt rejection is preserved, cancellation is issued once, late prompt settlement is consumed, and identity tokens prevent an older attempt from removing a replacement probe for the same provider Session ID.
Acceptance criteria and validation
All listed checks ran after the last material edit and again after rebasing onto
dce57c9(fix(acp): correct Claude refusal attribution (#774)).npm test -- --run src/main/acp/provider-prompt-executor.test.ts ...provider-turn-adapter.test.ts ...claude-turn-adapter.test.ts ...codex-turn-adapter.test.ts ...opencode-turn-adapter.test.ts ...session-interaction-owner.test.ts ...session-update-projector.test.tssrc/main/acp/runtime.test.tsimpact patternssrc/main/acp/runtime-coordinator.test.tscontinuation patternnpm run typecheck:nodeThe Test Impact Set includes the changed owner, all provider-turn adapters, terminal interaction ownership, notification projection, the Runtime consumer, and coordinator acceptance timing. Renderer/Web typecheck and platform/E2E lanes are excluded locally because no renderer, preload, shared IPC, persistence, platform process, or public interface changed; PR Gate remains authoritative for its selected lanes.
Review focus
handleSessionUpdateprojection;stoppedoutcomes.Uncovered risks