Skip to content

fix: guard Unix-only fcntl import and SIGKILL lookups - #5247

Closed
lars-hagen wants to merge 2 commits into
NousResearch:mainfrom
lars-hagen:fix/windows-compat-fcntl-sigkill
Closed

fix: guard Unix-only fcntl import and SIGKILL lookups#5247
lars-hagen wants to merge 2 commits into
NousResearch:mainfrom
lars-hagen:fix/windows-compat-fcntl-sigkill

Conversation

@lars-hagen

@lars-hagen lars-hagen commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Applies existing defensive patterns to a few remaining Unix-specific call sites:

  • Guard tools/memory_tool.py with the same fcntl/msvcrt fallback already used in scheduler.py and auth.py
  • Replace direct signal.SIGKILL lookups with getattr(signal, "SIGKILL", signal.SIGTERM) in 4 files. This only prevents AttributeError on Windows; on Windows, os.kill(pid, SIGTERM) already performs forceful termination, so the runtime behavior is equivalent.
  • Update 1 related test assertion to use the same guard

No behavior change on Linux/macOS.

Fixes #5246

Testing

Tested on Windows 11 with Python 3.11, 3.12, and 3.13:

  • hermes doctor shows memory tool as available (no fcntl error)
  • python -c "import tools.memory_tool; print('OK')" succeeds
  • pytest tests/tools/test_memory_tool.py tests/tools/test_mcp_tool.py tests/hermes_cli/test_gateway.py tests/hermes_cli/test_profiles.py -v passes (fixes 1 previously failing test, no regressions)

@lars-hagen
lars-hagen force-pushed the fix/windows-compat-fcntl-sigkill branch from 825420a to f51b5cc Compare April 5, 2026 18:36
@lars-hagen lars-hagen changed the title fix(tools,cli,gateway): guard bare fcntl import and signal.SIGKILL for Windows compatibility fix: guard Unix-only fcntl import and SIGKILL lookups Apr 5, 2026
@lars-hagen
lars-hagen marked this pull request as ready for review April 5, 2026 19:14
@alt-glitch alt-glitch added type/bug Something isn't working tool/memory Memory tool and memory providers tool/mcp MCP client and OAuth comp/gateway Gateway runner, session dispatch, delivery comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have labels May 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Implementation PR for #5246. Related to closed #6479 (msvcrt fallback) and open #17965 (LOCK_UN guard).

@alt-glitch

Copy link
Copy Markdown
Collaborator

Implementation PR for #5246.

@teknium1

Copy link
Copy Markdown
Contributor

Closing as already fixed on main.

Triage notes (high confidence):
All four fixes already on main: memory_tool.py:39-44 has fcntl guard, mcp_tool.py:3548 uses getattr(_signal,'SIGKILL',_signal.SIGTERM), and hermes_cli/profiles.py:1024-1048 routes through terminate_pid() which handles Windows correctly.

If you still see this on the latest version, please reopen with reproduction steps.

(Bulk-closed during a CLI triage sweep.)

@teknium1 teknium1 closed this May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have tool/mcp MCP client and OAuth tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guard remaining Unix-only fcntl and SIGKILL usage

3 participants