Skip to content

Replace OWNER_USER_ID with ADMIN_CHAT_IDS for admin commands - #18

Merged
robdevops merged 2 commits into
mainfrom
claude/merge-admin-ids
Oct 7, 2026
Merged

robdevops merged 2 commits into
mainfrom
claude/merge-admin-ids

Conversation

@robdevops

Copy link
Copy Markdown
Owner

Consolidate admin access control by replacing the single-user OWNER_USER_ID setting with the existing ADMIN_CHAT_IDS setting, which already handles MCP server down-alerts. This simplifies configuration and makes admin command access consistent with alert routing.

Key changes:

  • Removed OWNER_USER_ID environment variable and Settings.owner_id field
  • Updated /credits and /usage command access control to check user.id in ctx.st.admin_chats instead of comparing against owner_id
  • Reorganized README environment variables table into "Common settings" and "Advanced and optional" sections for clarity
  • Updated ADMIN_CHAT_IDS documentation to clarify that user IDs in the set can use admin commands (/credits, /usage) while group chat IDs only receive MCP down-alerts
  • Updated test to use ADMIN_CHAT_IDS instead of OWNER_USER_ID
  • Updated app.py to check if st.admin_chats instead of if st.owner_id when registering command handlers

Implementation details:

  • The admin_chats field already existed and was being used for alert routing; this change extends it to also gate admin commands
  • User IDs (positive integers) in ADMIN_CHAT_IDS now grant both alert notifications and admin command access
  • Group chat IDs (negative integers) in ADMIN_CHAT_IDS continue to receive only alert notifications
  • Empty ADMIN_CHAT_IDS (default) disables both alerts and admin commands, matching previous behavior where OWNER_USER_ID was unset

https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

claude added 2 commits October 7, 2026 23:03
…to common and advanced

One list now receives MCP-down alerts and authorizes /credits and /usage (a DM chat ID
equals the user ID; group IDs are negative so they can never match a user). OWNER_USER_ID
is still read with a startup warning. ENV_VARS and the README tables share one order.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw
ADMIN_CHAT_IDS is the only variable now; the deprecated alias, its startup warning,
its README note and its test are gone.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw
@robdevops
robdevops merged commit f83a7a9 into main Oct 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants