-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Problem
Per-user settings (model, budget, timeout) are currently global env vars (CLAUDE_MODEL, CLAUDE_MAX_BUDGET_USD, CLAUDE_TIMEOUT_SECONDS). In multi-user, each user needs their own defaults. The existing /model command changes the model for the current session, but there is no way for a user to set persistent defaults that survive restarts, nor any command for budget or timeout.
Parent issue: #196 (sub-issue #3)
Proposal
Add a /settings command with subcommands for all per-user preferences. Settings are stored in the database via the existing settings table (sessions.py) and take precedence over users.yaml defaults and env var globals.
Commands
/settings - show all current settings with effective values and their source
/settings model <name> - set default model (opus/sonnet/haiku)
/settings budget <n> - set budget ceiling in USD
/settings timeout <n> - set timeout in seconds
/settings reset - clear all overrides, revert to users.yaml/env defaults
/settings reset <key> - clear a single override (e.g., /settings reset model)
Display
/settings with no arguments shows a summary like:
Model: sonnet (user override)
Budget: $10.00 (users.yaml)
Timeout: 300s (global default)
Each line shows the effective value and where it comes from (database override, users.yaml baseline, env var default, or hardcoded default). This makes the precedence model visible and debuggable.
Storage
Uses the existing settings table with the established namespace convention:
model:{chat_id}- model namebudget:{chat_id}- budget in USDtimeout:{chat_id}- timeout in seconds
This follows the pattern already used by voice settings (voice_mode:{chat_id}, voice_name:{chat_id}).
Precedence (highest to lowest)
- Database (set via
/settingscommands) - users.yaml (admin-set baseline per user)
- Env file (global defaults:
CLAUDE_MODEL,CLAUDE_MAX_BUDGET_USD,CLAUDE_TIMEOUT_SECONDS) - Hardcoded defaults (in config.py)
Relationship to existing /model command
The existing /model and /models commands change the model for the current session. /settings model sets the persistent default. These should be unified: /model should write to the settings table so the choice persists across restarts. The /models inline keyboard should do the same. This is a behavior change but matches user expectations (nobody expects their model choice to reset on restart).
Boundaries
max_budgetin users.yaml acts as a ceiling./settings budgetcannot exceed it. If a user tries, show the admin-set limit.timeoutshould have a reasonable maximum (e.g., 600s) to prevent runaway sessions.- Model choices are validated against
_AVAILABLE_MODELS.
Context
- Settings table: sessions.py lines 432-459 (
get_setting,set_setting,delete_setting) - Current model handling: bot.py
/modeland/modelscommands, pool.set_model() - UserConfig dataclass: config.py lines 86-111
- No
/settingscommand currently exists
Not in scope
github_notify_chat_id- covered by Add PATCH and DELETE endpoints for jobs CRUD API #5 (user-to-repo mapping)pr_review,issue_triagetoggles - covered by Add PATCH and DELETE endpoints for jobs CRUD API #5- Workspace-specific config - covered by Manage per-workspace config via Telegram commands #195
- Allowed workspaces - covered by Fix history lookback to scan beyond yesterday #4