Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions acp_adapter/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1697,8 +1697,8 @@ def _cmd_tools(self, args: str, state: SessionState) -> str:
return "No tools available."
lines = [f"Available tools ({len(tools)}):"]
for t in tools:
name = t.get("function", {}).get("name", "?")
desc = t.get("function", {}).get("description", "")
name = (t.get("function") or {}).get("name", "?")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also guard the sibling tool.get("function", {}).get("name") used to build valid_tool_names; on current main it is in the same _cmd_tools flow at acp_adapter/server.py:1800.

desc = (t.get("function") or {}).get("description", "")
# Truncate long descriptions
if len(desc) > 80:
desc = desc[:77] + "..."
Expand Down
2 changes: 1 addition & 1 deletion gateway/platforms/qqbot/onboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _create_bind_task(timeout: float = ONBOARD_API_TIMEOUT) -> Tuple[str, str]:
if data.get("retcode") != 0:
raise RuntimeError(data.get("msg", "create_bind_task failed"))

task_id = data.get("data", {}).get("task_id")
task_id = (data.get("data") or {}).get("task_id")
if not task_id:
raise RuntimeError("create_bind_task: missing task_id in response")

Expand Down
4 changes: 2 additions & 2 deletions gateway/platforms/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -2431,7 +2431,7 @@ async def _handle_slash_confirm_action(self, ack, body, action) -> None:
original_text = ""
for block in message.get("blocks", []):
if block.get("type") == "section":
original_text = block.get("text", {}).get("text", "")
original_text = (block.get("text") or {}).get("text", "")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This handler has moved on current main: please port this guard to plugins/platforms/slack/adapter.py:3514 (and the matching approval handler at :3636), otherwise the active Slack code remains unguarded.

break

updated_blocks = [
Expand Down Expand Up @@ -2532,7 +2532,7 @@ async def _handle_approval_action(self, ack, body, action) -> None:
original_text = ""
for block in message.get("blocks", []):
if block.get("type") == "section":
original_text = block.get("text", {}).get("text", "")
original_text = (block.get("text") or {}).get("text", "")
break

updated_blocks = [
Expand Down
4 changes: 2 additions & 2 deletions gateway/platforms/yuanbao.py
Original file line number Diff line number Diff line change
Expand Up @@ -2019,7 +2019,7 @@ def _is_at_bot(msg_body: list, bot_id: Optional[str]) -> bool:
for elem in msg_body:
if elem.get("msg_type") != "TIMCustomElem":
continue
data_str = elem.get("msg_content", {}).get("data", "")
data_str = (elem.get("msg_content") or {}).get("data", "")
if not data_str:
continue
try:
Expand All @@ -2038,7 +2038,7 @@ def _extract_bot_mention_text(msg_body: list, bot_id: Optional[str]) -> str:
for elem in msg_body:
if elem.get("msg_type") != "TIMCustomElem":
continue
data_str = elem.get("msg_content", {}).get("data", "")
data_str = (elem.get("msg_content") or {}).get("data", "")
if not data_str:
continue
try:
Expand Down
2 changes: 1 addition & 1 deletion gateway/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -11626,7 +11626,7 @@ def _should_send_voice_reply(
has_agent_tts = any(
msg.get("role") == "assistant"
and any(
tc.get("function", {}).get("name") == "text_to_speech"
(tc.get("function") or {}).get("name") == "text_to_speech"
for tc in (msg.get("tool_calls") or [])
)
for msg in agent_messages
Expand Down
2 changes: 1 addition & 1 deletion tui_gateway/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3357,7 +3357,7 @@ def run_after_agent_ready() -> None:
"error",
sid,
{
"message": err.get("error", {}).get(
"message": (err.get("error") or {}).get(
"message", "agent initialization failed"
)
},
Expand Down