Skip to content

fix(install): add OG_POLICY_PATH fallback for the policies .pth - #17

Merged
jmvbambico merged 1 commit into
mainfrom
fix/policy-path-pth-fallback
Oct 8, 2026
Merged

jmvbambico merged 1 commit into
mainfrom
fix/policy-path-pth-fallback

Conversation

@jmvbambico

Copy link
Copy Markdown
Owner

Problem

install_pth() writes a .pth file into omnigent's site-packages so
omnigent_local_policies is importable by the host daemon. That path lives
inside the venv's versioned prefix (e.g. Homebrew's Cellar/omnigent/<ver>/),
which a package-manager upgrade replaces wholesale rather than patching in
place — orphaning the .pth. The result: every policy evaluation raises
ModuleNotFoundError, and the failure mode is deny-everything, with nothing
in the chat error pointing back to a stale .pth.

Fix

og.env lives outside the versioned venv prefix and survives upgrades, so:

  • write_og_env() now writes OG_POLICY_PATH=<policies dir> into og.env.
  • og defaults OG_POLICY_PATH to $OMNI_HOME/policies (so an og.env
    written before this change still gets the fallback), and exports it as
    PYTHONPATH (prepended, not replacing any existing PYTHONPATH) when
    start_host_daemon() launches omnigent host.

This makes the .pth redundant rather than load-bearing: it's still written
and verified as before, but if a future upgrade orphans it, the host daemon
still finds the policy module via PYTHONPATH.

Testing

Reproduced the failure locally (Homebrew brew upgrade omnigent replaced the
Cellar prefix, orphaning the .pth, "every message denied"). Verified the fix
by re-applying the saved install plan (./install.sh --plan ~/.omnigent/og-install.json)
and confirming OG_POLICY_PATH lands in og.env and the PYTHONPATH export
lands in the installed og script.

🤖 Generated with Claude Code

install_pth() writes a .pth file into omnigent's site-packages so
omnigent_local_policies is importable by the host daemon. That path lives
inside the venv's versioned prefix (e.g. Homebrew's Cellar/omnigent/<ver>/),
which a package-manager upgrade replaces wholesale rather than patching in
place -- orphaning the .pth and silently denying every agent message with
no indication the .pth is the cause.

og.env lives outside that prefix and survives upgrades, so write
OG_POLICY_PATH there and export it as PYTHONPATH when `og start` launches
the host daemon. This is independent of the .pth and holds even when it
goes stale. og defaults OG_POLICY_PATH to $OMNI_HOME/policies so existing
og.env files (written before this change) still get the fallback.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jmvbambico
jmvbambico merged commit 9bb15c3 into main Oct 8, 2026
3 checks passed
@jmvbambico
jmvbambico deleted the fix/policy-path-pth-fallback branch October 9, 2026 03:53
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