Skip to content

Infinite git loop when Android messages trigger 'only prompt commands' error #105

@nelsonblaha

Description

@nelsonblaha

Infinite git loop when Android messages trigger "only prompt commands" error

Summary

Happy conversations become permanently unresponsive due to an infinite git rev-parse --is-inside-work-tree loop when certain Android messages trigger the error: "only prompt commands are supported in streaming mode"

Environment

  • Happy Version: 0.12.0
  • Claude Code Version: 2.0.76
  • Node Version: v20.19.4 / v20.19.5
  • Machines: Confirmed on 2 separate Ubuntu servers (nelnet, paul)
  • Platform: Both machines running Happy daemon with remote sessions

Steps to Reproduce

  1. Start a Happy conversation on a remote machine with daemon
  2. Send messages from Android Happy app (with bypassPermissions mode)
  3. Eventually, a message triggers error: "only prompt commands are supported in streaming mode"
  4. Git status checks begin running continuously
  5. Conversation becomes permanently unresponsive

Note: Not ALL Android messages trigger this - appears to be specific message types or conditions that aren't yet fully understood. Some conversations receive many Android messages successfully before hitting the bug.

Expected Behavior

  • Error should be logged with details
  • Conversation should either recover or show clear error to user
  • Git repository detection should have timeout/retry limits

Actual Behavior

  1. Error occurs instantly (duration_ms: 0, duration_api_ms: 0 - no API call attempted)
  2. Claude process exits: [claudeRemote] Result received, exiting claudeRemote
  3. Git status checks begin: Shell command request: git rev-parse --is-inside-work-tree
  4. Checks continue indefinitely (observed 200-1,880+ iterations)
  5. Conversation permanently stuck - no recovery possible
  6. Error logged as empty object: [remote]: launch error {}

Evidence

Nelnet Session Logs

Session PID 1400265 - Triggered by message "Check current test status":

[13:35:17.694] [RESULT] Error during execution 
  "errors": [
    "only prompt commands are supported in streaming mode"
  ]
[13:35:17.695] [claudeRemote] Result received, exiting claudeRemote
[13:35:17.741] [SOCKET] [UPDATE] Received update
[13:35:17.872] Shell command request: git rev-parse --is-inside-work-tree
[13:35:27.212] Shell command request: git rev-parse --is-inside-work-tree
[13:35:33.133] Shell command request: git rev-parse --is-inside-work-tree
... (continues indefinitely)

Message metadata:

{
  "role": "user",
  "content": {
    "type": "text",
    "text": "Check current test status"
  },
  "meta": {
    "sentFrom": "android",
    "permissionMode": "bypassPermissions"
  }
}

Affected Sessions

Nelnet:

  • PID 747315: 218 git loop iterations
  • PID 1400265: 41 git loop iterations

Paul:

  • PID 727898: 1,880 git loop iterations
  • PID 1342166: Git loop behavior confirmed

Impact

  • Severity: High - Conversations permanently unusable once hit
  • Frequency: Affects any conversation receiving Android messages
  • Workaround: Kill stuck process (kill <PID>) and restart conversation
  • Data Loss: Conversation state lost when killed

Root Cause Analysis

Two separate bugs compounding:

  1. Primary: "only prompt commands are supported in streaming mode" error when processing certain Android messages

    • Error occurs before any Claude API call
    • Appears related to Android + bypass permissions mode combination
    • Error details not logged (shows as empty object {})
  2. Secondary: Git repository detection loop doesn't terminate on error

    • When claude_remote_launcher fails or exits, git checks continue
    • No timeout or retry limit implemented
    • Process cleanup doesn't kill background tasks

Recommended Fixes

  1. Fix "only prompt commands" error - Identify why certain Android messages fail
  2. Terminate git loop on launcher failure - Stop all background tasks when process exits
  3. Add timeout for git checks - Maximum iterations/time limit
  4. Better error logging - Log actual error details instead of {}
  5. User notification - Show error in UI when conversation can't recover
  6. Process cleanup - Ensure child processes terminate properly

Additional Context

Full investigation details: /home/ben/happy-conversation-bug-report.md

Log locations:

  • Nelnet: ~/.happy/logs/2025-12-27-05-59-39-pid-1400265.log
  • Paul: ~/.happy/logs/2025-12-22-07-59-51-pid-727898.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions