Skip to content

fix(nuitka): let the hook binary re-launch itself so org skills sync - #466

Merged
zeus-12 merged 1 commit into
stagingfrom
vv/hook-nuitka-sys-executable
Nov 30, 2026
Merged

zeus-12 merged 1 commit into
stagingfrom
vv/hook-nuitka-sys-executable

Conversation

@zeus-12

@zeus-12 zeus-12 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

  • Org-pushed skills never sync on Macs running the Nuitka-built unbound-hook. Sentry AI-GATEWAY-19H: skills sync dispatch failed: [Errno 13] Permission denied: '/opt/unbound/current/unbound-hook/python', about 36k events, mostly org 3493.
  • The hooks start their detached jobs by re-launching their own binary through sys.executable. Nuitka --standalone leaves sys.executable at <dist>/python, which cannot be run. The Nuitka entry shim sets sys.frozen and sys._MEIPASS but not sys.executable.
  • Every re-launch fails the same way: sync-skills (claude-code, codex, copilot, cursor, antigravity), mcp-diagnostic and refresh-claude-ai-connectors.
  • Discovery had the same bug, fixed in WEB-6954: Let a Nuitka-built unbound-discovery re-launch itself for memory fixes #453. That PR noted the hook was still affected.

Changes

Change File
In a Nuitka build, point sys.executable at <dist>/unbound-hook, as PyInstaller does packaging/nuitka/unbound_hook_entry.py
Smoke test runs a SessionStart on the built bundle and fails unless the sync-skills child reaches the gateway packaging/scripts/smoke-test.sh
Contract test for the shim binary/tests/test_frozen_contract.py

The smoke test already runs for both builders in release-macos-runtime, so a bundle that cannot re-launch itself now fails the release.

Checked

On a local Nuitka 2.8.10 build (the release script's options, x86_64 Linux, pinned toolchain):

Check Before After
smoke-test.sh on the built bundle FAIL: no /v1/hooks/skills/sync request passes
Hook error log after SessionStart skills sync dispatch failed: [Errno 2] No such file or directory: '<dist>/unbound-hook/python', same for the connector refresh no dispatch errors
Real claude -p session, hooks set to the built binary, local gateway and backend with one skill policy skill not installed ~/.claude/skills/unbound-<slug>/ written with the policy body and .unbound-managed; gateway logs the reconcile plan

The e2e session used a mock model, so no tokens were spent. The error is ENOENT on Linux and EACCES on macOS; the cause is the same path.

Notes for review

  • Not run: a macOS build, a signed build, the arm64 slice. A dry run (publish unchecked, builder nuitka) is the first macOS run of the new smoke step.
  • PyInstaller builds are unaffected: the new line runs only when Nuitka's __compiled__ exists.
  • The new smoke step waits up to 30 s for the detached child.
  • 18 tests in binary/tests fail locally when run as root, on staging too. They are unrelated.
  • No version bump in this PR.

Generated by Claude Code

Unbound Review · Score 5/5 (no findings) · 4fd5ae9

  • codex (own score 5/5): The PR sets the Nuitka hook bundle’s executable path so detached jobs can relaunch it, and adds contract and release smoke tests for that behavior. The changed code and its callers did not reveal a substantive defect.
  • claude (own score 5/5): Safe to merge; I found nothing worth raising. In a Nuitka build, the hook binary was re-launching itself through sys.executable, which Nuitka leaves at <dist>/python, a path that cannot run. The PR points it at <dist>/unbound-hook instead, which is what PyInstaller does and what the discovery entry already does (packaging/unbound_discovery_entry.py:43). The build names the hook binary unbound-hook (`packaging/scripts/build-nuitka.sh:166

findings: 0 P0 · 0 P1 · 0 P2 (top 5 P0/P1 inline) · engines: codex ✅ · claude ✅

Nuitka standalone leaves sys.executable at <dist>/python, so every detached
re-launch the hooks start (sync-skills, mcp-diagnostic,
refresh-claude-ai-connectors) failed and org skills never synced. The smoke
test now fails a build whose SessionStart cannot re-launch sync-skills.
@zeus-12
zeus-12 requested a review from a team November 30, 2026 15:03
@zeus-12

zeus-12 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

/review

@vigneshsubbiah16 vigneshsubbiah16 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Security consensus: no issues found. (reviewers: Claude, Semgrep, Gitleaks)


🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head 4fd5ae9a · 2026-11-30T15:10Z

@zeus-12
zeus-12 merged commit 30aa407 into staging Nov 30, 2026
5 checks passed
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.

4 participants