Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(platform): stabilize routing and session state across channels
cyhb0fd82a3211e
diff --git a/AGENTS.md b/AGENTS.mdindex 5c08b2201..fcc493eed 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -167,6 +167,15 @@ Vibe Remote is a **multi-platform, multi-backend** system. Every feature and bug- `vibe status` / `vibe stop`- Restart: run `vibe`+### Three-End Regression++- When the user says `三端回归测试`, treat it as: update the latest code into the existing three-end regression environment so the user can test on Slack, Discord, and Feishu.+- Default command: `./scripts/run_three_regression.sh`+- Do **not** use `--reset-config` or `--reset-all` unless the user explicitly asks for a reset.+- `./scripts/run_three_regression.sh` is the standard update path for regression testing: it rebuilds/recreates containers while preserving persisted regression data under `_tmp/three-regression/`, including config, state, and workdir changes made during earlier testing.+- Do not use `--no-build` when the goal is to make new code changes take effect; `--no-build` is only for restarting with the existing image.+- After running the script, verify the three services are healthy before handing back to the user.+### Frontend (UI)- Location: `ui/` (React + Vite + TypeScript)diff --git a/config/v2_settings.py b/config/v2_settings.pyindex 3658b867b..0063efde5 100644--- a/config/v2_settings.py+++ b/config/v2_settings.py@@ -84,7 +84,7 @@ class RoutingSettings:# Claude Code settingsclaude_agent: Optional[str] = Noneclaude_model: Optional[str] = None- # Note: Claude Code has no CLI parameter for reasoning effort (Extended Thinking)+ claude_reasoning_effort: Optional[str] = None# Codex settingscodex_model: Optional[str] = Nonecodex_reasoning_effort: Optional[str] = None@@ -143,6 +143,7 @@ def _parse_routing(payload: dict) -> RoutingSettings:opencode_reasoning_effort=payload.get("opencode_reasoning_effort"),claude_agent=payload.get("claude_agent"),claude_model=payload.get("claude_model"),+ claude_reasoning_effort=payload.get("claude_reasoning_effort"),codex_model=payload.get("codex_model"),codex_reasoning_effort=payload.get("codex_reasoning_effort"),)@@ -157,6 +158,7 @@ def _routing_to_dict(routing: RoutingSettings) -> dict:"opencode_reasoning_effort": routing.opencode_reasoning_effort,"claude_agent": routing.claude_agent,"claude_model": routing.claude_model,+ "claude_reasoning_effort": routing.claude_reasoning_effort,"codex_model": routing.codex_model,"codex_reasoning_effort": routing.codex_reasoning_effort,}diff --git a/core/handlers/session_handler.py b/core/handlers/session_handler.pyindex 4cce9b2cd..33dd44c80 100644--- a/core/handlers/session_handler.py+++ b/core/handlers/session_handler.py@@ -1,7 +1,7 @@"""Session management handlers for Claude SDK sessions"""-import osimport logging+import osfrom typing import Optional, Dict, Any, Tuplefrom modules.im import MessageContextfrom claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions@@ -27,7 +27,15 @@ class SessionHandler(BaseHandler):platform = getattr(self.config, "platform", "slack")is_dm = bool((context.platform_specific or {}).get("is_dm", False))if is_dm:- base_id = context.channel_id or context.user_id+ use_dm_threads = False+ im_client = getattr(self.controller, "im_client", None)+ if im_client and hasattr(im_client, "should_use_thread_for_dm_session"):+ use_dm_threads = bool(im_client.should_use_thread_for_dm_session())++ if use_dm_threads:+ base_id = context.thread_id or context.message_id or context.channel_id or context.user_id+ else:+ base_id = context.channel_id or context.user_idelse:base_id = context.thread_id or context.message_id or context.channel_idreturn f"{platform}_{base_id}"@@ -36,6 +44,16 @@ class SessionHandler(BaseHandler):"""Get working directory - delegate to controller's get_cwd"""return self.controller.get_cwd(context)+ def _running_as_root(self) -> bool:+ geteuid = getattr(os, "geteuid", None)+ return bool(geteuid and geteuid() == 0)++ def _should_force_claude_sandbox(self) -> bool:+ if os.environ.get("IS_SANDBOX"):+ return False+ permission_mode = getattr(getattr(self.config, "claude", None), "permission_mode", None)+ return permission_mode == "bypassPermissions" and self._running_as_root()+def _load_agent_file(self, agent_name: str, working_path: str) -> Optional[Dict[str, Any]]:"""Load an agent file and return its parsed content.@@ -97,7 +115,7 @@ class SessionHandler(BaseHandler):effective_agent = subagent_name or (routing.claude_agent if routing else None)# Store explicit model override (not including default yet)explicit_model = subagent_model or (routing.claude_model if routing else None)- # Note: Claude Code has no CLI parameter for reasoning_effort, so we don't use it+ explicit_effort = subagent_reasoning_effort or (routing.claude_reasoning_effort if routing else None)if composite_key in self.claude_sessions and not effective_agent:logger.info(f"Using existing Claude SDK client for {base_session_id} at {working_path}")@@ -157,6 +175,9 @@ class SessionHandler(BaseHandler):# Determine final model: explicit override > agent frontmatter > global defaulteffective_model = explicit_model or agent_model or self.config.claude.default_model+ from modules.agents.opencode.utils import normalize_claude_reasoning_effort++ effective_effort = normalize_claude_reasoning_effort(effective_model, explicit_effort)# Determine final system prompt: agent prompt takes precedence over config.# When reply_enhancements is enabled and no explicit prompt is set,@@ -189,6 +210,9 @@ class SessionHandler(BaseHandler):for key in os.environ:if key.startswith("ANTHROPIC_") or key.startswith("CLAUDE_"):claude_env[key] = os.environ[key]+ if self._should_force_claude_sandbox():+ claude_env["IS_SANDBOX"] = "1"+ logger.info("Detected Claude bypassPermissions running as root; forcing IS_SANDBOX=1 for Claude subprocess")option_kwargs: Dict[str, Any] = {"permission_mode": self.config.claude.permission_mode,@@ -202,6 +226,8 @@ class SessionHandler(BaseHandler):"disallowed_tools": ["AskUserQuestion"],"env": claude_env, # Pass Anthropic/Claude env vars}+ if effective_effort:+ option_kwargs["effort"] = effective_effort# Only set allowed_tools if agent file specifies tools.# Omitting the field keeps SDK default tool behavior.if agent_allowed_tools:@@ -218,6 +244,8 @@ class SessionHandler(BaseHandler):logger.info(f" Subagent: {effective_agent}")if effective_model:logger.info(f" Model: {effective_model}")+ if effective_effort:+ logger.info(f" Effort: {effective_effort}")# Log if we're resuming a sessionif stored_claude_session_id:@@ -283,15 +311,17 @@ class SessionHandler(BaseHandler):settings_key = self._get_settings_key(context)current_routing = self.settings_manager.get_channel_routing(settings_key)- opencode_agent = current_routing.opencode_agent if current_routing else None- opencode_model = current_routing.opencode_model if current_routing else None- opencode_reasoning_effort = current_routing.opencode_reasoning_effort if current_routing else Nonerouting = ChannelRouting(agent_backend=agent,- opencode_agent=opencode_agent,- opencode_model=opencode_model,- opencode_reasoning_effort=opencode_reasoning_effort,+ opencode_agent=current_routing.opencode_agent if current_routing else None,+ opencode_model=current_routing.opencode_model if current_routing else None,+ opencode_reasoning_effort=current_routing.opencode_reasoning_effort if current_routing else None,+ claude_agent=current_routing.claude_agent if current_routing else None,+ claude_model=current_routing.claude_model if current_routing else None,+ claude_reasoning_effort=current_routing.claude_reasoning_effort if current_routing else None,+ codex_model=current_routing.codex_model if current_routing else None,+ codex_reasoning_effort=current_routing.codex_reasoning_effort if current_routing else None,)self.settings_manager.set_channel_routing(settings_key, routing)@@ -307,8 +337,14 @@ class SessionHandler(BaseHandler):confirmation_ts = await self.im_client.send_message(context, confirmation, parse_mode="markdown")mapped_thread = target_thread or confirmation_ts- platform = getattr(self.config, "platform", "slack")- base_session_id = f"{platform}_{mapped_thread}"+ mapping_context = MessageContext(+ user_id=user_id,+ channel_id=context.channel_id,+ thread_id=mapped_thread,+ message_id=confirmation_ts,+ platform_specific={"is_dm": is_dm},+ )+ base_session_id = self.get_base_session_id(mapping_context)self.sessions.set_agent_session_mapping(settings_key, agent, base_session_id, session_id)self.sessions.mark_thread_active(user_id, context.channel_id, mapped_thread)diff --git a/core/handlers/settings_handler.py b/core/handlers/settings_handler.pyindex 1f7bd8e0e..2cb4bc7ee 100644--- a/core/handlers/settings_handler.py+++ b/core/handlers/settings_handler.py@@ -607,6 +607,7 @@ class SettingsHandler(BaseHandler):selected_opencode_reasoning=selection.selected_opencode_reasoning,selected_claude_agent=selection.selected_claude_agent,selected_claude_model=selection.selected_claude_model,+ selected_claude_reasoning=selection.selected_claude_reasoning,selected_codex_model=selection.selected_codex_model,selected_codex_reasoning=selection.selected_codex_reasoning,)@@ -623,6 +624,7 @@ class SettingsHandler(BaseHandler):opencode_reasoning_effort: Optional[str] = None,claude_agent: Optional[str] = None,claude_model: Optional[str] = None,+ claude_reasoning_effort: Optional[str] = None,codex_model: Optional[str] = None,codex_reasoning_effort: Optional[str] = None,notify_user: bool = True,@@ -630,10 +632,15 @@ class SettingsHandler(BaseHandler):):"""Handle routing update submission (from modal)."""from config.v2_settings import RoutingSettings+ from modules.agents.opencode.utils import normalize_claude_reasoning_efforttry:settings_key = user_id if is_dm else (channel_id or user_id)existing_routing = self.settings_manager.get_channel_routing(settings_key)+ normalized_claude_reasoning_effort = normalize_claude_reasoning_effort(+ claude_model,+ claude_reasoning_effort,+ )routing = RoutingSettings(agent_backend=backend,@@ -652,6 +659,9 @@ class SettingsHandler(BaseHandler):claude_model=claude_modelif backend == "claude"else (existing_routing.claude_model if existing_routing else None),+ claude_reasoning_effort=normalized_claude_reasoning_effort+ if backend == "claude"+ else (existing_routing.claude_reasoning_effort if existing_routing else None),codex_model=codex_modelif backend == "codex"else (existing_routing.codex_model if existing_routing else None),@@ -675,6 +685,10 @@ class SettingsHandler(BaseHandler):parts.append(f"{self._t('routing.label.agent')}: **{claude_agent}**")if claude_model:parts.append(f"{self._t('routing.label.model')}: **{claude_model}**")+ if normalized_claude_reasoning_effort:+ parts.append(+ f"{self._t('routing.label.reasoningEffort')}: **{normalized_claude_reasoning_effort}**"+ )elif backend == "codex":if codex_model:parts.append(f"{self._t('routing.label.model')}: **{codex_model}**")@@ -698,6 +712,7 @@ class SettingsHandler(BaseHandler):f"Routing updated for {settings_key}: backend={backend}, "f"opencode_agent={opencode_agent}, opencode_model={opencode_model}, "f"claude_agent={claude_agent}, claude_model={claude_model}, "+ f"claude_reasoning_effort={normalized_claude_reasoning_effort}, "f"codex_model={codex_model}")diff --git a/core/modals.py b/core/modals.pyindex 112df68f6..de2aa05a1 100644--- a/core/modals.py+++ b/core/modals.py@@ -46,5 +46,6 @@ class RoutingModalSelection:selected_opencode_reasoning: Optional[str] = Noneselected_claude_agent: Optional[str] = Noneselected_claude_model: Optional[str] = None+ selected_claude_reasoning: Optional[str] = Noneselected_codex_model: Optional[str] = Noneselected_codex_reasoning: Optional[str] = Nonediff --git a/docs/plans/claude-reasoning-effort-settings.md b/docs/plans/claude-reasoning-effort-settings.mdnew file mode 100644index 000000000..23613c70d--- /dev/null+++ b/docs/plans/claude-reasoning-effort-settings.md@@ -0,0 +1,30 @@+# Claude Reasoning Effort Settings++## Background++- Vibe Remote already exposes reasoning effort controls for OpenCode and Codex in Agent Settings and the Web UI.+- Claude backend routing currently stores `claude_agent` and `claude_model`, but not Claude reasoning effort.+- The current code still contains an outdated assumption that Claude Code does not support a reasoning-effort parameter.+- Latest Claude Code / Agent SDK now supports `effort` in the Python SDK and `--effort` in the CLI.++## Goal++- Add Claude reasoning effort control end-to-end using the current Claude SDK integration path.+- Keep UX aligned with existing OpenCode/Codex settings and reuse shared option-building logic where practical.++## Proposed Solution++1. Extend shared routing data structures with `claude_reasoning_effort`.+2. Add a shared Claude reasoning-option helper that returns allowed values per selected model.+3. Pass the selected Claude effort into `ClaudeAgentOptions(effort=...)`.+4. Expose Claude reasoning effort in Slack, Discord, Feishu Agent Settings.+5. Expose Claude reasoning effort in the Web UI channel/user settings.+6. Validate with targeted Python/UI checks and update the three-end regression environment.++## Todo++- [x] Extend routing/config/state models with Claude reasoning effort.+- [x] Add shared Claude reasoning option builder and backend wiring.+- [x] Add Claude reasoning selectors to Slack/Discord/Feishu Agent Settings.+- [x] Add Claude reasoning selectors to Web UI channel/user settings.+- [x] Validate changes and sync them to the three-end regression environment.diff --git a/docs/plans/feishu-claude-mobile-discord-fixes.md b/docs/plans/feishu-claude-mobile-discord-fixes.mdnew file mode 100644index 000000000..897ef087d--- /dev/null+++ b/docs/plans/feishu-claude-mobile-discord-fixes.md@@ -0,0 +1,28 @@+# Feishu Claude + Mobile UI + Discord Menu Fixes++## Background++- In the three-end regression environment, the Feishu instance (`15133`) fails when Claude is selected as the backend.+- The observed runtime error is `Command failed with exit code 1`, with stderr indicating `--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons`.+- The mobile Web UI currently allows the fixed bottom tab bar to cover the last visible portion of page content.+- On Discord, successful menu submissions leave the original interactive message behind as `submitted`, even though a fresh success message is already sent.++## Goal++- Make Claude work in the containerized three-end regression environment without resetting user state.+- Prevent the mobile bottom navigation from obscuring page content.+- Dismiss successful Discord operation menus instead of replacing them with a `submitted` placeholder.++## Proposed Solution++1. Detect Claude sessions that run as root and pass `IS_SANDBOX=1` to the Claude subprocess when bypass permissions mode is active.+2. Add mobile bottom spacing that matches the fixed bottom navigation height and safe-area inset.+3. On successful Discord settings/routing submissions, delete the original interactive message and only fall back to `submitted` text if deletion fails.++## Todo++- [x] Add Claude container/root compatibility handling in the shared session layer.+- [x] Add a regression test for the Claude sandbox env decision.+- [x] Update the mobile shell layout to reserve space for the bottom nav.+- [x] Update Discord operation menu success handling to dismiss the original message.+- [x] Run targeted validation and regression checks.diff --git a/docs/plans/feishu-dm-thread-session-and-dm-thread-research.md b/docs/plans/feishu-dm-thread-session-and-dm-thread-research.mdnew file mode 100644index 000000000..5db6e6159--- /dev/null+++ b/docs/plans/feishu-dm-thread-session-and-dm-thread-research.md@@ -0,0 +1,39 @@+# Feishu DM Thread Sessions And DM Thread Research++## Background++- Discord DMs were intentionally changed to avoid thread-based session routing because Discord DMs do not support threads.+- Feishu DMs currently still carry thread metadata, but the shared session base-id logic treats all DMs as a single session.+- That mismatch causes Feishu DM conversations to open threads while still collapsing into one session.+- We also need to verify whether Slack and Discord DMs can support thread-based session semantics.++## Goal++- Make Feishu DMs follow the same session model as normal channel threads: one thread equals one session.+- Keep Discord DMs on the existing single-DM-session behavior.+- Document the current product/platform reality for Slack and Discord DM thread capability.++## Proposed Solution++1. Add a platform capability hook for whether DMs support thread-based sessions.+2. Use that hook in the shared `SessionHandler` so DM session base IDs can be thread-based only on platforms that support it.+3. Set Slack and Feishu to support DM threads, and keep Discord disabled.+4. Add targeted tests for DM session base-id behavior.+5. Research Slack and Discord DM thread support from platform documentation and summarize the result.++## Research Findings++- Slack supports threads in direct messages. Slack Help explicitly says threads help avoid clutter in "a channel or direct message (DM) conversation" and documents replying in a DM thread.+- Discord threads are guild-channel features, not DM features. Discord's Threads FAQ and developer docs describe threads as sub-channels inside existing server channels, with parent types like `GUILD_TEXT` and `GUILD_ANNOUNCEMENT`.+- Product decision for Vibe Remote should therefore be:+ - Slack DM: thread-based sessions are supported.+ - Feishu DM: thread-based sessions are supported.+ - Discord DM: keep single-DM-session behavior.++## Todo++- [x] Add shared IM capability for DM thread sessions.+- [x] Update session base-id logic to respect platform DM thread capability.+- [x] Add regression tests for Slack/Discord/Feishu DM session behavior.+- [x] Research Slack and Discord DM thread support and summarize the findings.+- [x] Validate changes and sync them to the three-end regression environment.diff --git a/modules/agents/opencode/utils.py b/modules/agents/opencode/utils.pyindex 5a0cb79b3..25d34989f 100644--- a/modules/agents/opencode/utils.py+++ b/modules/agents/opencode/utils.py@@ -1,7 +1,7 @@"""Agent helper utilities (reasoning options, model lists, etc.).Keep this module free of agent state. It should only contain pure helpers.-Shared by OpenCode and Codex backends for reasoning-effort option building.+Shared by OpenCode, Claude, and Codex integrations for reasoning-effort option building."""from __future__ import annotations@@ -322,6 +322,8 @@ def build_reasoning_effort_options(# Defined here so that every IM module shares a single source of truth._CODEX_REASONING_EFFORTS = ["minimal", "low", "medium", "high", "xhigh"]+_CLAUDE_REASONING_EFFORTS = ["low", "medium", "high"]+_CLAUDE_MAX_MODEL_MARKERS = ["claude-opus-4-6"]def build_codex_reasoning_options() -> List[Dict[str, str]]:@@ -340,3 +342,35 @@ def build_codex_reasoning_options() -> List[Dict[str, str]]:})return options+++def build_claude_reasoning_options(target_model: Optional[str]) -> List[Dict[str, str]]:+ """Return the canonical Claude reasoning-effort option list for a model.++ Claude currently supports `low` / `medium` / `high` broadly, while `max`+ is only valid for Opus 4.6.+ """++ normalized_model = (target_model or "").strip().lower()+ efforts = list(_CLAUDE_REASONING_EFFORTS)+ if normalized_model and any(marker in normalized_model for marker in _CLAUDE_MAX_MODEL_MARKERS):+ efforts.append("max")++ options: List[Dict[str, str]] = [{"value": "__default__", "label": "(Default)"}]+ for effort in efforts:+ options.append(+ {+ "value": effort,+ "label": _REASONING_VARIANT_LABELS.get(effort, effort.capitalize()),+ }+ )+ return options+++def normalize_claude_reasoning_effort(target_model: Optional[str], effort: Optional[str]) -> Optional[str]:+ """Return a Claude effort only when it is valid for the target model."""++ if not effort:+ return None+ allowed = {item["value"] for item in build_claude_reasoning_options(target_model)}+ return effort if effort in allowed else Nonediff --git a/modules/im/base.py b/modules/im/base.pyindex 0bfdc48b6..34e49edfe 100644--- a/modules/im/base.py+++ b/modules/im/base.py@@ -128,6 +128,14 @@ class BaseIMClient(ABC):# Default implementation - subclasses should overridereturn False+ def should_use_thread_for_dm_session(self) -> bool:+ """Check if DM conversations should use thread-based session IDs.++ Platforms differ here: some DMs support thread/topic replies, while+ others only have a flat DM timeline.+ """+ return False+@staticmethoddef extract_command_action(text: str) -> str:"""Extract command action name from slash command text.diff --git a/modules/im/discord.py b/modules/im/discord.pyindex 6d6566b98..837270302 100644--- a/modules/im/discord.py+++ b/modules/im/discord.py@@ -15,6 +15,7 @@ from config.v2_config import DiscordConfigfrom .formatters import DiscordFormatterfrom vibe.i18n import get_supported_languages, t as i18n_tfrom modules.agents.opencode.utils import (+ build_claude_reasoning_options,build_opencode_model_option_items,build_codex_reasoning_options,build_reasoning_effort_options,@@ -148,6 +149,9 @@ class DiscordBot(BaseIMClient):def should_use_thread_for_reply(self) -> bool:return True+ def should_use_thread_for_dm_session(self) -> bool:+ return False+def format_markdown(self, text: str) -> str:return text@@ -552,6 +556,26 @@ class DiscordBot(BaseIMClient):except Exception as err:logger.debug("Failed to send channel auth denial: %s", err)+ async def _dismiss_interaction_message(self, interaction: discord.Interaction, fallback_text: str) -> None:+ """Delete the source interaction message, with edit fallback when delete is unavailable."""+ if interaction.message is not None:+ try:+ await interaction.message.delete()+ return+ except Exception as err:+ logger.debug("Failed to delete Discord interaction message directly: %s", err)++ try:+ await interaction.delete_original_response()+ return+ except Exception as err:+ logger.debug("Failed to delete Discord original interaction response: %s", err)++ try:+ await interaction.edit_original_response(content=fallback_text, embed=None, view=None)+ except Exception as err:+ logger.warning("Failed to dismiss Discord interaction message after successful submit: %s", err)+async def _maybe_create_thread(self, message: discord.Message) -> Optional[discord.Thread]:if isinstance(message.channel, discord.Thread):return message.channel@@ -901,11 +925,7 @@ class DiscordBot(BaseIMClient):notify_user=True,is_dm=save_interaction.guild is None,)- await save_interaction.edit_original_response(- content=f"✅ {self._t('common.submitted')}",- embed=None,- view=None,- )+ await self._dismiss_interaction_message(save_interaction, f"✅ {self._t('common.submitted')}")except Exception as err:await save_interaction.edit_original_response(content=f"❌ {self._t('error.settingsUpdateFailed', error=str(err))}",@@ -1103,6 +1123,9 @@ class DiscordBot(BaseIMClient):)self.claude_agent = getattr(current_routing, "claude_agent", None) if current_routing else Noneself.claude_model = getattr(current_routing, "claude_model", None) if current_routing else None+ self.claude_reasoning = (+ getattr(current_routing, "claude_reasoning_effort", None) if current_routing else None+ )self.codex_model = getattr(current_routing, "codex_model", None) if current_routing else Noneself.codex_reasoning = (getattr(current_routing, "codex_reasoning_effort", None) if current_routing else None@@ -1342,11 +1365,58 @@ class DiscordBot(BaseIMClient):async def claude_model_callback(select_interaction: discord.Interaction):if model_select.values:self.claude_model = model_select.values[0]- await select_interaction.response.defer()+ self.claude_reasoning = None+ self._render()+ updated_embed = discord.Embed(+ title=self._content(),+ description=self.outer._t("discord.routingSubtitle"),+ )+ await select_interaction.response.edit_message(embed=updated_embed, view=self)model_select.callback = claude_model_callbackself.add_item(model_select)+ claude_reasoning_entries = build_claude_reasoning_options(+ self.claude_model if self.claude_model not in (None, "__default__") else None+ )+ selected_cl_reasoning = (+ self.claude_reasoning if self.claude_reasoning not in (None, "__default__") else "__default__"+ )+ available_cl_reasoning = {entry.get("value") for entry in claude_reasoning_entries}+ if selected_cl_reasoning not in available_cl_reasoning:+ selected_cl_reasoning = "__default__"+ reasoning_options = []+ for entry in claude_reasoning_entries:+ value = entry.get("value")+ if not value:+ continue+ if value == "__default__":+ label = self.outer._t("common.default")+ else:+ translated = self.outer._t(f"reasoning.{value}")+ label = translated if translated != f"reasoning.{value}" else entry.get("label", value)+ reasoning_options.append(+ discord.SelectOption(+ label=_prefixed_label("discord.labels.reasoningEffort", label),+ value=value,+ default=value == selected_cl_reasoning,+ )+ )+ reasoning_select = discord.ui.Select(+ placeholder=self.outer._t("modal.routing.selectReasoningEffort"),+ options=reasoning_options,+ min_values=1,+ max_values=1,+ )++ async def claude_reasoning_callback(select_interaction: discord.Interaction):+ if reasoning_select.values:+ self.claude_reasoning = reasoning_select.values[0]+ await select_interaction.response.defer()++ reasoning_select.callback = claude_reasoning_callback+ self.add_item(reasoning_select)+if self.selected_backend == "codex":model_options = [discord.SelectOption(@@ -1462,15 +1532,15 @@ class DiscordBot(BaseIMClient):_normalize(self.oc_reasoning),_normalize(self.claude_agent),_normalize(self.claude_model),+ _normalize(self.claude_reasoning),_normalize(self.codex_model),_normalize(self.codex_reasoning),notify_user=True,is_dm=interaction.guild is None,)- await interaction.edit_original_response(- content=f"✅ {self.outer._t('common.submitted')}",- embed=None,- view=None,+ await self.outer._dismiss_interaction_message(+ interaction,+ f"✅ {self.outer._t('common.submitted')}",)except Exception as err:await interaction.edit_original_response(diff --git a/modules/im/feishu.py b/modules/im/feishu.pyindex f035b2b9d..e577ad882 100644--- a/modules/im/feishu.py+++ b/modules/im/feishu.py@@ -15,6 +15,8 @@ from .formatters import FeishuFormatterfrom config.v2_config import LarkConfigfrom vibe.i18n import get_supported_languages, t as i18n_tfrom modules.agents.opencode.utils import (+ build_claude_reasoning_options,+ build_codex_reasoning_options,build_opencode_model_option_items,build_reasoning_effort_options,resolve_opencode_allowed_providers,@@ -147,6 +149,9 @@ class FeishuBot(BaseIMClient):def should_use_thread_for_reply(self) -> bool:return True+ def should_use_thread_for_dm_session(self) -> bool:+ return True+def _get_sdk_domain(self) -> str:"""Return the lark-oapi SDK domain constant based on config."""import lark_oapi as lark@@ -1671,6 +1676,7 @@ class FeishuBot(BaseIMClient):opencode_reasoning = _val("opencode_reasoning")claude_agent = _val("claude_agent")claude_model = _val("claude_model")+ claude_reasoning = _val("claude_reasoning")codex_model = _val("codex_model")codex_reasoning = _val("codex_reasoning")@@ -1684,6 +1690,7 @@ class FeishuBot(BaseIMClient):opencode_reasoning,claude_agent,claude_model,+ claude_reasoning,codex_model,codex_reasoning,is_dm=context.platform_specific.get("is_dm", False),@@ -2231,6 +2238,7 @@ class FeishuBot(BaseIMClient):# ---- Claude section ----elif selected_backend == "claude":+ cl_current_model = getattr(current_routing, "claude_model", None) if current_routing else None# Claude agent selectorif claude_agents:cl_agent_options = [{"text": {"tag": "plain_text", "content": "(Default)"}, "value": "__default__"}]@@ -2255,7 +2263,6 @@ class FeishuBot(BaseIMClient):for m in claude_models:mid = m if isinstance(m, str) else m.get("id", str(m))cl_model_options.append({"text": {"tag": "plain_text", "content": mid}, "value": mid})- cl_current_model = getattr(current_routing, "claude_model", None) if current_routing else Noneform_elements.append({"tag": "markdown", "content": t("modal.routing.model")})form_elements.append({@@ -2267,6 +2274,22 @@ class FeishuBot(BaseIMClient):})+ cl_current_re = getattr(current_routing, "claude_reasoning_effort", None) if current_routing else None+ cl_re_defs = build_claude_reasoning_options(cl_current_model)+ cl_re_options = []+ for item in cl_re_defs:+ cl_re_options.append({"text": {"tag": "plain_text", "content": item["label"]}, "value": item["value"]})+ form_elements.append({"tag": "markdown", "content": t("modal.routing.reasoningEffort")})+ form_elements.append(+ {+ "tag": "select_static",+ "name": "claude_reasoning",+ "placeholder": {"tag": "plain_text", "content": t("modal.routing.selectReasoningEffort")},+ "options": cl_re_options,+ "initial_option": cl_current_re if cl_current_re else "__default__",+ }+ )+# ---- Codex section ----elif selected_backend == "codex":# Codex model selector@@ -2287,9 +2310,6 @@ class FeishuBot(BaseIMClient):})- # Codex reasoning effort — reuse shared builder for consistency- from modules.agents.opencode.utils import build_codex_reasoning_options-codex_re_defs = build_codex_reasoning_options()cx_re_options = []for item in codex_re_defs:diff --git a/modules/im/slack.py b/modules/im/slack.pyindex 10227511e..0291fe7e3 100644--- a/modules/im/slack.py+++ b/modules/im/slack.py@@ -18,6 +18,7 @@ from .formatters import SlackFormatterfrom .slack_modal import parse_routing_modal_selectionfrom vibe.i18n import get_supported_languages, t as i18n_tfrom modules.agents.opencode.utils import (+ build_claude_reasoning_options,build_opencode_model_option_items,build_codex_reasoning_options,build_reasoning_effort_options,@@ -111,6 +112,10 @@ class SlackBot(BaseIMClient):"""Slack uses threads for replies"""return True+ def should_use_thread_for_dm_session(self) -> bool:+ """Slack DMs also support thread-based replies."""+ return True+def _ensure_clients(self):"""Ensure web and socket clients are initialized"""if self.web_client is None:@@ -1518,6 +1523,12 @@ class SlackBot(BaseIMClient):if claude_model == "__default__":claude_model = None+ # Extract Claude reasoning effort (optional)+ claude_reasoning_data = values.get("claude_reasoning_block", {}).get("claude_reasoning_select", {})+ claude_reasoning = claude_reasoning_data.get("selected_option", {}).get("value")+ if claude_reasoning == "__default__":+ claude_reasoning = None+# Extract Codex model (optional)codex_model_data = values.get("codex_model_block", {}).get("codex_model_select", {})codex_model = codex_model_data.get("selected_option", {}).get("value")@@ -1550,6 +1561,7 @@ class SlackBot(BaseIMClient):oc_reasoning,claude_agent,claude_model,+ claude_reasoning,codex_model,codex_reasoning,is_dm=isinstance(channel_id, str) and channel_id.startswith("D"),@@ -2296,6 +2308,7 @@ class SlackBot(BaseIMClient):selected_opencode_reasoning: object = _UNSET,selected_claude_agent: object = _UNSET,selected_claude_model: object = _UNSET,+ selected_claude_reasoning: object = _UNSET,selected_codex_model: object = _UNSET,selected_codex_reasoning: object = _UNSET,) -> dict:@@ -2553,6 +2566,11 @@ class SlackBot(BaseIMClient):else:current_cl_model = selected_claude_model+ if selected_claude_reasoning is _UNSET:+ current_cl_reasoning = current_routing.claude_reasoning_effort if current_routing else None+ else:+ current_cl_reasoning = selected_claude_reasoning+# Build agent optionscl_agent_options = [{"text": {"type": "plain_text", "text": self._t("common.default")}, "value": "__default__"}@@ -2626,6 +2644,44 @@ class SlackBot(BaseIMClient):"initial_option": initial_cl_model,}+ cl_reasoning_entries = build_claude_reasoning_options(current_cl_model)+ selected_cl_reasoning = (+ current_cl_reasoning if current_cl_reasoning not in (None, "__default__") else "__default__"+ )+ available_cl_reasoning = {entry.get("value") for entry in cl_reasoning_entries}+ if selected_cl_reasoning not in available_cl_reasoning:+ selected_cl_reasoning = "__default__"++ cl_reasoning_options = []+ for entry in cl_reasoning_entries:+ value = entry.get("value")+ if not value:+ continue+ if value == "__default__":+ label = self._t("common.default")+ else:+ translated = self._t(f"reasoning.{value}")+ label = translated if translated != f"reasoning.{value}" else entry.get("label", value)+ cl_reasoning_options.append(+ {+ "text": {"type": "plain_text", "text": label},+ "value": value,+ }+ )++ initial_cl_reasoning = next(+ (opt for opt in cl_reasoning_options if opt["value"] == selected_cl_reasoning),+ cl_reasoning_options[0],+ )++ cl_reasoning_select = {+ "type": "static_select",+ "action_id": "claude_reasoning_select",+ "placeholder": {"type": "plain_text", "text": self._t("modal.routing.selectReasoningEffort")},+ "options": cl_reasoning_options,+ "initial_option": initial_cl_reasoning,+ }+# Add Claude sectionblocks.extend([@@ -2648,9 +2704,17 @@ class SlackBot(BaseIMClient):"type": "input","block_id": "claude_model_block","optional": True,+ "dispatch_action": True,"element": cl_model_select,"label": {"type": "plain_text", "text": self._t("modal.routing.model")},},+ {+ "type": "input",+ "block_id": "claude_reasoning_block",+ "optional": True,+ "element": cl_reasoning_select,+ "label": {"type": "plain_text", "text": self._t("modal.routing.reasoningEffort")},+ },])@@ -3114,6 +3178,7 @@ class SlackBot(BaseIMClient):selected_opencode_reasoning: Optional[str] = None,selected_claude_agent: Optional[str] = None,selected_claude_model: Optional[str] = None,+ selected_claude_reasoning: Optional[str] = None,selected_codex_model: Optional[str] = None,selected_codex_reasoning: Optional[str] = None,) -> None:@@ -3137,6 +3202,7 @@ class SlackBot(BaseIMClient):selected_opencode_reasoning=selected_opencode_reasoning,selected_claude_agent=selected_claude_agent,selected_claude_model=selected_claude_model,+ selected_claude_reasoning=selected_claude_reasoning,selected_codex_model=selected_codex_model,selected_codex_reasoning=selected_codex_reasoning,)diff --git a/modules/im/slack_modal.py b/modules/im/slack_modal.pyindex 656684c5a..cf644920d 100644--- a/modules/im/slack_modal.py+++ b/modules/im/slack_modal.py@@ -55,6 +55,7 @@ def parse_routing_modal_selection(claude_agent = _extract_selected_value(values, "claude_agent_block", "claude_agent_select")claude_model = _extract_selected_value(values, "claude_model_block", "claude_model_select")+ claude_reasoning = _extract_selected_value(values, "claude_reasoning_block", "claude_reasoning_select")codex_model = _extract_selected_value(values, "codex_model_block", "codex_model_select")codex_reasoning = _extract_prefixed_selected_value(values, "codex_reasoning_block", "codex_reasoning_select")@@ -69,6 +70,8 @@ def parse_routing_modal_selection(claude_agent = selected_valueelif selected_action_id == "claude_model_select":claude_model = selected_value+ elif selected_action_id == "claude_reasoning_select":+ claude_reasoning = selected_valueelif selected_action_id == "codex_model_select":codex_model = selected_valueelif selected_action_id.startswith("codex_reasoning_select"):@@ -81,6 +84,7 @@ def parse_routing_modal_selection(selected_opencode_reasoning=_normalize_default(oc_reasoning),selected_claude_agent=_normalize_default(claude_agent),selected_claude_model=_normalize_default(claude_model),+ selected_claude_reasoning=_normalize_default(claude_reasoning),selected_codex_model=_normalize_default(codex_model),selected_codex_reasoning=_normalize_default(codex_reasoning),)diff --git a/modules/settings_manager.py b/modules/settings_manager.pyindex 0550a8414..47e5c0acb 100644--- a/modules/settings_manager.py+++ b/modules/settings_manager.py@@ -34,6 +34,7 @@ def _routing_from_dict(payload: Optional[dict]) -> RoutingSettings:opencode_reasoning_effort=data.get("opencode_reasoning_effort"),claude_agent=data.get("claude_agent"),claude_model=data.get("claude_model"),+ claude_reasoning_effort=data.get("claude_reasoning_effort"),codex_model=data.get("codex_model"),codex_reasoning_effort=data.get("codex_reasoning_effort"),)diff --git a/tests/test_claude_container_sandbox.py b/tests/test_claude_container_sandbox.pynew file mode 100644index 000000000..ce6433bd1--- /dev/null+++ b/tests/test_claude_container_sandbox.py@@ -0,0 +1,65 @@+from __future__ import annotations++from dataclasses import dataclass, field+import os+from pathlib import Path+import sys++sys.path.insert(0, str(Path(__file__).resolve().parents[1]))++from core.handlers.session_handler import SessionHandler+++@dataclass+class _ClaudeConfig:+ permission_mode: str = "bypassPermissions"+++@dataclass+class _Config:+ platform: str = "lark"+ claude: _ClaudeConfig = field(default_factory=_ClaudeConfig)+++class _Controller:+ def __init__(self) -> None:+ self.config = _Config()+ self.im_client = type("IM", (), {"formatter": None})()+ self.settings_manager = type("Settings", (), {"sessions": None})()+ self.session_manager = object()+ self.claude_sessions = {}+ self.receiver_tasks = {}+ self.stored_session_mappings = {}++ def get_cwd(self, context): # pragma: no cover - unused in these tests+ return "/tmp/workdir"++ def _get_settings_key(self, context): # pragma: no cover - unused in these tests+ return "dummy"+++def test_force_claude_sandbox_in_root_container(monkeypatch) -> None:+ monkeypatch.delenv("IS_SANDBOX", raising=False)+ monkeypatch.setattr(os, "geteuid", lambda: 0, raising=False)++ handler = SessionHandler(_Controller())++ assert handler._should_force_claude_sandbox() is True+++def test_skip_forced_sandbox_when_env_already_set(monkeypatch) -> None:+ monkeypatch.setenv("IS_SANDBOX", "1")+ monkeypatch.setattr(os, "geteuid", lambda: 0, raising=False)++ handler = SessionHandler(_Controller())++ assert handler._should_force_claude_sandbox() is False+++def test_skip_forced_sandbox_when_not_root(monkeypatch) -> None:+ monkeypatch.delenv("IS_SANDBOX", raising=False)+ monkeypatch.setattr(os, "geteuid", lambda: 501, raising=False)++ handler = SessionHandler(_Controller())++ assert handler._should_force_claude_sandbox() is Falsediff --git a/tests/test_claude_reasoning_options.py b/tests/test_claude_reasoning_options.pynew file mode 100644index 000000000..a38d6ad56--- /dev/null+++ b/tests/test_claude_reasoning_options.py@@ -0,0 +1,44 @@+from __future__ import annotations++import sys+import importlib.util+from pathlib import Path++sys.path.insert(0, str(Path(__file__).resolve().parents[1]))+++def _load_utils_module():+ module_path = Path(__file__).resolve().parents[1] / "modules" / "agents" / "opencode" / "utils.py"+ spec = importlib.util.spec_from_file_location("opencode_utils_for_test", module_path)+ assert spec and spec.loader+ module = importlib.util.module_from_spec(spec)+ spec.loader.exec_module(module)+ return module+++_utils = _load_utils_module()+build_claude_reasoning_options = _utils.build_claude_reasoning_options+normalize_claude_reasoning_effort = _utils.normalize_claude_reasoning_effort+++def test_claude_reasoning_options_default_to_low_medium_high() -> None:+ options = build_claude_reasoning_options(None)++ assert [item["value"] for item in options] == ["__default__", "low", "medium", "high"]+++def test_claude_reasoning_options_add_max_for_opus_46() -> None:+ options = build_claude_reasoning_options("claude-opus-4-6")++ assert [item["value"] for item in options] == ["__default__", "low", "medium", "high", "max"]+++def test_claude_reasoning_options_do_not_add_max_for_sonnet_46() -> None:+ options = build_claude_reasoning_options("claude-sonnet-4-6")++ assert [item["value"] for item in options] == ["__default__", "low", "medium", "high"]+++def test_normalize_claude_reasoning_effort_drops_invalid_max() -> None:+ assert normalize_claude_reasoning_effort("claude-sonnet-4-6", "max") is None+ assert normalize_claude_reasoning_effort("claude-opus-4-6", "max") == "max"diff --git a/tests/test_resume_session.py b/tests/test_resume_session.pyindex a97306421..53b5c9c66 100644--- a/tests/test_resume_session.py+++ b/tests/test_resume_session.py@@ -68,7 +68,7 @@ class _StubController(Controller):self.session_handler = SessionHandler(self)def _get_settings_key(self, context: MessageContext) -> str:- return context.channel_id+ return context.user_id if (context.platform_specific or {}).get("is_dm") else context.channel_idclass ResumeSessionTests(unittest.IsolatedAsyncioTestCase):@@ -111,6 +111,44 @@ class ResumeSessionTests(unittest.IsolatedAsyncioTestCase):self.assertEqual(settings.set_calls, [("DXYZ", "codex", "slack_T1", "sess_dm")])self.assertEqual(settings.mark_calls, [("U999", "DXYZ", "T1")])+ async def test_handle_resume_session_submission_discord_dm_uses_channel_session_key(self):+ settings = _StubSettingsManager()+ im_client = _StubIMClient()+ ctrl = _StubController()+ ctrl.init_minimal(im_client, settings, _StubConfig(platform="discord"))+ ctrl.im_client.should_use_thread_for_dm_session = lambda: False++ await ctrl.session_handler.handle_resume_session_submission(+ user_id="U999",+ channel_id="DMCHAN",+ thread_id=None,+ agent="codex",+ session_id="sess_dm",+ is_dm=True,+ )++ self.assertEqual(settings.set_calls, [("U999", "codex", "discord_DMCHAN", "sess_dm")])+ self.assertEqual(settings.mark_calls, [("U999", "DMCHAN", "T1")])++ async def test_handle_resume_session_submission_lark_dm_uses_thread_session_key(self):+ settings = _StubSettingsManager()+ im_client = _StubIMClient()+ ctrl = _StubController()+ ctrl.init_minimal(im_client, settings, _StubConfig(platform="lark"))+ ctrl.im_client.should_use_thread_for_dm_session = lambda: True++ await ctrl.session_handler.handle_resume_session_submission(+ user_id="U888",+ channel_id="DMCHAT",+ thread_id="root_123",+ agent="claude",+ session_id="sess_lark_dm",+ is_dm=True,+ )++ self.assertEqual(settings.set_calls, [("U888", "claude", "lark_root_123", "sess_lark_dm")])+ self.assertEqual(settings.mark_calls, [("U888", "DMCHAT", "root_123")])+async def test_command_handlers_handle_resume_opens_modal(self):settings = _StubSettingsManager()im_client = _StubIMClient()diff --git a/tests/test_routing_modal_selection.py b/tests/test_routing_modal_selection.pyindex c2cf2aec9..602ff04c7 100644--- a/tests/test_routing_modal_selection.py+++ b/tests/test_routing_modal_selection.py@@ -23,6 +23,7 @@ def test_parse_routing_modal_selection_normalizes_default_values():"state": {"values": {"claude_model_block": {"claude_model_select": {"selected_option": {"value": "__default__"}}},+ "claude_reasoning_block": {"claude_reasoning_select": {"selected_option": {"value": "__default__"}}},"codex_reasoning_block": {"codex_reasoning_select_1": {"selected_option": {"value": "__default__"}}},}}@@ -32,4 +33,5 @@ def test_parse_routing_modal_selection_normalizes_default_values():assert selection.selected_backend == "claude"assert selection.selected_claude_model is None+ assert selection.selected_claude_reasoning is Noneassert selection.selected_codex_reasoning is Nonediff --git a/tests/test_session_handler_base_id.py b/tests/test_session_handler_base_id.pyindex f6a97c805..194e486db 100644--- a/tests/test_session_handler_base_id.py+++ b/tests/test_session_handler_base_id.py@@ -16,9 +16,14 @@ class _Config:class _Controller:- def __init__(self) -> None:+ def __init__(self, *, platform: str = "discord", dm_threads: bool = False) -> None:self.config = _Config()- self.im_client = type("IM", (), {"formatter": None})()+ self.config.platform = platform+ self.im_client = type(+ "IM",+ (),+ {"formatter": None, "should_use_thread_for_dm_session": lambda self: dm_threads},+ )()self.settings_manager = type("Settings", (), {"sessions": None})()self.session_manager = object()self.claude_sessions = {}@@ -33,10 +38,11 @@ class _Controller:def test_dm_session_base_id_uses_stable_channel_id() -> None:- handler = SessionHandler(_Controller())+ handler = SessionHandler(_Controller(platform="discord", dm_threads=False))context = MessageContext(user_id="u-1",channel_id="dm-123",+ thread_id="thread-999",message_id="msg-999",platform_specific={"is_dm": True},)@@ -44,6 +50,32 @@ def test_dm_session_base_id_uses_stable_channel_id() -> None:assert handler.get_base_session_id(context) == "discord_dm-123"+def test_dm_session_base_id_uses_thread_when_platform_supports_dm_threads() -> None:+ handler = SessionHandler(_Controller(platform="lark", dm_threads=True))+ context = MessageContext(+ user_id="u-1",+ channel_id="dm-123",+ thread_id="thread-999",+ message_id="msg-999",+ platform_specific={"is_dm": True},+ )++ assert handler.get_base_session_id(context) == "lark_thread-999"+++def test_slack_dm_session_base_id_uses_thread_when_supported() -> None:+ handler = SessionHandler(_Controller(platform="slack", dm_threads=True))+ context = MessageContext(+ user_id="u-1",+ channel_id="D123",+ thread_id="171717.999",+ message_id="171717.111",+ platform_specific={"is_dm": True},+ )++ assert handler.get_base_session_id(context) == "slack_171717.999"++def test_channel_session_base_id_keeps_thread_or_message_behavior() -> None:handler = SessionHandler(_Controller())context = MessageContext(diff --git a/ui/src/components/AppShell.tsx b/ui/src/components/AppShell.tsxindex 38121c80a..65d24ab7c 100644--- a/ui/src/components/AppShell.tsx+++ b/ui/src/components/AppShell.tsx@@ -35,7 +35,7 @@ export const AppShell: React.FC = () => {}return (- <div className="min-h-screen flex bg-bg text-text font-sans">+ <div className="min-h-screen min-h-[100dvh] flex bg-bg text-text font-sans">{/* Sidebar */}<aside className="w-64 border-r border-border bg-panel hidden md:flex flex-col"><div className="p-6 border-b border-border">@@ -69,12 +69,12 @@ export const AppShell: React.FC = () => {</aside>{/* Main Content */}- <main className="flex-1 overflow-auto p-4 md:p-8">+ <main className="flex-1 overflow-auto p-4 pb-[calc(6rem+env(safe-area-inset-bottom))] md:p-8"><Outlet /></main>{/* Mobile Nav */}- <nav className="md:hidden fixed bottom-0 left-0 right-0 bg-panel border-t border-border flex justify-around p-3 z-50 pb-safe">+ <nav className="md:hidden fixed bottom-0 left-0 right-0 bg-panel border-t border-border flex justify-around p-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] z-50"><NavLink to="/dashboard" className={({isActive}) => clsx("p-2 rounded-lg", isActive ? "text-accent" : "text-muted")}><LayoutDashboard /></NavLink><NavLink to="/channels" className={({isActive}) => clsx("p-2 rounded-lg", isActive ? "text-accent" : "text-muted")}><MessageSquare /></NavLink><NavLink to="/users" className={({isActive}) => clsx("p-2 rounded-lg", isActive ? "text-accent" : "text-muted")}><Users /></NavLink>diff --git a/ui/src/components/steps/ChannelList.tsx b/ui/src/components/steps/ChannelList.tsxindex d275a7781..ca8e893dd 100644--- a/ui/src/components/steps/ChannelList.tsx+++ b/ui/src/components/steps/ChannelList.tsx@@ -43,6 +43,7 @@ interface ChannelConfig {opencode_reasoning_effort?: string | null;claude_agent?: string | null;claude_model?: string | null;+ claude_reasoning_effort?: string | null;codex_model?: string | null;codex_reasoning_effort?: string | null;};@@ -62,6 +63,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onBconst [opencodeOptionsByCwd, setOpencodeOptionsByCwd] = useState<Record<string, any>>({});const [claudeAgentsByCwd, setClaudeAgentsByCwd] = useState<Record<string, { id: string; name: string; path: string; source?: string }[]>>({});const [claudeModels, setClaudeModels] = useState<string[]>([]);+ const [claudeReasoningOptions, setClaudeReasoningOptions] = useState<Record<string, { value: string; label: string }[]>>({});const [codexModels, setCodexModels] = useState<string[]>([]);const [selectedModels, setSelectedModels] = useState<Record<string, string>>({});const [guilds, setGuilds] = useState<any[]>([]);@@ -212,6 +214,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onBconst result = await api.claudeModels();if (result.ok) {setClaudeModels(result.models || []);+ setClaudeReasoningOptions(result.reasoning_options || {});}} catch (e) {console.error('Failed to load Claude models:', e);@@ -348,16 +351,17 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onBenabled: false,show_message_types: [],custom_cwd: '',- routing: {- agent_backend: null,- opencode_agent: null,- opencode_model: null,- opencode_reasoning_effort: null,- claude_agent: null,- claude_model: null,- codex_model: null,- codex_reasoning_effort: null,- },+ routing: {+ agent_backend: null,+ opencode_agent: null,+ opencode_model: null,+ opencode_reasoning_effort: null,+ claude_agent: null,+ claude_model: null,+ claude_reasoning_effort: null,+ codex_model: null,+ codex_reasoning_effort: null,+ },require_mention: null,});@@ -369,6 +373,36 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onBreturn [];};+ const getClaudeReasoningOptions = (model: string) => {+ const modelKey = model || '';+ const cached = claudeReasoningOptions[modelKey];+ if (cached?.length) return cached;++ const fallback = claudeReasoningOptions[''] || [];+ if (modelKey.toLowerCase().includes('claude-opus-4-6')) {+ return fallback.some((option) => option.value === 'max')+ ? fallback+ : [...fallback, { value: 'max', label: 'Max' }];+ }++ return fallback;+ };++ const getReasoningLabel = (value: string, fallback: string) => {+ switch (value) {+ case 'low':+ return t('channelList.reasoningLow');+ case 'medium':+ return t('channelList.reasoningMedium');+ case 'high':+ return t('channelList.reasoningHigh');+ case 'max':+ return t('channelList.reasoningMax');+ default:+ return fallback;+ }+ };+const selectedCount = channels.filter((channel) => isChannelEnabled(channel.id)).length;// Sort channels: enabled channels first@@ -707,7 +741,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB{effectiveBackend === 'claude' && (<div className="space-y-3"><div className="text-xs font-medium text-muted uppercase">{t('channelList.claudeSettings')}</div>- <div className="grid grid-cols-1 md:grid-cols-2 gap-3 bg-bg/50 p-3 rounded border border-border">+ <div className="grid grid-cols-1 md:grid-cols-3 gap-3 bg-bg/50 p-3 rounded border border-border"><div className="space-y-1"><label className="text-xs text-muted">{t('channelList.agent')}</label><select@@ -735,7 +769,11 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onBvalue={channelConfig.routing.claude_model || ''}onValueChange={(v) =>updateConfig(channel.id, {- routing: { ...channelConfig.routing, claude_model: v || null },+ routing: {+ ...channelConfig.routing,+ claude_model: v || null,+ claude_reasoning_effort: null,+ },})}placeholder={t('channelList.claudeModelPlaceholder')}@@ -743,6 +781,30 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onBallowCustomValue={true}/></div>+ <div className="space-y-1">+ <label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>+ <select+ value={channelConfig.routing.claude_reasoning_effort || ''}+ onChange={(e) =>+ updateConfig(channel.id, {+ routing: {+ ...channelConfig.routing,+ claude_reasoning_effort: e.target.value || null,+ },+ })+ }+ className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"+ >+ <option value="">{t('common.default')}</option>+ {getClaudeReasoningOptions(channelConfig.routing.claude_model || '')+ .filter((option) => option.value !== '__default__')+ .map((option) => (+ <option key={option.value} value={option.value}>+ {getReasoningLabel(option.value, option.label)}+ </option>+ ))}+ </select>+ </div></div></div>)}diff --git a/ui/src/components/steps/DiscordConfig.tsx b/ui/src/components/steps/DiscordConfig.tsxindex 8ef88c587..ca1c452bb 100644--- a/ui/src/components/steps/DiscordConfig.tsx+++ b/ui/src/components/steps/DiscordConfig.tsx@@ -3,6 +3,8 @@ import { Shield, RefreshCw, Check, Server, KeyRound, Plus, ExternalLink, Settingimport { useTranslation } from 'react-i18next';import clsx from 'clsx';import { useApi } from '../../context/ApiContext';+import { useToast } from '../../context/ToastContext';+import { copyTextToClipboard } from '../../lib/utils';interface DiscordConfigProps {data: any;@@ -13,6 +15,7 @@ interface DiscordConfigProps {export const DiscordConfig: React.FC<DiscordConfigProps> = ({ data, onNext, onBack }) => {const { t } = useTranslation();const api = useApi();+ const { showToast } = useToast();const [botToken, setBotToken] = useState(data.discord?.bot_token || '');const [checking, setChecking] = useState(false);const [authResult, setAuthResult] = useState<any>(null);@@ -81,13 +84,15 @@ export const DiscordConfig: React.FC<DiscordConfigProps> = ({ data, onNext, onBaconst copyInviteUrl = async () => {if (!inviteUrl) return;- try {- await navigator.clipboard.writeText(inviteUrl);+ const copiedToClipboard = await copyTextToClipboard(inviteUrl);+ if (copiedToClipboard) {setInviteCopied(true);setTimeout(() => setInviteCopied(false), 2000);- } catch {- setInviteCopied(false);+ return;}++ setInviteCopied(false);+ showToast(t('common.copyFailed'), 'error');};const StepHeader: React.FC<{ step: number; title: string; icon: React.ReactNode; completed?: boolean }> = ({diff --git a/ui/src/components/steps/DoctorPanel.tsx b/ui/src/components/steps/DoctorPanel.tsxindex 4f55a5de2..f60b2639d 100644--- a/ui/src/components/steps/DoctorPanel.tsx+++ b/ui/src/components/steps/DoctorPanel.tsx@@ -2,8 +2,10 @@ import React, { useEffect, useState } from 'react';import { Activity, RefreshCw, CheckCircle, AlertTriangle, XCircle, Copy, FileText } from 'lucide-react';import { useTranslation } from 'react-i18next';import { useApi } from '../../context/ApiContext';+import { useToast } from '../../context/ToastContext';import { Link } from 'react-router-dom';import clsx from 'clsx';+import { copyTextToClipboard } from '../../lib/utils';interface DoctorPanelProps {isPage?: boolean;@@ -12,6 +14,7 @@ interface DoctorPanelProps {export const DoctorPanel: React.FC<DoctorPanelProps> = ({ isPage }) => {const { t } = useTranslation();const api = useApi();+ const { showToast } = useToast();const [loading, setLoading] = useState(false);const [results, setResults] = useState<any>(null);@@ -29,6 +32,15 @@ export const DoctorPanel: React.FC<DoctorPanelProps> = ({ isPage }) => {runDoctor();}, []);+ const copyReport = async () => {+ if (!results) return;++ const copied = await copyTextToClipboard(JSON.stringify(results, null, 2));+ if (!copied) {+ showToast(t('common.copyFailed'), 'error');+ }+ };+const StatusIcon = ({ status }: { status: string }) => {switch (status) {case 'pass': return <CheckCircle size={18} className="text-success" />;@@ -54,7 +66,7 @@ export const DoctorPanel: React.FC<DoctorPanelProps> = ({ isPage }) => {</Link>{results && (<button- onClick={() => navigator.clipboard.writeText(JSON.stringify(results, null, 2))}+ onClick={() => void copyReport()}className="flex items-center gap-2 px-3 py-2 border border-border rounded-lg text-sm text-muted hover:bg-neutral-50 hover:text-text transition-colors"><Copy size={16} /> {t('doctor.copyReport')}diff --git a/ui/src/components/steps/LarkConfig.tsx b/ui/src/components/steps/LarkConfig.tsxindex fd6566abf..660d59fd9 100644--- a/ui/src/components/steps/LarkConfig.tsx+++ b/ui/src/components/steps/LarkConfig.tsx@@ -3,6 +3,8 @@ import { Shield, RefreshCw, Check, MessageSquare, KeyRound, Plus, ExternalLink,import { useTranslation } from 'react-i18next';import clsx from 'clsx';import { useApi } from '../../context/ApiContext';+import { useToast } from '../../context/ToastContext';+import { copyTextToClipboard } from '../../lib/utils';const LARK_PERMISSIONS_JSON = `{"scopes": {@@ -36,6 +38,7 @@ interface LarkConfigProps {export const LarkConfig: React.FC<LarkConfigProps> = ({ data, onNext, onBack }) => {const { t } = useTranslation();const api = useApi();+ const { showToast } = useToast();const [domain, setDomain] = useState<'feishu' | 'lark'>(data.lark?.domain || 'feishu');const [appId, setAppId] = useState(data.lark?.app_id || '');const [appSecret, setAppSecret] = useState(data.lark?.app_secret || '');@@ -121,13 +124,14 @@ export const LarkConfig: React.FC<LarkConfigProps> = ({ data, onNext, onBack })};const copyPermissionsJson = async () => {- try {- await navigator.clipboard.writeText(LARK_PERMISSIONS_JSON);+ const copiedToClipboard = await copyTextToClipboard(LARK_PERMISSIONS_JSON);+ if (copiedToClipboard) {setCopiedJson(true);setTimeout(() => setCopiedJson(false), 2000);- } catch {- // fallback+ return;}++ showToast(t('common.copyFailed'), 'error');};const LinkButton: React.FC<{ url: string; label: string }> = ({ url, label }) => (diff --git a/ui/src/components/steps/SlackConfig.tsx b/ui/src/components/steps/SlackConfig.tsxindex 25f7b9daf..044f5b366 100644--- a/ui/src/components/steps/SlackConfig.tsx+++ b/ui/src/components/steps/SlackConfig.tsx@@ -3,6 +3,8 @@ import { Lock, Shield, RefreshCw, Copy, ExternalLink, Check, ChevronDown, Chevroimport { useTranslation } from 'react-i18next';import clsx from 'clsx';import { useApi } from '../../context/ApiContext';+import { useToast } from '../../context/ToastContext';+import { copyTextToClipboard } from '../../lib/utils';interface SlackConfigProps {data: any;@@ -13,6 +15,7 @@ interface SlackConfigProps {export const SlackConfig: React.FC<SlackConfigProps> = ({ data, onNext, onBack }) => {const { t } = useTranslation();const api = useApi();+ const { showToast } = useToast();const [botToken, setBotToken] = useState(data.slack?.bot_token || data.slackBotToken || '');const [appToken, setAppToken] = useState(data.slack?.app_token || data.slackAppToken || '');const [mode] = useState<'self_host' | 'saas'>(data.mode || 'saas');@@ -68,13 +71,14 @@ export const SlackConfig: React.FC<SlackConfigProps> = ({ data, onNext, onBack }const copyManifest = async () => {if (!manifest) return;- try {- await navigator.clipboard.writeText(manifest);+ const copiedToClipboard = await copyTextToClipboard(manifest);+ if (copiedToClipboard) {setCopied(true);setTimeout(() => setCopied(false), 2000);- } catch (err) {- console.error('Failed to copy:', err);+ return;}++ showToast(t('common.copyFailed'), 'error');};const openSlackCreateApp = () => {diff --git a/ui/src/components/steps/Summary.tsx b/ui/src/components/steps/Summary.tsxindex 0e770a42e..921f3b815 100644--- a/ui/src/components/steps/Summary.tsx+++ b/ui/src/components/steps/Summary.tsx@@ -4,6 +4,8 @@ import { useTranslation } from 'react-i18next';import { useApi } from '../../context/ApiContext';import { useStatus } from '../../context/StatusContext';import { useNavigate } from 'react-router-dom';+import { useToast } from '../../context/ToastContext';+import { copyTextToClipboard } from '../../lib/utils';interface SummaryProps {data: any;@@ -17,6 +19,7 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {const { t } = useTranslation();const api = useApi();const { control } = useStatus();+ const { showToast } = useToast();const [saving, setSaving] = useState(false);const [error, setError] = useState<string | null>(null);const [bindCode, setBindCode] = useState<string | null>(null);@@ -32,13 +35,14 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {const copyBindCode = async () => {if (!bindCode) return;- try {- await navigator.clipboard.writeText(`/bind ${bindCode}`);- setCodeCopied(true);- setTimeout(() => setCodeCopied(false), 2000);- } catch {- // Fallback: select text+ const copied = await copyTextToClipboard(`/bind ${bindCode}`);+ if (!copied) {+ showToast(t('common.copyFailed'), 'error');+ return;}++ setCodeCopied(true);+ setTimeout(() => setCodeCopied(false), 2000);};const saveAll = async () => {@@ -379,6 +383,7 @@ const buildSettingsPayload = (data: any) => {opencode_reasoning_effort: cfg.routing?.opencode_reasoning_effort || null,claude_agent: cfg.routing?.claude_agent || null,claude_model: cfg.routing?.claude_model || null,+ claude_reasoning_effort: cfg.routing?.claude_reasoning_effort || null,codex_model: cfg.routing?.codex_model || null,codex_reasoning_effort: cfg.routing?.codex_reasoning_effort || null,},diff --git a/ui/src/components/steps/UserList.tsx b/ui/src/components/steps/UserList.tsxindex 1e7d71523..859923902 100644--- a/ui/src/components/steps/UserList.tsx+++ b/ui/src/components/steps/UserList.tsx@@ -6,6 +6,7 @@ import { useToast } from '../../context/ToastContext';import { Combobox } from '../ui/combobox';import { DirectoryBrowser } from '../ui/directory-browser';import clsx from 'clsx';+import { copyTextToClipboard } from '../../lib/utils';/** Input that only commits value on blur */function BlurInput({@@ -39,6 +40,7 @@ interface UserConfig {opencode_reasoning_effort?: string | null;claude_agent?: string | null;claude_model?: string | null;+ claude_reasoning_effort?: string | null;codex_model?: string | null;codex_reasoning_effort?: string | null;};@@ -108,8 +110,13 @@ const BindCodeSection: React.FC = () => {}};- const handleCopy = (code: string) => {- navigator.clipboard.writeText(code);+ const handleCopy = async (code: string) => {+ const copied = await copyTextToClipboard(code);+ if (!copied) {+ showToast(t('common.copyFailed'), 'error');+ return;+ }+setCopiedCode(code);setTimeout(() => setCopiedCode(null), 2000);};@@ -301,6 +308,7 @@ export const UserList: React.FC = () => {const [opencodeOptionsByCwd, setOpencodeOptionsByCwd] = useState<Record<string, any>>({});const [claudeAgentsByCwd, setClaudeAgentsByCwd] = useState<Record<string, any[]>>({});const [claudeModels, setClaudeModels] = useState<string[]>([]);+ const [claudeReasoningOptions, setClaudeReasoningOptions] = useState<Record<string, { value: string; label: string }[]>>({});const [codexModels, setCodexModels] = useState<string[]>([]);const [browsingCwdFor, setBrowsingCwdFor] = useState<string | null>(null);@@ -333,7 +341,14 @@ export const UserList: React.FC = () => {};useEffect(() => {- if (config.agents?.claude?.enabled) api.claudeModels().then(r => r.ok && setClaudeModels(r.models || []));+ if (config.agents?.claude?.enabled) {+ api.claudeModels().then((r) => {+ if (r.ok) {+ setClaudeModels(r.models || []);+ setClaudeReasoningOptions(r.reasoning_options || {});+ }+ });+ }}, [config.agents?.claude?.enabled]);useEffect(() => {@@ -420,7 +435,10 @@ export const UserList: React.FC = () => {enabled: true,show_message_types: [],custom_cwd: '',- routing: { agent_backend: null },+ routing: {+ agent_backend: null,+ claude_reasoning_effort: null,+ },});const getReasoningOptions = (cwd: string, modelKey: string) => {@@ -428,6 +446,36 @@ export const UserList: React.FC = () => {return (lookup as Record<string, { value: string; label: string }[]>)[modelKey] || [];};+ const getClaudeReasoningOptions = (model: string) => {+ const modelKey = model || '';+ const cached = claudeReasoningOptions[modelKey];+ if (cached?.length) return cached;++ const fallback = claudeReasoningOptions[''] || [];+ if (modelKey.toLowerCase().includes('claude-opus-4-6')) {+ return fallback.some((option) => option.value === 'max')+ ? fallback+ : [...fallback, { value: 'max', label: 'Max' }];+ }++ return fallback;+ };++ const getReasoningLabel = (value: string, fallback: string) => {+ switch (value) {+ case 'low':+ return t('channelList.reasoningLow');+ case 'medium':+ return t('channelList.reasoningMedium');+ case 'high':+ return t('channelList.reasoningHigh');+ case 'max':+ return t('channelList.reasoningMax');+ default:+ return fallback;+ }+ };+const userEntries = Object.entries(users).sort((a, b) => Number(b[1].is_admin) - Number(a[1].is_admin) || a[1].display_name.localeCompare(b[1].display_name));@@ -637,7 +685,7 @@ export const UserList: React.FC = () => {{effectiveBackend === 'claude' && (<div className="space-y-3"><div className="text-xs font-medium text-muted uppercase">{t('channelList.claudeSettings')}</div>- <div className="grid grid-cols-1 md:grid-cols-2 gap-3 bg-bg/50 p-3 rounded border border-border">+ <div className="grid grid-cols-1 md:grid-cols-3 gap-3 bg-bg/50 p-3 rounded border border-border"><div className="space-y-1"><label className="text-xs text-muted">{t('channelList.agent')}</label><select@@ -654,12 +702,29 @@ export const UserList: React.FC = () => {<Comboboxoptions={[{ value: '', label: t('common.default') }, ...claudeModels.map(m => ({ value: m, label: m }))]}value={userConfig.routing.claude_model || ''}- onValueChange={(v) => updateUser(userId, { routing: { ...userConfig.routing, claude_model: v || null } })}+ onValueChange={(v) => updateUser(userId, { routing: { ...userConfig.routing, claude_model: v || null, claude_reasoning_effort: null } })}placeholder={t('channelList.claudeModelPlaceholder')}searchPlaceholder={t('channelList.searchModel')}allowCustomValue={true}/></div>+ <div className="space-y-1">+ <label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>+ <select+ value={userConfig.routing.claude_reasoning_effort || ''}+ onChange={(e) => updateUser(userId, { routing: { ...userConfig.routing, claude_reasoning_effort: e.target.value || null } })}+ className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"+ >+ <option value="">{t('common.default')}</option>+ {getClaudeReasoningOptions(userConfig.routing.claude_model || '')+ .filter((option) => option.value !== '__default__')+ .map((option) => (+ <option key={option.value} value={option.value}>+ {getReasoningLabel(option.value, option.label)}+ </option>+ ))}+ </select>+ </div></div></div>)}diff --git a/ui/src/context/ApiContext.tsx b/ui/src/context/ApiContext.tsxindex 294a9402b..66ccc25bb 100644--- a/ui/src/context/ApiContext.tsx+++ b/ui/src/context/ApiContext.tsx@@ -30,7 +30,7 @@ export type ApiContextType = {opencodeOptions: (cwd: string) => Promise<any>;opencodeSetupPermission: () => Promise<{ ok: boolean; message: string; config_path: string }>;claudeAgents: (cwd?: string) => Promise<{ ok: boolean; agents?: { id: string; name: string; path: string; source?: string }[]; error?: string }>;- claudeModels: () => Promise<{ ok: boolean; models?: string[]; error?: string }>;+ claudeModels: () => Promise<{ ok: boolean; models?: string[]; reasoning_options?: Record<string, { value: string; label: string }[]>; error?: string }>;codexModels: () => Promise<{ ok: boolean; models?: string[]; error?: string }>;getLogs: (lines?: number) => Promise<{ logs: LogEntry[]; total: number }>;getVersion: () => Promise<VersionInfo>;diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex 8b550d997..6d83c0fe4 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -35,7 +35,8 @@"editSetup": "Edit setup","manageChannels": "Manage channels","viewLogs": "View logs",- "saveAndRestart": "Save & Restart"+ "saveAndRestart": "Save & Restart",+ "copyFailed": "Copy failed, please copy it manually"},"nav": {"dashboard": "Dashboard",@@ -298,6 +299,7 @@"reasoningLow": "Low","reasoningMedium": "Medium","reasoningHigh": "High",+ "reasoningMax": "Max","reasoningXHigh": "XHigh","searchModel": "Search model...","settingsSaved": "Settings saved",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex 13e6b3723..8c977c67b 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -35,7 +35,8 @@"editSetup": "编辑设置","manageChannels": "管理频道","viewLogs": "查看日志",- "saveAndRestart": "保存并重启"+ "saveAndRestart": "保存并重启",+ "copyFailed": "复制失败,请手动复制"},"nav": {"dashboard": "仪表盘",@@ -298,6 +299,7 @@"reasoningLow": "低","reasoningMedium": "中","reasoningHigh": "高",+ "reasoningMax": "最大","reasoningXHigh": "超高","searchModel": "搜索模型...","settingsSaved": "设置已保存",diff --git a/ui/src/lib/utils.ts b/ui/src/lib/utils.tsindex bd0c391dd..96e64e4de 100644--- a/ui/src/lib/utils.ts+++ b/ui/src/lib/utils.ts@@ -4,3 +4,53 @@ import { twMerge } from "tailwind-merge"export function cn(...inputs: ClassValue[]) {return twMerge(clsx(inputs))}++export async function copyTextToClipboard(text: string): Promise<boolean> {+ if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) {+ try {+ await navigator.clipboard.writeText(text)+ return true+ } catch {+ // Fall through to the legacy copy path.+ }+ }++ if (typeof document === 'undefined' || !document.body) {+ return false+ }++ const textarea = document.createElement('textarea')+ textarea.value = text+ textarea.setAttribute('readonly', '')+ textarea.style.position = 'fixed'+ textarea.style.top = '0'+ textarea.style.left = '0'+ textarea.style.opacity = '0'+ textarea.style.pointerEvents = 'none'++ const activeElement = document.activeElement instanceof HTMLElement ? document.activeElement : null+ const selection = document.getSelection()+ const originalRange = selection && selection.rangeCount > 0 ? selection.getRangeAt(0) : null++ document.body.appendChild(textarea)+ textarea.focus()+ textarea.select()+ textarea.setSelectionRange(0, textarea.value.length)++ try {+ return document.execCommand('copy')+ } catch {+ return false+ } finally {+ document.body.removeChild(textarea)++ if (selection) {+ selection.removeAllRanges()+ if (originalRange) {+ selection.addRange(originalRange)+ }+ }++ activeElement?.focus()+ }+}diff --git a/vibe/api.py b/vibe/api.pyindex c3bfae898..a907511c4 100644--- a/vibe/api.py+++ b/vibe/api.py@@ -133,13 +133,24 @@ def get_settings() -> dict:def save_settings(payload: dict) -> dict:store = SettingsStore.get_instance()platform = _current_platform()++ def _normalize_routing_payload(routing_payload: dict) -> dict:+ from modules.agents.opencode.utils import normalize_claude_reasoning_effort++ routing_data = dict(routing_payload or {})+ routing_data["claude_reasoning_effort"] = normalize_claude_reasoning_effort(+ routing_data.get("claude_model"),+ routing_data.get("claude_reasoning_effort"),+ )+ return routing_data+channels = {}for channel_id, channel_payload in (payload.get("channels") or {}).items():channels[channel_id] = ChannelSettings(enabled=channel_payload.get("enabled", True),show_message_types=normalize_show_message_types(channel_payload.get("show_message_types")),custom_cwd=channel_payload.get("custom_cwd"),- routing=_parse_routing(channel_payload.get("routing") or {}),+ routing=_parse_routing(_normalize_routing_payload(channel_payload.get("routing") or {})),require_mention=channel_payload.get("require_mention"),)store.set_channels_for_platform(platform, channels)@@ -863,8 +874,13 @@ def claude_models() -> dict:except Exception as exc:logger.warning("Failed to read Claude settings.json: %s", exc, exc_info=True)+ from modules.agents.opencode.utils import build_claude_reasoning_options+uniq = sorted({x for x in options if x})- return {"ok": True, "models": uniq}+ reasoning_options = {"": build_claude_reasoning_options(None)}+ for model in uniq:+ reasoning_options[model] = build_claude_reasoning_options(model)+ return {"ok": True, "models": uniq, "reasoning_options": reasoning_options}def install_agent(name: str) -> dict:@@ -1146,6 +1162,16 @@ def save_users(payload: dict) -> dict:store = SettingsStore.get_instance()platform = _current_platform()+ def _normalize_routing_payload(routing_payload: dict) -> dict:+ from modules.agents.opencode.utils import normalize_claude_reasoning_effort++ routing_data = dict(routing_payload or {})+ routing_data["claude_reasoning_effort"] = normalize_claude_reasoning_effort(+ routing_data.get("claude_model"),+ routing_data.get("claude_reasoning_effort"),+ )+ return routing_data+users = {}for user_id, up in (payload.get("users") or {}).items():if not isinstance(up, dict):@@ -1159,7 +1185,7 @@ def save_users(payload: dict) -> dict:enabled=up.get("enabled", True),show_message_types=normalize_show_message_types(up.get("show_message_types")),custom_cwd=up.get("custom_cwd"),- routing=_parse_routing(up.get("routing") or {}),+ routing=_parse_routing(_normalize_routing_payload(up.get("routing") or {})),dm_chat_id=existing.dm_chat_id if existing else "",)diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex d16e84a0f..8444c3c3e 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -654,6 +654,7 @@ if _os.environ.get("E2E_TEST_MODE", "").lower() in ("true", "1", "yes"):opencode_reasoning_effort=modal_values.get("opencode_reasoning_effort"),claude_agent=modal_values.get("claude_agent"),claude_model=modal_values.get("claude_model"),+ claude_reasoning_effort=modal_values.get("claude_reasoning_effort"),codex_model=modal_values.get("codex_model"),codex_reasoning_effort=modal_values.get("codex_reasoning_effort"),)@@ -694,6 +695,7 @@ if _os.environ.get("E2E_TEST_MODE", "").lower() in ("true", "1", "yes"):opencode_reasoning_effort=modal_values.get("opencode_reasoning_effort"),claude_agent=modal_values.get("claude_agent"),claude_model=modal_values.get("claude_model"),+ claude_reasoning_effort=modal_values.get("claude_reasoning_effort"),codex_model=modal_values.get("codex_model"),codex_reasoning_effort=modal_values.get("codex_reasoning_effort"),)