fix(whatsapp): resolve bridge dir with HERMES_HOME mirror in read-only Docker (fix #49561) - #49839
Merged
Conversation
In Docker the install tree (/opt/hermes) is read-only, so npm install for the WhatsApp bridge fails with EACCES. Add resolve_whatsapp_bridge_dir() in whatsapp_common.py: when the install dir is read-only, mirror the bridge source into a writable HERMES_HOME location and use that. Both the adapter and the 'hermes whatsapp' CLI resolve through the shared helper so the install and runtime paths agree. Fixes #49561
Follow-up for salvaged #49654: unit tests for resolve_whatsapp_bridge_dir() (writable passthrough, read-only mirror, existing-mirror reuse) and the AUTHOR_MAP entry for the contributor.
Contributor
🔎 Lint report:
|
| Rule | Count |
|---|---|
unresolved-import |
1 |
unsupported-operator |
1 |
unresolved-reference |
1 |
invalid-assignment |
1 |
First entries
tests/gateway/test_whatsapp_bridge_dir_resolution.py:11: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`
plugins/platforms/whatsapp/adapter.py:277: [unsupported-operator] unsupported-operator: Operator `/` is not supported between objects of type `None | Unknown` and `Literal["bridge.js"]`
gateway/platforms/whatsapp_common.py:374: [unresolved-reference] unresolved-reference: Name `Path` used when not defined
tests/run_agent/test_credits_notices_toggle.py:76: [invalid-assignment] invalid-assignment: Object of type `None` is not assignable to attribute `_credits_session_start_micros` of type `int`
✅ Fixed issues (2):
| Rule | Count |
|---|---|
unresolved-attribute |
2 |
First entries
run_agent.py:2984: [unresolved-attribute] unresolved-attribute: Object of type `Self@get_credits_spent_micros` has no attribute `_credits_session_start_micros`
tests/run_agent/test_credits_notices_toggle.py:76: [unresolved-attribute] unresolved-attribute: Unresolved attribute `_credits_session_start_micros` on type `AIAgent`
Unchanged: 5909 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
Collaborator
|
Related: #49654 (original by @xydigit-zt, salvaged here onto current main after the WhatsApp adapter migrated to plugins/platforms/whatsapp/adapter.py), #49561 (the read-only Docker bridge-install regression this fixes). This is the authoritative re-application, not a duplicate. |
This was referenced Jun 21, 2026
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
Fixes the v0.17.0 regression where the WhatsApp bridge cannot be installed in the Docker image. In Docker the install tree (
/opt/hermes) is read-only, sonpm installfor the bridge fails withEACCES: permission denied, mkdir /opt/hermes/scripts/whatsapp-bridge/node_modules.Salvages #49654 by @xydigit-zt (Zheng Tao). The PR's base was 41 commits behind
mainand the WhatsApp adapter had since been migrated fromgateway/platforms/whatsapp.pytoplugins/platforms/whatsapp/adapter.py, so the change was re-applied onto currentmain.Changes
gateway/platforms/whatsapp_common.py: new sharedresolve_whatsapp_bridge_dir()— if the install dir is read-only, mirror the bridge source into a writableHERMES_HOMElocation and return that path.plugins/platforms/whatsapp/adapter.py: adapter resolves_DEFAULT_BRIDGE_DIRvia the shared helper.hermes_cli/main.py:hermes whatsappinstall path uses the same helper, so the CLI install and gateway runtime agree on one directory.tests/gateway/test_whatsapp_bridge_dir_resolution.py: writable passthrough, read-only mirror, and existing-mirror-reuse cases.scripts/release.py: AUTHOR_MAP entry for the contributor.Validation
/opt/hermes)npm install→ EACCESHERMES_HOME, install succeedsnode_modulesTargeted tests: 3/3 new + 40/40 existing WhatsApp tests green. E2E with a real read-only dir (non-root, no mocks) confirmed the mirror is created and populated, and a second call reuses it without clobbering
node_modules.Closes #49561. Supersedes #49654 (cherry-picked with @xydigit-zt's authorship preserved).
Infographic