Skip to content

Conversation

@cruzanstx
Copy link

@cruzanstx cruzanstx commented Jan 9, 2026

Summary

  • Fixes "Process exited unexpectedly" errors when mobile users send messages during parallel Task subagent execution with worktrees
  • Adds session path tracking so sessions created in different directories validate correctly

Problem

When running parallel Task subagents (e.g., via worktrees):

  1. Claude Code may create new sessions in different working directories (worktrees)
  2. Happy CLI detects the new session ID but validates it against the original path
  3. Session file exists in the worktree path, not the original path
  4. Validation fails and crashes

Solution

Track the path where each session was created and use that path for validation:

  • Added SessionInfo interface with id and path fields
  • sessionId getter maintains backward compatibility
  • claudeCheckSession() now accepts optional sessionPath parameter
  • Extract cwd from SDKSystemMessage during session discovery

Test plan

  • yarn build passes
  • yarn test passes (102 tests)
  • Manual test: Start Happy CLI, run parallel tasks in worktrees, verify no crashes

Generated with Claude Code via Happy

Co-Authored-By: Claude [email protected]
Co-Authored-By: Codex [email protected]

…l tasks

When Task subagents create sessions in different directories (e.g., worktrees),
the session validation now uses the path where the session was created rather
than the current working directory.

This fixes "Process exited unexpectedly" errors when mobile users send messages
during parallel prompt execution with worktrees.

Changes:
- Add SessionInfo interface with id and path fields
- Update Session class to track session creation path
- Modify claudeCheckSession to accept optional sessionPath
- Extract cwd from SDKSystemMessage for session tracking
@cruzanstx
Copy link
Author

Manual Test Results

Tested the session path tracking fix with parallel Task subagents.

Test Scenario

  1. Started Happy CLI session in a test directory
  2. Ran 3 parallel Task agents with subagent_type=Explore targeting different directories
  3. Monitored for "Process exited unexpectedly" errors

Results

Check Result
Session started in test directory Pass
Parallel Task subagents executed Pass
No "Process exited unexpectedly" errors Pass
Session remained running after parallel tasks Pass
Session responsive (ready state) Pass

Verification

  • Confirmed session_id and cwd are properly tracked in logs
  • Session hook correctly captured session path
  • No crashes observed when sending messages during parallel task execution

The fix successfully prevents crashes when Task subagents operate in different working directories.

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.

1 participant