fix(gateway): correct sys.path insertion in all migrated platform adapters (cron namespace collision) - #49913
Merged
Merged
Conversation
…amespace collision (#49410)
…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.
Contributor
🔎 Lint report:
|
| 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.
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. |
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
Gateway no longer crashes on startup with
ModuleNotFoundError: No module named 'cron.scheduler_provider'.Root cause: commit
5600105478migrated the slack/discord/whatsapp/telegram/raft adapters fromgateway/platforms/toplugins/platforms/. Each adapter doessys.path.insert(0, parents[2])— one level deeper now, soparents[2]resolves toplugins/instead of the repo root. Withplugins/onsys.path[0],import cronresolves to theplugins/cron/chronos-provider package (which has noscheduler_providersubmodule), so the firstfrom cron.scheduler_provider import …duringstart_gateway()raisesModuleNotFoundError.Changes
plugins/platforms/{discord,raft,slack,whatsapp,telegram}/adapter.py:parents[2]→parents[3]so each inserts the repo root, notplugins/.gateway/platforms/base.pycorrectly keepsparents[2](it lives one level shallower, soparents[2]is already the repo root there).Attribution
cron.*at module level to cachesys.modulesbefore the bad insert. That treats the symptom (the brokenparents[2]insert stays, so any module imported after a platform adapter is still at risk) and bundled an unrelated kanban change, so this PR fixes the root cause instead.Validation
import cron.scheduler_providerafter any of the 5 adapters loadsModuleNotFoundErrorcron/scheduler_provider.pysys.path[0]after adapter importplugins/E2E: simulated each adapter's
sys.path.insertand confirmedcron.scheduler_providerresolves 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