Skip to content

Commit 11f9184

Browse files
chore(sdk): drop variable-sized payloads from info logs
Strip full state/agent model dumps and tool / skill / MCP-server name lists out of info logs. The accompanying counts are still logged so 'how many X were loaded' remains visible without dumping the contents. - conversation/state: 'Resumed conversation <id>' and 'Created new conversation <id>' no longer append `state.model_dump(...)` and `agent.model_dump_succint()` — those dump the entire ConversationState (including workspace, persistence info, etc.) and the agent config across many wrapped log lines on startup. - mcp/utils: 'Created N MCP tools' no longer enumerates every tool name. - agent/base: 'Loaded N tools from spec' / 'Filtered to N tools after applying regex filter' no longer enumerate every tool name. - skills/skill: 'Loaded N public skills' no longer enumerates every skill name. - plugin/plugin: 'Loaded MCP config from <path> with N server(s)' no longer enumerates every server name. Co-authored-by: openhands <openhands@all-hands.dev>
1 parent 2e3fbc8 commit 11f9184

5 files changed

Lines changed: 9 additions & 24 deletions

File tree

openhands-sdk/openhands/sdk/agent/base.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -473,16 +473,11 @@ def _initialize(self, state: ConversationState):
473473
result = future.result()
474474
tools.extend(result)
475475

476-
logger.info(
477-
f"Loaded {len(tools)} tools from spec: {[tool.name for tool in tools]}"
478-
)
476+
logger.info("Loaded %d tools from spec", len(tools))
479477
if self.filter_tools_regex:
480478
pattern = re.compile(self.filter_tools_regex)
481479
tools = [tool for tool in tools if pattern.match(tool.name)]
482-
logger.info(
483-
f"Filtered to {len(tools)} tools after applying regex filter: "
484-
f"{[tool.name for tool in tools]}",
485-
)
480+
logger.info("Filtered to %d tools after applying regex filter", len(tools))
486481

487482
# Include default tools from include_default_tools; not subject to regex
488483
# filtering. Use explicit mapping to resolve tool class names.

openhands-sdk/openhands/sdk/conversation/state.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,7 @@ def create(
365365
# Note: stats are already deserialized from base_state.json above.
366366
# Do NOT reset stats here - this would lose accumulated metrics.
367367

368-
logger.info(
369-
f"Resumed conversation {state.id} from persistent storage.\n"
370-
f"State: {state.model_dump(exclude={'agent'})}\n"
371-
f"Agent: {state.agent.model_dump_succint()}"
372-
)
368+
logger.info("Resumed conversation %s from persistent storage", state.id)
373369
return state
374370

375371
# ---- Fresh path ----
@@ -394,11 +390,7 @@ def create(
394390

395391
state._save_base_state(file_store) # initial snapshot
396392
state._autosave_enabled = True
397-
logger.info(
398-
f"Created new conversation {state.id}\n"
399-
f"State: {state.model_dump(exclude={'agent'})}\n"
400-
f"Agent: {state.agent.model_dump_succint()}"
401-
)
393+
logger.info("Created new conversation %s", state.id)
402394
return state
403395

404396
# ===== Auto-persist base on public field changes =====

openhands-sdk/openhands/sdk/mcp/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,5 @@ def create_mcp_tools(
8787
)
8888
raise
8989

90-
logger.info(f"Created {len(client.tools)} MCP tools: {[t.name for t in client]}")
90+
logger.info("Created %d MCP tools", len(client.tools))
9191
return client

openhands-sdk/openhands/sdk/plugin/plugin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,10 @@ def _load_mcp_config(plugin_dir: Path) -> dict[str, Any] | None:
477477
# expansion with per-conversation secrets. Only SKILL_ROOT is expanded now.
478478
config = load_mcp_config(mcp_json, skill_root=plugin_dir, expand_defaults=False)
479479
if config and "mcpServers" in config:
480-
server_names = list(config["mcpServers"].keys())
481480
logger.info(
482-
f"Loaded MCP config from {mcp_json} "
483-
f"with {len(server_names)} server(s): {server_names}"
481+
"Loaded MCP config from %s with %d server(s)",
482+
mcp_json,
483+
len(config["mcpServers"]),
484484
)
485485
return config
486486
except Exception as e:

openhands-sdk/openhands/sdk/skills/skill.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,9 +1105,7 @@ def load_public_skills(
11051105
except Exception as e:
11061106
logger.warning(f"Failed to load public skills from {repo_url}: {str(e)}")
11071107

1108-
logger.info(
1109-
f"Loaded {len(all_skills)} public skills: {[s.name for s in all_skills]}"
1110-
)
1108+
logger.info("Loaded %d public skills", len(all_skills))
11111109
return all_skills
11121110

11131111

0 commit comments

Comments
 (0)