fix(gateway): complete lazy-install rebind for slack/feishu/matrix + ensure_and_bind helper#25038
Merged
Merged
Conversation
Contributor
🔎 Lint report:
|
…add ensure_and_bind helper Fixes #25028. The lazy-install hooks added in #25014 installed packages correctly but failed to rebind module-level globals after install: - Slack: missing aiohttp rebind → NameError on file uploads - Feishu: none of the ~25 lark_oapi symbols rebound → TypeError on adapter instantiation - Matrix: mautrix.types enums stayed as stubs → mismatched values at runtime Introduces tools.lazy_deps.ensure_and_bind() — a DRY helper that combines ensure() + importer-callable + globals().update(). This eliminates the error-prone pattern of manually listing every global that needs updating after lazy-install. Each platform adapter now defines a single _import() function returning all bindings. Also fixes: pyproject.toml [slack] extra was missing aiohttp (needed by slack-bolt's async path).
968c3a6 to
dd00003
Compare
teknium1
approved these changes
May 14, 2026
sunJose
pushed a commit
to sunJose/hermes-agent
that referenced
this pull request
May 14, 2026
…add ensure_and_bind helper (NousResearch#25038) Fixes NousResearch#25028. The lazy-install hooks added in NousResearch#25014 installed packages correctly but failed to rebind module-level globals after install: - Slack: missing aiohttp rebind → NameError on file uploads - Feishu: none of the ~25 lark_oapi symbols rebound → TypeError on adapter instantiation - Matrix: mautrix.types enums stayed as stubs → mismatched values at runtime Introduces tools.lazy_deps.ensure_and_bind() — a DRY helper that combines ensure() + importer-callable + globals().update(). This eliminates the error-prone pattern of manually listing every global that needs updating after lazy-install. Each platform adapter now defines a single _import() function returning all bindings. Also fixes: pyproject.toml [slack] extra was missing aiohttp (needed by slack-bolt's async path).
jsboige
pushed a commit
to jsboige/hermes-agent
that referenced
this pull request
May 14, 2026
…add ensure_and_bind helper (NousResearch#25038) Fixes NousResearch#25028. The lazy-install hooks added in NousResearch#25014 installed packages correctly but failed to rebind module-level globals after install: - Slack: missing aiohttp rebind → NameError on file uploads - Feishu: none of the ~25 lark_oapi symbols rebound → TypeError on adapter instantiation - Matrix: mautrix.types enums stayed as stubs → mismatched values at runtime Introduces tools.lazy_deps.ensure_and_bind() — a DRY helper that combines ensure() + importer-callable + globals().update(). This eliminates the error-prone pattern of manually listing every global that needs updating after lazy-install. Each platform adapter now defines a single _import() function returning all bindings. Also fixes: pyproject.toml [slack] extra was missing aiohttp (needed by slack-bolt's async path).
1 task
AlexFoxD
pushed a commit
to AlexFoxD/hermes-agent
that referenced
this pull request
May 21, 2026
…add ensure_and_bind helper (NousResearch#25038) Fixes NousResearch#25028. The lazy-install hooks added in NousResearch#25014 installed packages correctly but failed to rebind module-level globals after install: - Slack: missing aiohttp rebind → NameError on file uploads - Feishu: none of the ~25 lark_oapi symbols rebound → TypeError on adapter instantiation - Matrix: mautrix.types enums stayed as stubs → mismatched values at runtime Introduces tools.lazy_deps.ensure_and_bind() — a DRY helper that combines ensure() + importer-callable + globals().update(). This eliminates the error-prone pattern of manually listing every global that needs updating after lazy-install. Each platform adapter now defines a single _import() function returning all bindings. Also fixes: pyproject.toml [slack] extra was missing aiohttp (needed by slack-bolt's async path).
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…add ensure_and_bind helper (NousResearch#25038) Fixes NousResearch#25028. The lazy-install hooks added in NousResearch#25014 installed packages correctly but failed to rebind module-level globals after install: - Slack: missing aiohttp rebind → NameError on file uploads - Feishu: none of the ~25 lark_oapi symbols rebound → TypeError on adapter instantiation - Matrix: mautrix.types enums stayed as stubs → mismatched values at runtime Introduces tools.lazy_deps.ensure_and_bind() — a DRY helper that combines ensure() + importer-callable + globals().update(). This eliminates the error-prone pattern of manually listing every global that needs updating after lazy-install. Each platform adapter now defines a single _import() function returning all bindings. Also fixes: pyproject.toml [slack] extra was missing aiohttp (needed by slack-bolt's async path).
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
Fixes #25028.
The lazy-install hooks added in #25014 installed packages correctly but failed to rebind module-level globals after install. In a long-lived gateway process (non-Docker), this causes:
NameError: name 'aiohttp' is not definedon first file uploadTypeError: 'NoneType' object is not callableon adapter instantiation (all ~25lark_oapisymbols stayNone)mautrix.typesenums stay as stub classes with wrong valuesDingTalk was already correct and served as the reference.
Fix
1. New helper:
tools.lazy_deps.ensure_and_bind()DRY helper that combines
ensure()+ an importer callable +globals().update():This eliminates the error-prone pattern of manually listing every
global+ rebind assignment. The_import()function is the single source of truth — if it imports a name, it gets bound.2. Platform fixes using the new helper:
AsyncApp,AsyncSocketModeHandler,AsyncWebClient,aiohttplark_oapisymbols (lark,CreateMessageRequest,FeishuWSClient, etc.)mautrix.typessymbols (EventType,RoomCreatePreset,TrustState, etc.)3. pyproject.toml
[slack]extra — added missingaiohttp==3.13.3(needed by slack-bolt's async path).Related