Register bot command menu on startup - #9
Open
Fr4nzz wants to merge 1 commit into
Open
Conversation
Call setMyCommands on startup so Telegram shows the command menu button (/) in the chat input area. Lists all available commands: /new, /stop, /status, /resume, /restart, /retry.
miracleengineered
pushed a commit
to miracleengineered/miracle
that referenced
this pull request
Apr 23, 2026
Wires the Miracle slice into the bot behind MIRACLE_SLICE_ENABLED flag. All new paths are inert when the flag is off. Handlers (new): - src/handlers/miracle-callback.ts — HMAC-verifies callback_data from approval cards, enforces single-use via miracle_approvals.status transition, max-1-concurrent running-plan check, dispatches to Approve (launches Executor) / Edit / Reject paths. - src/handlers/miracle-commands.ts — /plan <intent>, /miracle_halt, /miracle_status, /miracle_cancel. /plan creates a new forum Topic, runs Planner, persists plan + approval, posts approval card. Underscores in command names because Telegram disallows hyphens. Executor refactor: - Module-level activeControllers Map indexed by planId. runExecutor registers AbortController on start, unregisters in finally. Exports haltPlanId / haltAllPlans / listRunningPlanIds for /miracle_halt and /miracle_cancel. index.ts wiring: - Behind MIRACLE_SLICE_ENABLED: dynamic-import handlers (so modules don't load when flag off), register 4 commands + callback router, extend setMyCommands list. Callback router tries miracle handler first via isMiracleCallback prefix check; falls through to existing handleCallback otherwise. Routing table: - Added miracle-planner → sonnet, miracle-executor → sonnet entries. Automated smokes (24 new tests across 4 files): - miracle-callback-hmac (linuz90#9): sign/verify round-trip, 64-byte budget, forged signature rejected, verdict-swap rejected, malformed input rejected, secret rotation invalidates old callbacks. - miracle-executor-blocklist (linuz90#8): rm -rf /, sudo rm, mkfs, dd if=, case-insensitive match, embedded pattern match, non-Bash tools always allowed. - miracle-planner-retry (linuz90#7): first-try success, retry-on-parse-fail, retry-on-zod-fail, both-fail-throws-PlanValidationError, code-fence tolerance. Uses vi.mock('@anthropic-ai/claude-agent-sdk'). - miracle-auth: withSliceApiKey env swap + restore in both happy and throwing cases. Not yet shipped (launchd plist edit + flag flip = Gate 2 finalize step): - MIRACLE_SLICE_ENABLED=true in the launchd plist - MIRACLE_HMAC_SECRET generation + plist Smoke linuz90#11 (MVP byte-identical when flag off) is live-verified by the currently-running bot (PID 50496, MIRACLE_SLICE_ENABLED unset). Smokes #1-6 and linuz90#10 require Telegram UI and are deferred to the live-in phase with Tren's phone. Total: 230 passed + 1 skipped (was 206+1).
AKhozya
referenced
this pull request
in AKhozya/claude-telegram-bot
Jul 5, 2026
DAIJIROMATSUOKA
pushed a commit
to DAIJIROMATSUOKA/claude-telegram-bot
that referenced
this pull request
Jul 12, 2026
MORNING-MASTER ①小fix のうち直近tick(19:45/21:44)で個別に詰め切っていなかった #1(council.ts topic生replace)とlinuz90#9(callback.ts optionIndex NaN)を実機直読で閉じた。 #1: grep '.replace("{' でplaceholder string-replaceを全列挙=4サイトのみ。 {topic}未保護のstring-replaceは L243(t)/295(topic)/336(topic) の3サイトちょうど。 隣接の {r1Summary}(295)・{allRoundsText}(337) は既に ()=>関数形で保護済 =MASTERの「保護済」claim TRUE=朝は{topic}の3サイトだけ触ればよい(隣接は不変)。 fix意図=String.replace(str,str)は置換文字列の $&/$1 等を特殊解釈so topic本文に $混入でプロンプト破損→()=>topic のリテラル挿入で無害化。バグクラス完全(他replaceは対象外)。 linuz90#9: L167 parseInt→NaN / L188 NaN<0 false ∧ NaN>=len false=validation通過→ options[NaN]=undefined。latent real確認。fix=条件先頭に Number.isNaN(optionIndex)|| 前置。 latent根拠=parts[2]は自bot生成の整数indexso非数値は改竄/破損時のみ=任意扱い妥当。 これで①小fix 9件は全件が行番号+バグクラス完全性レベルで独立verified (linuz90#2-linuz90#8=19:45+21:44 / #1・linuz90#9=本tick)。 read-only(council.ts/callback.ts直読+grep)+新規doc1本+log。src編集/削除/送信/gate緩和=ゼロ。
DAIJIROMATSUOKA
pushed a commit
to DAIJIROMATSUOKA/claude-telegram-bot
that referenced
this pull request
Jul 12, 2026
…ER ① の全9件を live code 8ファイル直読で before→after まで確定(#1 council L243/295/336=生replace→()=>関数形/linuz90#2 security L174=includes("rm ")→/\brm\s//linuz90#3 jarvis-memory L420=per-row safe-parse/linuz90#4 snooze L259-269=per-item try-catch+成功実数log/linuz90#5 text L221=stopProcessing()漏れ1行/linuz90#6 streaming L259=lastContent.set漏れ1行(ユーザー可視MED)/linuz90#7 callback L88=execSync同期→execAsync await化(bot15秒フリーズMED・execSync使用はL12importとL88のみと機械確認)/linuz90#8 file-handler L69=spawnSync→spawn+await proc.exited nuance明記/linuz90#9 callback L188=Number.isNaN前置)。各fixに現状行・反転test・完全性根拠を併記。read-only+新規doc1本+log。src編集/送信/削除/gate緩和=ゼロ。
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
bot.api.setMyCommands()on startup to register the command menu with Telegram/menu button in the chat input area/new,/stop,/status,/resume,/restart,/retryWhy
Currently the bot registers command handlers but never tells Telegram about them, so the command menu button doesn't appear in the chat UI. Users have to know the commands exist and type them manually.
This is a one-line API call that runs once on startup — no behavioral changes, just better discoverability.
Screenshot
After this change, users see a menu button near the text input that lists all available commands with descriptions.