fix(subagents): honor approval-pause in every tool-watchdog mode#1473
Merged
Conversation
A human-approval block sets ToolActivityUpdate.SuspendsInactivityWatchdog to pause the per-tool-call liveness clock. The tool-liveness change gated that suspend behind ResetMode != WallClock, so in WallClock mode (every opaque tool) the approval-pause was ignored and the wall-clock budget kept ticking through a human approval — killing a healthy tool mid-approval whenever the human took longer than the budget. Honor SuspendsInactivityWatchdog in all modes. Ordinary per-item resets stay mode-gated in ApplyItemReset (WallClock still cannot be kept alive by its own output); only the explicit human-block signal is now universal. The pre-existing suspend test only exercised Flat mode, which is why the WallClock regression slipped through. Replaces it with a mode-matrix Theory across Flat/FirstItemOnly/WallClock; the WallClock case fails on the old guard and passes with the fix. Step 1 of #1472. Relates to #1467.
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.
What & why
Step 1 of #1472. A human-approval block sets
ToolActivityUpdate.SuspendsInactivityWatchdogto pause the per-tool-call liveness clock. The tool-liveness change gated that suspend behindResetMode != WallClock, so in WallClock mode (every opaque tool) the approval-pause was ignored and the wall-clock budget kept ticking through a human approval — killing a healthy tool mid-approval whenever the human took longer than the budget.This violated the intended contract: approvals (and any explicit human-block) must never affect the wall clock, in any mode.
The fix
StreamingToolWatchdog.cs— honorSuspendsInactivityWatchdogin all modes. The change is surgical: ordinary per-item resets stay mode-gated inApplyItemReset(WallClock still can't be kept alive by its own streamed output); only the explicit human-block signal is now universal.Test (the part that lets it regress)
The pre-existing suspend test only exercised
Flatmode — which is exactly why the WallClock regression slipped through. Replaced with a mode-matrix[Theory]acrossFlat/FirstItemOnly/WallClock. Verified as a real guard:wallClockFAILS,flat/firstItemOnlypassScope
Targeted fix only — deliberately small and shippable independent of the larger consolidation. The structural rework (collapse to one actor-owned watchdog, approval-as-state, kill the silent
?? Opaque, etc.) is tracked as the migration steps in #1472.Relates to #1467. Part of #1472.