fix(reply): derive source-reply explicit-command bypass from authorized + control-command body#86874
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 27, 2026, 12:45 AM ET / 04:45 UTC. Summary PR surface: Source +60, Tests +315. Total +375 across 6 files. Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main treats missing CommandSource as a normal non-explicit turn even when CommandAuthorized is true and CommandBody is a control command. I did not run tests because this review was constrained to read-only inspection. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land the central helper after maintainer review, current-head checks, and visible transport proof confirm the inline-token and structured-normal safeguards hold across the message-delivery path. Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives a high-confidence reproduction path: current main treats missing CommandSource as a normal non-explicit turn even when CommandAuthorized is true and CommandBody is a control command. I did not run tests because this review was constrained to read-only inspection. Is this the best way to solve the issue? Yes, with maintainer proof: centralizing the authorized-control-command decision is narrower than repeating per-channel tags and the patch preserves inline-token and structured-normal safeguards. Because it affects visible message delivery across channels, current-head checks and a live Telegram-style proof are still the right merge gate. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against bf1a5c330397. Label changesLabel justifications:
Evidence reviewedPR surface: Source +60, Tests +315. Total +375 across 6 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
ClawSweeper PR egg ✨ Hatched: 🥚 common Pearl Review Wisp Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
3128f07 to
6cf4120
Compare
6cf4120 to
3e9199f
Compare
3e9199f to
991fd3f
Compare
|
Verification for rewritten head Behavior addressed: authorized control-command bodies without Real environment tested: local source checkout on current Exact steps or command run after this patch:
Evidence after fix: focused Vitest passed 3 files / 208 tests; Observed result after fix: What was not tested: no live Telegram/Desktop proof in this pass; waiting on current-head GitHub Actions after the final force-push. |
|
🦞👀 Command router queued. I will update this comment with the next step. |
Summary
Pushes the
/new,/reset,/abort(and friends) acknowledgement-visibility fix from #86825 / #86664 down one layer, into the canonical source-reply decision inisExplicitSourceReplyCommand. The result is one core file change that covers every channel — current and future — instead of repeating the same authorized-control-command formula at every ingress.Supersedes PR #86863 (the per-channel sweep), which I am closing in favour of this.
Why
Every per-channel "fix" I added in #86863 was just:
— a universal formula whose only purpose was to make
isExplicitCommandTurnreturn true on the inbound context so themessage_tool_onlysuppression bypass would fire. The downstream check atsource-reply-delivery-mode.ts:54already hascfgandCommandAuthorizedandCommandBodyin scope; it can derive the same signal itself without ever asking channels to tag it.Change
Two callers updated to pass
cfg(both already had it in scope):src/auto-reply/reply/source-reply-delivery-mode.ts:54(insideresolveSourceReplyDeliveryMode, hasparams.cfg)src/auto-reply/reply/dispatch-from-config.ts:1325(insidedispatchReplyFromConfig, has destructuredcfg)That's it. No channel changes, no SDK changes, no new optional fields on inbound entries, no copy-pasted comment blocks.
Behaviour equivalence
The only user-visible effect of
CommandSource: "text"in the current codebase is makingisExplicitCommandTurnreturn true onisExplicitSourceReplyCommand. There are two consumers:source-reply-delivery-mode.ts:54(the suppression bypass)"automatic"deliverydispatch-from-config.ts:1325(prefersMessageToolDelivery)isExplicitSourceReplyCommandcall, same derived behaviourThe third consumer of
kind: "text-slash"—isUnauthorizedTextSlashCommandatsource-reply-delivery-mode.ts:60-64— is intentionally untouched. That defense fires when CommandSource is"text"AND CommandAuthorized is false; channels that want the unauthorized-text-slash defense to activate on typed/foofrom non-allowed users still need explicit tagging. My superseded sweep PR did not activate this defense either (it gated oncommandAuthorized &&), so this change is strictly equivalent to it.Inline-token discrimination
The derived bypass uses
isControlCommandMessage(body, cfg), not the loosershouldComputeCommandAuthorized(body, cfg). Bodies like"hey can you /status please"correctly do NOT take the bypass even if the channel marked the turn authorized — only bodies that are themselves a configured control command qualify. Captured as an explicit assertion in the new test.What gets fixed
CommandSource: "text"explicitly)CommandSourcedirect-dmSDK consumerscommandSourceTests
Added one focused regression case in
src/auto-reply/reply/source-reply-delivery-mode.test.ts:git stashand reran the new case → fails as expected. With the fix restored, passes.What I'm still validating
I asked you to land the PR first, then validate broader; tracking these:
src/auto-reply/suite shows pre-existing flake patterns; need to disambiguate which (if any) are related to this change vs. environment.check:changedlanes (lint, import-cycles, typecheck on changed files).scripts/check-changelogconfirming no entry is required for a fix landing.I'll report back with proof or fixes shortly.
PR cross-references