fix(acp): cancel the wait for the previous agent turn when the step ends

Merged
JX
2d ago
+29-4
  • Cancel the previous-turn wait when the waiting ACP step ends, preserving its original cancellation reason and clearing the grace timer.
  • Reuse the existing abort helper in packages/acp/src/executor.ts. Add a scripted-agent regression and an ACP patch changeset.

Issue

Fixes #1760

Verified

Ran it locally: yes

  • Built CLI with Chromium and a scripted ACP agent: the same probe fails on main and passes with this change.
  • Standalone reproduction, installed with npm ci --ignore-scripts --no-audit --no-fund then npm test, using published e2e@0.23.0 and @e2e-dev/acp@0.1.2, then replacing only ACP with the corrected local tarball.
main / affected releasethis branch
Exit 1: MODEL_PROVIDER_FAILED replaces STEP_TIMEOUTExit 0: the same STEP_TIMEOUT object is preserved
Affected: received=MODEL_PROVIDER_FAILED sameReason=false
Corrected: received=STEP_TIMEOUT sameReason=true

The runner already enforces the outer agent.act deadline. This fixes the executor promise that continues waiting after cancellation. Verified on macOS arm64 with Node 24.22.2; no model account is needed.