Skip to content

fix(cron): profile cron delivery uses profile-specific adapters - #13

Merged
girnarholdings merged 1 commit into
mainfrom
fix/cron-profile-delivery
Jul 28, 2026
Merged

girnarholdings merged 1 commit into
mainfrom
fix/cron-profile-delivery

Conversation

@girnarholdings

Copy link
Copy Markdown
Owner

Problem

In multiplex mode, all profile cron job deliveries route through the root profile's Telegram bot instead of each profile's own bot.

Fix (3 seams, 19 lines)

  1. gateway/run.py: pass profile_adapters=runner._profile_adapters in cron_start_kwargs
  2. cron/scheduler_provider.py: thread through start() and _start_multiplex()
  3. _start_multiplex(): select per-profile adapters for each tick; fall back to root for delegation-only profiles

Tests

  • tests/cron/: 808 passed
  • tests/gateway/ -k multiplex: 243 passed

In multiplex mode, the cron ticker received only runner.adapters (the
default profile's adapter map). Profile cron jobs — BoltNews, BetNews,
BoltFactors, Screener, YT, Infra — all delivered through the root bot
to the root channel, polluting the working DM.

Fix: pass _profile_adapters from GatewayRunner to the cron scheduler.
In _start_multiplex, select each profile's own adapter dict when
ticking its cron store. Profiles without a Telegram adapter
(delegation-only: code-review, design-expert, etc.) fall back to root
adapters, preserving existing behavior.

Changes:
- gateway/run.py: pass profile_adapters=runner._profile_adapters
- cron/scheduler_provider.py: thread profile_adapters through start()
  and _start_multiplex(), select per-profile adapters in the tick loop
@girnarholdings
girnarholdings merged commit 27d7e15 into main Jul 28, 2026
2 checks passed
@girnarholdings
girnarholdings deleted the fix/cron-profile-delivery branch July 28, 2026 11:45
@girnarholdings
girnarholdings restored the fix/cron-profile-delivery branch August 20, 2026 05:12
girnarholdings added a commit that referenced this pull request Aug 20, 2026
* test(cron): pin profile-adapter routing seams (regression guard for 2026-08-19)

The upstream catchup rebase (merge PR #14, 2026-08-19) silently dropped the
fork's profile-adapter routing fix (PR #13) — profile cron jobs delivered
through the root bot to the root DM for a day and every per-profile channel
went silent. No test pinned the three seams, so the drop was invisible to CI.

Add test_multiplex_ticker_passes_profile_specific_adapters:
- asserts start() and _start_multiplex() carry profile_adapters
- asserts _start_multiplex selects per-profile adapter dicts
- asserts the root fallback for adapter-less profiles
- behaviorally verifies each profile tick receives ITS OWN adapters

Verified: fails on fa95c40 (pre-fix), passes on 57bfb25 (fixed).

* ci: re-trigger checks

---------

Co-authored-by: nima <nima@girnarholdings.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant