Symptom: a gateway turn shows "任务运行中..." forever and 停止 has no effect,
even though the OpenClaw gateway has already finished (ACP_HTTP_CONNECTION_CLOSED).
- T3: add a hard deadline to the running-handle poll branch so the client no
longer polls forever when tasks.get keeps returning "running". Budget is
derived from taskLoadClass (10/30/60min, aligned with the bridge) + grace;
on timeout the turn lands in a recoverable `interrupted` state
(OPENCLAW_RUN_POLL_TIMEOUT) prompting the user to resend.
- T4: make 停止 locally authoritative — capture the association, mark the turn
aborted immediately (clears pending, exits the poll loop), then fire
tasks.cancel best-effort so a hung/failed cancel RPC can't block termination.
- T6: applyGatewayChatFailureInternal now authoritatively clears the pending
flag (both raw + normalized key). Previously runOpenClawGatewayQueuedTurnInternal's
finally never cleared it, leaving "error shown but still running".
Full cross-repo analysis + remaining TODO in docs/cases/06.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>