Skip to content

fix(embed): make fcntl import conditional for Windows compatibility#868

Open
octo-patch wants to merge 1 commit intovectorize-io:mainfrom
octo-patch:fix/issue-865-windows-fcntl-profile-manager
Open

fix(embed): make fcntl import conditional for Windows compatibility#868
octo-patch wants to merge 1 commit intovectorize-io:mainfrom
octo-patch:fix/issue-865-windows-fcntl-profile-manager

Conversation

@octo-patch
Copy link
Copy Markdown
Contributor

Fixes #865

Problem

hindsight-embed crashes immediately on Windows 11 at import time because profile_manager.py unconditionally imports fcntl, which is a Unix-only stdlib module. This blocks all Windows users from using hindsight-embed (and the OpenClaw plugin that depends on it).

Solution

Guard the import fcntl with if sys.platform != "win32": and wrap both fcntl.flock() calls in the same check. The fix follows the same pattern used in #694 for the Claude Code integration.

On Windows, the file locking step is skipped — the atomic rename() that follows already provides sufficient crash-safety for the single-process metadata writes in _save_metadata().

Testing

  • The conditional import prevents ModuleNotFoundError on Windows at startup.
  • On Unix/macOS the behavior is unchanged: fcntl.flock() is still called for exclusive locking during metadata writes.
  • No new tests added (locking behaviour is OS-specific and not currently unit-tested).

hindsight-embed crashes on Windows at import time because fcntl is a
Unix-only stdlib module. Guard the import with a sys.platform check and
skip flock() calls on Windows — the atomic rename that follows already
provides sufficient safety for single-process use on Windows.

Fixes vectorize-io#865
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.

hindsight-embed crashes on Windows: ModuleNotFoundError: no module named fcntl

1 participant