fix(control): allow help/start/read-only commands through guardrails

This commit is contained in:
Prime Backup Bot
2026-03-11 21:39:12 +00:00
parent b3ff4162b7
commit c44cfd4f3d
2 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -148,9 +148,10 @@ def set_autonomous(enabled: bool):
def parse_and_handle(chat_id: int, msg_id: int, text: str) -> str:
raw = text.strip()
risk = classify(raw.lstrip('/'))
normalized = raw.lstrip('/').strip()
risk = classify(normalized)
log_event({'event':'telegram_command','chat_id':chat_id,'msg_id':msg_id,'text':raw,'risk':risk})
if needs_approval(raw.lstrip('/')) and not raw.lower().startswith(('queue add','/queue add')):
if needs_approval(normalized) and not normalized.lower().startswith('queue add'):
return f"Command blocked pending explicit queue workflow. Risk={risk}. Use queue add ... then approve."
if raw.startswith('/start'):
return "Prime online. " + help_text()