fix(acpx): record turn activity at the moment a stop fires

Sandbox claude_local runs that hit the 4h wall-clock backstop report
acpLastEventAgeMs at finalization, after the timeout's cancel. Some agents
emit closing events on cancel, so a turn that went silent minutes into the
run can look active at its deadline.

Record, for a stopped turn, the last-event age and the oldest pending
tool's age as of the stop, plus the pending tools' closed ACP ToolKind
labels. The server forwards these to run-failure diagnostics only when
they are non-negative integers or closed enum labels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PaperclipandClaude Opus 5.5 committed 2026-10-12 12:15:30 +00:00
1 parent b189f586d2
commit eed2d27675
6 files changed
+175 -6

No files matched your search

+9
View File
@@ -638,6 +638,15 @@ pending. Recent events do not prove useful progress. These fields contain only
numbers and a boolean, never tool names, IDs, arguments, or event content, and
do not change the execution timeout, cancellation, or recovery policy.
A stopped turn (wall-clock timeout or operator stop) also records
`acpLastEventAgeAtStopMs` and `acpOldestPendingToolAgeAtStopMs`, measured at the
moment the stop fired. A cancel can make the agent emit closing events, so the
finalization age alone cannot separate a turn that went silent long before its
deadline from one that was still working. When tools are pending,
`acpPendingToolKinds` lists their ACP tool kinds as a sorted, comma-separated
string drawn only from the closed ACP `ToolKind` enum plus `unknown`; the
server drops the field if any other value appears.
ACP and legacy OpenCode results retain the adapter's resolved wall-clock timeout as
`adapterExecutionTimeout` in the instance run result. Finalization uses it for
`effectiveTimeoutSec`, `timeoutSource`, and `timeoutConfigured`. Sources are