Repository navigation
feat(scheduler): ADR-0020 slice 1b schedule-through-gate - #171
Merged
Merged
Conversation
Scheduled job runner claims TurnGate via begin_scheduled before process_message_outcome and finish afterward so scheduled and user turns never run in parallel on the same session_key. finish→User reuses the Telegram spawn loop (bare agent fallback when no bot). Refs: ADR-0020 slice 1b
Owner
Author
TL ACCEPT — tip
|
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
ADR-0020 slice 1b: scheduled turns go through
TurnGatewith the samesession_key(bot_id, user_id)serialization as user turns.TurnGate::begin_scheduled: idle → markScheduledand return; busy → ticket inwaiting_scheduledand await untilfinishhands the gate (user always finishes first; leftovers stay pending behind).main.rs):begin_scheduledbeforeprocess_message_outcome,finishafter every outcome (success / max-iter / error). ADR-0013 re-fires already share this runner, so they use the same path.finish→Next::User: spawn pending user turns viaspawn_telegram_turn_loop(extracted from 1aSubmit::Start). Bare agent loop fallback when no owning Telegram bot / unparseable ids.drainalready no-ops forTurnKind::Scheduled; no steer source whenschedule_id.is_some())./stopclear: still drops only the user queue; waiting scheduled tickets are kept (unit-tested).Out of scope
Refs: ADR-0020 slice 1b
Test plan / QA matrix
turn_gate(begin_scheduledblocks behind user; never two active; no drain during scheduled; waiting scheduled before leftover pending;/stopclear keeps tickets)cargo fmtcargo clippy --locked --all-targets -- -D warningsenv -u RUSTFOX_GOOGLE_OAUTH_CLIENT_ID cargo test --locked(947 passed / 0 failed)/stopduring a user turn that has a waiting schedule behind it — queue cleared, scheduled run still proceeds.