-
Notifications
You must be signed in to change notification settings - Fork 237
Open
Description
Description
When the agent presents options in the UI and the user takes time to respond, the system sometimes appears to auto-continue as if an option was already selected. The user sees the conversation as "finished", then suddenly work appears as if they had responded.
Root Cause Analysis
After investigating the logs and source code, this appears to be a race condition in session resume with message queue timing:
Flow:
- Agent presents options, finishes responding, waits for user input via message queue
- Daemon respawns the Claude process (seen repeatedly in logs with
--resume) - New process:
- Resumes from existing Claude Code session
- Calls
await opts.nextMessage()atclaudeRemote.ts:85 - If message exists in queue or arrives during respawn, processes immediately
Contributing Factors:
SESSION_READY_TIMEOUT_MS = 10000(10s) insync.tssends messages after timeout even if not "ready"- Multiple
--resumeflags in daemon logs showing frequent process restarts - No idempotency checks between message queue and session resume state
Relevant Files:
src/claude/claudeRemote.ts:85- Initial message wait on resumesrc/api/apiSession.ts:140-144- Message callback processinginfrastructure/happy-web/sources/sync/sync.ts:287-289- Ready timeout logic
Reproduction
- Start a conversation with an agent
- Get to a point where options are presented
- Wait ~10+ seconds before selecting an option
- Observe if work continues without explicit user selection
Potential Fixes
- Add a "waiting for user input" lock state when options are presented
- Implement idempotency/deduplication between session resume and pending messages
- Clear message queue on session resume to prevent stale message processing
- Add confirmation mechanism before processing option selections after delay
Metadata
Metadata
Assignees
Labels
No labels