Repository navigation
fix(telegram): route /new, /reset to control lane to bypass queue - #71563
kiranvk-2011 wants to merge 1 commit into
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Greptile SummaryThis PR adds Confidence Score: 4/5Safe to merge; only a minor style concern about code duplication. No P0 or P1 issues found. The single P2 (duplicated resolution logic between the two helper functions) does not affect correctness or safety. No files require special attention. Prompt To Fix All With AIThis is a comment left during a code review.
Path: extensions/telegram/src/sequential-key.ts
Line: 51-71
Comment:
**Significant code duplication with `resolveStatusCommandControlLane`**
`resolveSessionControlCommand` is an almost verbatim copy of `resolveStatusCommandControlLane` — identical `normalizeCommandBody` call, `maybeResolveTextAlias` lookup, and `listChatCommands().find()` — differing only in the final predicate. Consider extracting the shared resolution logic into a single private helper so both call-sites share it, reducing future maintenance surface.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(telegram): route /new, /reset, /clea..." | Re-trigger Greptile |
| function resolveSessionControlCommand(params: { | ||
| rawText?: string; | ||
| botUsername?: string; | ||
| }): boolean { | ||
| // Session lifecycle commands (/new, /reset, /clear) must bypass the per-topic | ||
| // sequential queue so they execute immediately even when an agent run is active. | ||
| // Without this, these commands get queued behind the running turn and never | ||
| // actually reset the session. | ||
| const normalizedBody = normalizeCommandBody( | ||
| params.rawText?.trim() ?? "", | ||
| params.botUsername ? { botUsername: params.botUsername } : undefined, | ||
| ); | ||
| const alias = maybeResolveTextAlias(normalizedBody); | ||
| if (!alias) { | ||
| return false; | ||
| } | ||
| const command = listChatCommands().find((entry) => | ||
| entry.textAliases.some((candidate) => candidate.trim().toLowerCase() === alias), | ||
| ); | ||
| return command?.key === "new" || command?.key === "reset" || command?.key === "clear"; | ||
| } |
There was a problem hiding this comment.
Significant code duplication with
resolveStatusCommandControlLane
resolveSessionControlCommand is an almost verbatim copy of resolveStatusCommandControlLane — identical normalizeCommandBody call, maybeResolveTextAlias lookup, and listChatCommands().find() — differing only in the final predicate. Consider extracting the shared resolution logic into a single private helper so both call-sites share it, reducing future maintenance surface.
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/telegram/src/sequential-key.ts
Line: 51-71
Comment:
**Significant code duplication with `resolveStatusCommandControlLane`**
`resolveSessionControlCommand` is an almost verbatim copy of `resolveStatusCommandControlLane` — identical `normalizeCommandBody` call, `maybeResolveTextAlias` lookup, and `listChatCommands().find()` — differing only in the final predicate. Consider extracting the shared resolution logic into a single private helper so both call-sites share it, reducing future maintenance surface.
How can I resolve this? If you propose a fix, please make it concise.
Greptile P2: Resolved ✅Comment: Significant code duplication between Fix: Extracted shared resolution logic into function resolveControlCommand(\n params: { rawText?: string; botUsername?: string },\n predicate: (command: { key: string; category: string }) => boolean,\n): boolean {\n const normalizedBody = normalizeCommandBody(...);\n const alias = maybeResolveTextAlias(normalizedBody);\n if (!alias) return false;\n const command = listChatCommands().find(...);\n return command ? predicate(command) : false;\n}\n\nfunction resolveStatusCommandControlLane(params) {\n return resolveControlCommand(params, (cmd) =>\n cmd.category === "status" && cmd.key !== "export-session");\n}\n\nfunction resolveSessionControlCommand(params) {\n return resolveControlCommand(params, (cmd) =>\n cmd.key === "new" || cmd.key === "reset" || cmd.key === "clear");\n}\n```
Net change: **0 lines added** (19 removed, 19 added — pure refactor).
Thanks for catching this! |
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep this PR open: current main and the latest release still route Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. So I’m closing this here because the remaining work is already tracked in the canonical issue. Review detailsBest possible solution: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main and v2026.6.9 route Is this the best way to solve the issue? No, not yet. The owner surface is right, but the best fix should handle targeted suffixes without bot metadata, add focused tests, and include real Telegram proof before merge. Security review: Security review cleared: The diff only changes Telegram sequential-key classification in TypeScript and does not touch secrets, dependencies, CI, package metadata, permissions, or code-download paths. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 9405b8f075ab. |
7599444 to
5e06249
Compare
5e06249 to
eb4e371
Compare
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
eb4e371 to
cdd04d7
Compare
|
@kiranvk-2011 thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward. Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive. Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it. |
|
@kiranvk-2011 thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward. Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive. Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it. |
|
ClawSweeper applied the proposed close for this PR.
|
Problem
Session lifecycle commands (
/new,/reset) were getting queued behind active agent runs in the Telegram sequential key system. When a user sent one of these commands while an agent was running, the command would be queued and never execute until the agent finished — defeating the purpose of these interrupt commands.Solution
Added
resolveSessionControlCommand()function toextensions/telegram/src/sequential-key.tsthat detects session lifecycle commands and routes them to the:controllane, bypassing the per-topic sequential queue.Changes
resolveControlCommand()predicate-based helper, addedresolveSessionControlCommand()for/newand/resetTechnical Details
The fix follows the same pattern as the existing
resolveStatusCommandControlLane():normalizeCommandBody()maybeResolveTextAlias()listChatCommands()trueif the command key isneworresetWhen detected, these commands route to
telegram:${chatId}:controlinstead of the normal per-topic lane, bypassing the queue and executing immediately.Testing
/newand/resetrouting to control lane/new@bot)