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(claude): disable AskUserQuestion - SDK cannot respond programmatically
cyhhao521d00832501
diff --git a/core/handlers/session_handler.py b/core/handlers/session_handler.pyindex 92bec6577..cafcd23b8 100644--- a/core/handlers/session_handler.py+++ b/core/handlers/session_handler.py@@ -4,7 +4,7 @@ import osimport loggingfrom typing import Optional, Dict, Any, Tuplefrom modules.im import MessageContext-from claude_code_sdk import ClaudeSDKClient, ClaudeCodeOptions+from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptionslogger = logging.getLogger(__name__)@@ -105,12 +105,16 @@ class SessionHandler:if subagent_reasoning_effort:extra_args["reasoning-effort"] = subagent_reasoning_effort- options = ClaudeCodeOptions(+ options = ClaudeAgentOptions(permission_mode=self.config.claude.permission_mode,cwd=working_path,system_prompt=self.config.claude.system_prompt,resume=stored_claude_session_id if stored_claude_session_id else None,extra_args=extra_args,+ setting_sources=["user"], # Load user settings from ~/.claude/settings.json+ # Disable AskUserQuestion tool - SDK cannot respond to it programmatically+ # See: https://github.com/anthropics/claude-code/issues/10168+ disallowed_tools=["AskUserQuestion"],)# Log session creation details@@ -131,7 +135,7 @@ class SessionHandler:client = ClaudeSDKClient(options=options)# Log the actual options being used- logger.info("ClaudeCodeOptions details:")+ logger.info("ClaudeAgentOptions details:")logger.info(f" - permission_mode: {options.permission_mode}")logger.info(f" - cwd: {options.cwd}")logger.info(f" - system_prompt: {options.system_prompt}")diff --git a/modules/agents/claude_agent.py b/modules/agents/claude_agent.pyindex 51fd82006..ceab05196 100644--- a/modules/agents/claude_agent.py+++ b/modules/agents/claude_agent.py@@ -3,10 +3,13 @@ import loggingimport osfrom typing import Callable, Optional-from claude_code_sdk import TextBlock, ToolUseBlock+from claude_agent_sdk import TextBlock, ToolUseBlockfrom modules.agents.base import AgentRequest, BaseAgent-from modules.agents.claude_question_handler import ClaudeQuestionHandler+# NOTE: AskUserQuestion support is disabled because Claude Code SDK cannot+# respond to it programmatically. See: https://github.com/anthropics/claude-code/issues/10168+# Keeping the import for future use when SDK adds support.+# from modules.agents.claude_question_handler import ClaudeQuestionHandlerfrom modules.im import MessageContextlogger = logging.getLogger(__name__)@@ -17,6 +20,10 @@ class ClaudeAgent(BaseAgent):name = "claude"+ # AskUserQuestion support is disabled - SDK cannot respond programmatically+ # Set to True when SDK adds support (see issue #10168)+ ENABLE_ASK_USER_QUESTION = False+def __init__(self, controller):super().__init__(controller)self.session_handler = controller.session_handler@@ -30,21 +37,23 @@ class ClaudeAgent(BaseAgent):# Each entry is (reaction_message_id, emoji)self._pending_reactions: dict[str, list[tuple[str, str]]] = {}- # Question handler for AskUserQuestion support- self._question_handler = ClaudeQuestionHandler(- agent=self,- controller=controller,- im_client=controller.im_client,- settings_manager=controller.settings_manager,- )+ # Question handler for AskUserQuestion support (disabled)+ # NOTE: Uncomment when SDK adds AskUserQuestion support+ # self._question_handler = ClaudeQuestionHandler(+ # agent=self,+ # controller=controller,+ # im_client=controller.im_client,+ # settings_manager=controller.settings_manager,+ # )+ self._question_handler = Noneasync def handle_message(self, request: AgentRequest) -> None:context = request.context- # Check if this is a question callback- if request.message.startswith("claude_question:"):- await self._handle_question_callback(request)- return+ # Question callback handling (disabled - SDK doesn't support AskUserQuestion response)+ # if self.ENABLE_ASK_USER_QUESTION and request.message.startswith("claude_question:"):+ # await self._handle_question_callback(request)+ # returntry:client = await self.session_handler.get_or_create_claude_session(@@ -92,33 +101,18 @@ class ClaudeAgent(BaseAgent):await self._delete_ack(context, request)async def _handle_question_callback(self, request: AgentRequest) -> None:- """Handle question-related callbacks (button clicks, modal submissions)."""- pending = self._question_handler.get_pending(request.base_session_id)- if not pending:- await self.controller.emit_agent_message(- request.context,- "notify",- "No pending question found. The session may have timed out.",- )- return-- # Handle modal open request- if request.message == "claude_question:open_modal":- trigger_id = None- if request.context.platform_specific:- trigger_id = request.context.platform_specific.get("trigger_id")- if trigger_id:- await self._question_handler.open_modal(request, pending)- else:- await self.controller.emit_agent_message(- request.context,- "notify",- "Cannot open modal without trigger_id. Please reply with text.",- )- return-- # Process answer- await self._question_handler.process_answer(request, pending)+ """Handle question-related callbacks (button clicks, modal submissions).++ NOTE: This method is disabled because Claude Code SDK cannot respond to+ AskUserQuestion programmatically. See: https://github.com/anthropics/claude-code/issues/10168+ """+ # AskUserQuestion support disabled+ await self.controller.emit_agent_message(+ request.context,+ "notify",+ "AskUserQuestion support is currently disabled. Claude Code SDK does not support programmatic responses to this tool.",+ )+ returnasync def clear_sessions(self, settings_key: str) -> int:"""Clear Claude sessions scoped to the provided settings key."""@@ -222,15 +216,16 @@ class ClaudeAgent(BaseAgent):if message_type == "assistant":toolcalls = []text_parts = []- ask_user_question_block = None+ # AskUserQuestion detection disabled - SDK cannot respond+ # ask_user_question_block = Nonefor block in getattr(message, "content", []) or []:if isinstance(block, ToolUseBlock):- # Check for AskUserQuestion- if self._question_handler.is_ask_user_question(block):- ask_user_question_block = block- # Don't format as regular toolcall- continue+ # AskUserQuestion handling disabled - tool is disallowed via ClaudeAgentOptions+ # if self.ENABLE_ASK_USER_QUESTION and self._question_handler:+ # if self._question_handler.is_ask_user_question(block):+ # ask_user_question_block = block+ # continuetoolcalls.append(formatter.format_toolcall(@@ -277,30 +272,29 @@ class ClaudeAgent(BaseAgent):formatted_assistant)- # Handle AskUserQuestion if detected- if ask_user_question_block:- logger.info(- "Detected AskUserQuestion for session %s",- base_session_id,- )- answered = await self._question_handler.handle_ask_user_question(- request=request,- tool_use_block=ask_user_question_block,- client=client,- composite_session_id=composite_key,- )- if not answered:- # Timed out - stop receiving messages- logger.warning(- "AskUserQuestion timed out for session %s",- base_session_id,- )- return- # Answer submitted - continue receiving messages- logger.info(- "AskUserQuestion answered for session %s, continuing",- base_session_id,- )+ # AskUserQuestion handling disabled - SDK cannot respond programmatically+ # See: https://github.com/anthropics/claude-code/issues/10168+ # if self.ENABLE_ASK_USER_QUESTION and ask_user_question_block:+ # logger.info(+ # "Detected AskUserQuestion for session %s",+ # base_session_id,+ # )+ # answered = await self._question_handler.handle_ask_user_question(+ # request=request,+ # tool_use_block=ask_user_question_block,+ # client=client,+ # composite_session_id=composite_key,+ # )+ # if not answered:+ # logger.warning(+ # "AskUserQuestion timed out for session %s",+ # base_session_id,+ # )+ # return+ # logger.info(+ # "AskUserQuestion answered for session %s, continuing",+ # base_session_id,+ # )continue