Skip to content

fix: prevent state detection fallthrough bypassing toolCall/thinking timeouts - #6

Open
bughunt8 wants to merge 2 commits into
SammyLin:masterfrom
bughunt8:fix/agent-state-fallthrough
Open

fix: prevent state detection fallthrough bypassing toolCall/thinking timeouts#6
bughunt8 wants to merge 2 commits into
SammyLin:masterfrom
bughunt8:fix/agent-state-fallthrough

Conversation

@bughunt8

@bughunt8 bughunt8 commented Apr 8, 2026

Copy link
Copy Markdown

Summary

Fixes #4 — Agent state detection timeouts for toolCall (60s) and thinking (120s) were being bypassed by the generic assistant role 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. toolCall or thinking), the content-type-specific timeout checks would fail for older entries, but execution would fall through to the generic data.Message.Role == "assistant" && secondsAgo < 300 check, which would catch it and return "working" — effectively making the tighter timeouts dead code.

Fix

Added a continue statement 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

bughunt8 and others added 2 commits April 8, 2026 11:47
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Agent state detection timeouts bypassed by fallthrough to generic assistant role check

1 participant