Repository navigation
fix: serialize Telegram card sends against in-flight chat turns, surface session reset (#281) - #775
Merged
getappz merged 2 commits intoSep 18, 2026
Conversation
…t turns, surface a session reset (item #281) A plan-approval or PR-approval card is now sent under the same per-chat turn lock run_chat_turn holds, so it can no longer land interleaved with an unrelated conversational reply to the same chat. Separately, when a chat turn's resumed agent session turns out to be stale and falls back to a brand-new zero-history one, the reply is now prefixed with a note explaining the bot has lost context -- instead of silently answering a "yes"/"approved" as if it understood what it refers to. Agentflare-Agent: claude-code Agentflare-Branch: task/281-telegram-bot-has-no-conversational-sessi Agentflare-Item: 281 Agentflare-Session: 673e5d10-e8d5-4a5b-b5d3-2d76b468aeab
|
Warning Review limit reachedNext included review available in 51 minutes. View limit detailsLimit details: You’ve used the included review currently available. Your 60 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Owner
Author
|
Tracking this PR for automated review ( |
getappz
deleted the
task/281-telegram-bot-has-no-conversational-sessi
branch
September 18, 2026 10:28
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
Item #281 reported two distinct problems in the Telegram bot's inbound handling:
notify_human_gate/request_channel_approval(insrc/supervisor/notify.rs) sent their Telegram API calls with no ordering againstchat_channel::run_chat_turn's reply to the same chat.Changes
src/chat_channel.rs:chat_turn_lockis nowpub(crate)sonotify.rscan take the same per-chat lockrun_chat_turnholds for its whole turn. Also addsprefix_session_reset_note, which prepends[my memory of this chat was reset -- replying fresh, with no earlier context]to a reply whenever the turn detected a stale resumed session (item chore: release #159's failure mode) and retried fresh.src/supervisor/notify.rs:notify_human_gateandrequest_channel_approval(shared bynotify_pr_approval_gateandnotify_plan_approval_gate) now takechat_turn_lockbefore sending, so a side-channel card can no longer land interleaved with an in-flight chat reply to the same chat.Test plan
cargo build --bin agentflarecargo test --bin agentflare chat_channel::(new test:prefix_session_reset_note_prepends_context_loss_note)cargo test --bin agentflare supervisor::(94 tests, all passing)cargo clippy --bin agentflareclean on both changed filescargo fmt --checkcleanNote: a full-repo
cargo test --bin agentflarerun in this environment hits one unrelated failure,mcp_prompts::tests::optimize_review_returns_full_skill_body, caused by the sandbox mounting~/.local/stateread-only (that test'sset_active()call has no test-time state-dir override) -- confirmed unrelated to this change by reproducing the same read-only-fs failure with a directecho > ~/.local/state/...write, independent of any code change.Summary by CodeRabbit
New Features
Bug Fixes