Skip to content

fix(gateway): correct sys.path insertion in all migrated platform adapters (cron namespace collision) - #49913

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-1cc1e50a
Jun 21, 2026
Merged

teknium1 merged 2 commits into
mainfrom
hermes/hermes-1cc1e50a

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

Gateway no longer crashes on startup with ModuleNotFoundError: No module named 'cron.scheduler_provider'.

Root cause: commit 5600105478 migrated the slack/discord/whatsapp/telegram/raft adapters from gateway/platforms/ to plugins/platforms/. Each adapter does sys.path.insert(0, parents[2]) — one level deeper now, so parents[2] resolves to plugins/ instead of the repo root. With plugins/ on sys.path[0], import cron resolves to the plugins/cron/ chronos-provider package (which has no scheduler_provider submodule), so the first from cron.scheduler_provider import … during start_gateway() raises ModuleNotFoundError.

Changes

  • plugins/platforms/{discord,raft,slack,whatsapp,telegram}/adapter.py: parents[2]parents[3] so each inserts the repo root, not plugins/.

gateway/platforms/base.py correctly keeps parents[2] (it lives one level shallower, so parents[2] is already the repo root there).

Attribution

Validation

Before After
import cron.scheduler_provider after any of the 5 adapters loads ModuleNotFoundError resolves to repo cron/scheduler_provider.py
sys.path[0] after adapter import plugins/ repo root

E2E: simulated each adapter's sys.path.insert and confirmed cron.scheduler_provider resolves to the real package for all 5. tests/cron/test_scheduler_provider.py + tests/gateway/test_cron_fire_webhook.py — 25/25 pass.

Fixes #49410, #49824.

Infographic

cron-namespace-collision-fixed

kyssta-exe and others added 2 commits June 20, 2026 19:56
…ters

#49431 corrected parents[2]->parents[3] for discord + raft only. The same
bug existed in slack, whatsapp, and telegram adapters (migrated from
gateway/platforms/ in 5600105): each inserts parents[2] = plugins/ onto
sys.path[0], shadowing the real cron/ package with plugins/cron/ so
'import cron.scheduler_provider' raises ModuleNotFoundError on gateway start.

Fixes #49410, #49824.
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-1cc1e50a vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 11278 on HEAD, 11276 on base (🆕 +2)

🆕 New 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`

✅ Fixed issues (1):

Rule Count
invalid-assignment 1
First entries
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`

Unchanged: 5912 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/gateway Gateway runner, session dispatch, delivery comp/cron Cron scheduler and job management labels Jun 21, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

Related: #49431 (@kyssta-exe — original parents[2]->parents[3] fix for discord+raft), #49414 (@ochsec — alternate module-level pre-import approach), and the bug reports #49410 / #49824 this fixes. This PR widens the root-cause fix to all 5 migrated adapters (slack/whatsapp/telegram added) with authorship preserved. Not a duplicate of the community PRs — it's the authoritative consolidation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management comp/gateway Gateway runner, session dispatch, delivery P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gateway crashes on startup with ModuleNotFoundError: No module named 'cron.scheduler_provider'

3 participants