Repository navigation
fix(install): add OG_POLICY_PATH fallback for the policies .pth - #17
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
install_pth()writes a.pthfile into omnigent's site-packages soomnigent_local_policiesis importable by the host daemon. That path livesinside 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 raisesModuleNotFoundError, and the failure mode is deny-everything, with nothingin the chat error pointing back to a stale
.pth.Fix
og.envlives outside the versioned venv prefix and survives upgrades, so:write_og_env()now writesOG_POLICY_PATH=<policies dir>intoog.env.ogdefaultsOG_POLICY_PATHto$OMNI_HOME/policies(so anog.envwritten before this change still gets the fallback), and exports it as
PYTHONPATH(prepended, not replacing any existingPYTHONPATH) whenstart_host_daemon()launchesomnigent host.This makes the
.pthredundant rather than load-bearing: it's still writtenand 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 omnigentreplaced theCellar prefix, orphaning the
.pth, "every message denied"). Verified the fixby re-applying the saved install plan (
./install.sh --plan ~/.omnigent/og-install.json)and confirming
OG_POLICY_PATHlands inog.envand thePYTHONPATHexportlands in the installed
ogscript.🤖 Generated with Claude Code