fix(portable): reinstall anthropic provider on venv rebuild#24
Open
jamesphenry wants to merge 1 commit into
Open
fix(portable): reinstall anthropic provider on venv rebuild#24jamesphenry wants to merge 1 commit into
jamesphenry wants to merge 1 commit into
Conversation
The venv lives on the local filesystem (exFAT/NTFS don't support the hardlinks uv venv needs) and is therefore wiped on every reboot. The rebuild block in launch.sh re-installs the core hermes-agent package and python-telegram-bot, but not the anthropic provider that setup-unix.sh installs on first run (step 9). After a reboot, chat fails with an import error when the agent tries to talk to Anthropic. Add anthropic>=0.39.0 to both the uv and pip fallback install lines so the rebuild path mirrors setup-unix.sh exactly. A comment above the block warns future contributors that the two paths must stay in sync, since [all] is deliberately not exhaustive and the install list is the actual contract.
Open
Author
|
Heads up: PR #7 If that's the case, no problem — happy to close this PR or rebase it If #7 isn't landing soon, this PR still fixes the reported bug as-is. |
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.
Summary
The post-reboot venv rebuild path in
launch.shwas missing theanthropicprovider install. The venv is created on the localfilesystem (typically
/tmpon Linux,$TMPDIRon macOS — seelaunch.shlines 79-80 and 100-108) rather than on the USB, partlyto avoid exFAT hardlink limitations and partly to keep the venv off
the drive for speed and wear. The result is that the venv is wiped on
every reboot, and the rebuild block in
launch.shis responsible forre-installing everything the first-run
scripts/setup-unix.shinstalled. Step 9 of
setup-unix.shinstallsanthropic; therebuild block did not, so chat would fail with an import error when
the agent tried to use the Anthropic provider after any reboot.
Reproduction
./launch.shon a fresh drive. First-run setup completessuccessfully.
menu. Verify chat works.
/tmp(or$TMPDIRonmacOS) is cleared, the venv goes with it.
./launch.shagain. The "Local venv not found (temp waslikely cleared). Rebuilding ..." banner appears.
referencing the
anthropicmodule.Root cause
launch.shlines 92-128 (rebuild path) install the corehermes-agent[all]package andpython-telegram-bot, but notanthropic.scripts/setup-unix.shline 381 installsanthropicduring first-run setup. The two paths are supposed to be equivalent
on the install side (the
hermes-agent[all]extra is deliberatelynot exhaustive — see the comment in
setup-unix.shstep 10), but therebuild path drifted.
Fix
Add
anthropic>=0.39.0to both theuvinstall line and thepipfallback line in the rebuild block, matching the version specifier
from
setup-unix.shstep 9. Add a comment above the block explainingthe sync requirement so the next person who edits either file knows
to update both.
How to verify
rm -rfthe path in.cache/runtimes/<platform>-<arch>/venv.path)../launch.sh. The rebuild banner appears and the installlog should include
anthropicnext to the other two packages.It should return a model response, not an import error.
Test plan
XFCE. The rebuild block ran,
anthropicwas installed alongsidethe other two packages, and chat resumed normally.
bash -n launch.shpasses (syntax valid).mainis 7 lines added, 0 removed, in one file.Risk assessment
Low. The change is additive — it adds a package to an existing
install list, doesn't change the venv creation logic, doesn't touch
the
uv venvinvocation, and doesn't change the install order. Theonly behavioural change is "anthropic gets reinstalled on rebuild
like it does on first-run setup," which is the intended behaviour
matching the first-run path. If the
uvinstall fails for anyreason, the existing
pipfallback catches it with the same packagelist.
A longer-term refactor would extract the install list into a
shared function so the two paths can't drift again, but that's a
bigger change and out of scope for this fix.
Notes
changes if anything in the diff or commit message doesn't match
the project's conventions.
if I've missed one and I'm happy to coordinate.