feat(gateway): /toggle-enforce-branches command (v0.5.34)#136
feat(gateway): /toggle-enforce-branches command (v0.5.34)#136royosherove wants to merge 2 commits into
Conversation
Adds an immediate runtime kill-switch for pi-branch-enforcer enforcement. /toggle-enforce-branches toggle on<->off /toggle-enforce-branches on|off explicit /toggle-enforce-branches status query only Persists across agent restarts via ~/.pi-branch-enforcer/disabled marker file. Effect is immediate — pi-branch-enforcer >=3.3.0 checks the marker on every bash tool_call, so toggling takes effect on the next command without /restart. - New module src/gateway/toggle-enforce-branches-command.ts - Wired into buildCommandDescriptors() (in-turn, acceptsArgs) - Added to BOT_COMMANDS so it shows up in the Telegram / menu - 10 new unit tests (toggle / explicit / status / aliases / idempotence / unknown-arg) — 550 total green Requires @inceptionstack/pi-branch-enforcer >= 3.3.0
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71d6f2a507
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| { command: "doctor", description: "Run diagnostics" }, | ||
| { command: "crons", description: "List scheduled cron jobs" }, | ||
| { command: "jobs", description: "Show running jobs" }, | ||
| { command: "toggle-enforce-branches", description: "Toggle branch-protection enforcement" }, |
There was a problem hiding this comment.
Rename command to Telegram-safe identifier
The new toggle-enforce-branches entry uses hyphens, but Telegram BotCommand.command only allows lowercase letters, digits, and underscores; when registerCommands() calls setMyCommands, Telegram returns BOT_COMMAND_INVALID for this payload, so startup command registration fails and the bot command menu is not updated. This impacts every Telegram deployment that enables command registration, not just this new command, because the API call validates the full command list.
Useful? React with 👍 / 👎.
Adds an immediate runtime kill-switch for
pi-branch-enforcerenforcement, controllable from Telegram.How it works
Toggles
~/.pi-branch-enforcer/disabledmarker file. When present, pi-branch-enforcer >=3.3.0 fails open on every bash tool_call./restartenable/disable≡on/off/toggle-enforce-branches offwhen already off → "Already in target state"Implementation
src/gateway/toggle-enforce-branches-command.ts(single responsibility, follows/modeland/topicpatterns)buildCommandDescriptors()(in-turn,acceptsArgs: true)BOT_COMMANDSso it shows up in the Telegram/menuTests
10 new unit tests using a tmp $HOME for isolation:
on/off/enable/disablestatus(no state change)550 tests passing (was 540, +10 new).
Companion PR
Requires
@inceptionstack/pi-branch-enforcer>= 3.3.0:inceptionstack/pi-branch-enforcer#new