Skip to content

Conversation

@jamesrochabrun
Copy link
Owner

Problem

PR #28 introduced a crash when updating working directory at runtime. The configuration = oldValue line in the catch block caused infinite recursion:

  1. didSet triggers when workingDirectory changes
  2. Backend creation fails (hypothetically)
  3. Catch block sets configuration = oldValue
  4. This triggers didSet again with different workingDirectory
  5. Infinite loop → stack overflow → EXC_BAD_ACCESS

Solution

Added re-entrance guard using isUpdatingConfiguration flag:

  • Prevents didSet from re-entering during configuration updates
  • Safely allows restoration of old configuration on error
  • Maintains consistent state between configuration and backend

Testing

  • ✅ Claw launches without crash
  • ✅ Working directory changes work correctly
  • ✅ Debug information displays properly
  • ✅ No UX changes or performance impact

Related

🤖 Generated with Claude Code

…updates

Problem:
- Setting configuration = oldValue in catch block caused infinite recursion
- This was exposed when workingDirectory check was added to didSet
- Led to crash with EXC_BAD_ACCESS during app launch

Solution:
- Added isUpdatingConfiguration flag to prevent re-entrance
- Now safely restores old configuration on backend creation failure
- Maintains consistent state between configuration and backend

This makes configuration updates bulletproof and future-proof for any backend type.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@jamesrochabrun jamesrochabrun merged commit de63ddc into main Nov 5, 2025
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.

2 participants