feat(cron/slack): flat in-channel continuable cron delivery surface - #176
Open
hashbender wants to merge 1 commit into
Open
feat(cron/slack): flat in-channel continuable cron delivery surface#176hashbender wants to merge 1 commit into
hashbender wants to merge 1 commit into
Conversation
|
Review Complete Risk: 🟢 Low (18/100) — no findings · 738 LOC across 12 files No issues found meeting confidence and severity thresholds. PR adds cron in-channel delivery for Slack with proper config gating and fail-safe fallbacks. Files Reviewed (12 files) |
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
Adds a per-platform
cron_continuable_surfaceconfig key so a continuable cron job can deliver flat into a Slack channel — no dedicated thread — and still be replied-to and continued in context.Today continuable cron (
cron.mirror_delivery/ per-jobattach_to_session) is thread-preferred: on any thread-capable platform it unconditionally mints a hidden handoff thread (cron/scheduler.py). There was no "continuable but flat" mode. This adds one.How it works
cron_continuable_surfacetakes"thread"(default, byte-identical to today) or"in_channel". Inin_channelmode the scheduler skips the thread-open branch (leavesthread_id=None), so the delivery posts flat — and the shipped origin-mirror then seeds the(slack, chat_id, None)shared-channel session, the exact bucketreply_in_thread: falsealready routes inbound channel replies to. A plain channel reply resolves to that session with the brief in context. No new seed code — it reuses the existing mirror.This is model B (shared-channel session), deliberately not anchoring the seed to the delivery message's
ts: on Slack, replying to a specific message is threading, so atsanchor would only relocate the thread to first-reply-time, never deliver true threadless-continuable.Config (the pairing)
reply_in_thread: falseis required so the reply is answered flat and keyed to the seeded channel session. Missing it fails SAFE — you get a threaded continuation (≈ today), never a dropped reply — and the gateway logs a warning at startup (warn, not hard-reject: the two knobs stay orthogonal).require_mention: false(or a free-response channel) lets a plain reply continue the job; otherwise you'd have to@-mention on each reply. (Long-standing orthogonal channel knob — surfaced in docs.)reply_in_thread: falseusers already accept. Use the defaultthreadsurface when you want each delivery isolated.Generic key, Slack first consumer
The scheduler reads the key generically from platform config; the
in_channelbranch is gated on a base-adapter capability flagsupports_inchannel_continuable(Slack =True). Any platform without an implementation fails safe tothreadwith a debug log — no Slack-only special-case in core.Files
gateway/platforms/base.py—supports_inchannel_continuablecapability flag (defaultFalse).plugins/platforms/slack/adapter.py— flagTrue;_cron_continuable_surface()resolver;_warn_if_inchannel_without_flat_reply()connect-time warning.gateway/config.py— shared-key bridge line (top-level or nested config).cron/scheduler.py— resolve the surface generically, gate thein_channelbranch on the capability flag, skip thread-open.cron.md+slack.md(+ zh-Hans mirrors of both).Testing
Run from inside the worktree (
PYTHONPATH=$PWD):in_channelskips thread-open; seeds the flat channel session withthread_id=None;thread-mode regression; fail-safe on an unsupported platform; value coercion.and not in_channel_surfaceguard turns the two load-bearing tests RED; restore → GREEN.tests/manual/cron_inchannel_e2e.py) — drives both real legs (delivery seed + inbound reply keying) and asserts they converge on(slack, C, None).test_slack.py216 passed alone; broader sweep green. (4 pre-existing cross-file-ordering failures intest_slack.pyreproduce identically on pristineorigin/main.)Deploy note
Gateway-side config flag — a
/restartpicks it up. No Slack app reinstall needed (contrast a manifest/scope change).Infographic
Mirror-of: NousResearch#56096
NousResearch#56096