fix: prevent state detection fallthrough bypassing toolCall/thinking timeouts - #6
Open
bughunt8 wants to merge 2 commits into
Open
fix: prevent state detection fallthrough bypassing toolCall/thinking timeouts#6bughunt8 wants to merge 2 commits into
bughunt8 wants to merge 2 commits into
Conversation
…timeouts After checking content types (toolCall, thinking) with their specific timeouts, add a 'continue' to skip the generic assistant role check. Without this, the 300s assistant timeout always overrides the more granular 60s (toolCall) and 120s (thinking) timeouts. Fixes SammyLin#4 Co-Authored-By: Oz <oz-agent@warp.dev>
Verifies that toolCall and thinking states correctly expire at their respective timeouts (60s and 120s) instead of falling through to the generic 300s assistant role check. Also tests positive cases and edge cases (no sessions, plain text assistant messages). Co-Authored-By: Oz <oz-agent@warp.dev>
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.
Summary
Fixes #4 — Agent state detection timeouts for
toolCall(60s) andthinking(120s) were being bypassed by the genericassistantrole check (300s) due to missing control flow after content-type checks.Problem
In
getAgentState(), when the most recent session entry is an assistant message with structured content (e.g.toolCallorthinking), the content-type-specific timeout checks would fail for older entries, but execution would fall through to the genericdata.Message.Role == "assistant" && secondsAgo < 300check, which would catch it and return"working"— effectively making the tighter timeouts dead code.Fix
Added a
continuestatement after the content-type loop so that when content types are successfully parsed and checked, the generic role check is skipped. The generic check now only applies to assistant messages whose content is not a structured array (i.e. plain text responses).Warp conversation
Co-Authored-By: Oz oz-agent@warp.dev