diff --git a/cron/scheduler.py b/cron/scheduler.py index 548f83423..520b0f463 100644 --- a/cron/scheduler.py +++ b/cron/scheduler.py @@ -1411,11 +1411,13 @@ def _deliver_result(job: dict, content: str, adapters=None, loop=None) -> Option # the origin DM session (handled after delivery). Cf. _process_handoff. # # in_channel surface (D2): SKIP thread creation entirely — leave - # thread_id=None so the delivery posts flat, and let the existing - # origin-mirror (below) seed the shared-channel session (F5: for a - # channel-origin job with thread_id=None, _target_matches_origin matches - # and _maybe_mirror_cron_delivery seeds (platform, chat_id, None)). No - # new seed call is needed. + # thread_id=None so the delivery posts flat, then + # ``_seed_cron_channel_session`` (below) CREATES the shared-channel + # session and mirrors the brief into it. The shipped mirror alone is + # NOT enough here: ``mirror_to_session`` only APPENDS to an existing + # session and a flat ``(platform, chat_id, None)`` row is otherwise + # absent for a ``chat_postMessage`` delivery, so the seed must create + # the row first (F5). thread_seeded = False opened_thread_id: Optional[str] = None if ( diff --git a/tests/cron/test_scheduler.py b/tests/cron/test_scheduler.py index d53209fd3..01bae7ed2 100644 --- a/tests/cron/test_scheduler.py +++ b/tests/cron/test_scheduler.py @@ -4153,8 +4153,10 @@ class TestCronContinuableSurfaceInChannel: generically from pconfig.extra; the in_channel branch is gated on the adapter capability flag ``supports_inchannel_continuable`` (Slack=True, others fail SAFE to thread). In in_channel mode the thread-open branch is - SKIPPED (thread_id stays None), so the existing origin-mirror seeds the - shared-channel session — no new seed code (G6). + SKIPPED (thread_id stays None), then ``_seed_cron_channel_session`` CREATES + the flat shared-channel session and mirrors the brief into it (the shipped + mirror only APPENDS to an existing session, and the flat channel row is + otherwise absent for a chat_postMessage delivery). """ def _slack_cfg(self, extra):