fix(agent): surface MCP discovery scope errors#2861
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34c1d0b45b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| http_status_code=status_code, | ||
| error_type=type(e).__name__, | ||
| server_count=len(hydrated_servers), | ||
| configured_mcp_servers=[cfg["name"] for cfg in http_servers], |
There was a problem hiding this comment.
Remove tenant MCP server names from logs
For any MCP discovery failure this now serializes every configured MCP server name into activity logs. These names are tenant-supplied identifiers and the repo-wide AGENTS.md rule says not to put customer-provided identifiers in logs; logging the full configured list also exposes unrelated server names when only one server failed. Please drop this field or replace it with a count/redacted value.
Useful? React with 👍 / 👎.
Summary
Testing
uv run ruff format tracecat/agent/mcp/user_client.py packages/tracecat-ee/tracecat_ee/agent/activities.py tests/unit/test_agent_mcp_user_client.py tests/unit/test_agent_activities.pyuv run ruff check tracecat/agent/mcp/user_client.py packages/tracecat-ee/tracecat_ee/agent/activities.py tests/unit/test_agent_mcp_user_client.py tests/unit/test_agent_activities.pyuv run python -m compileall -q tracecat/agent/mcp/user_client.py packages/tracecat-ee/tracecat_ee/agent/activities.pyuv run python - <<'PY' ...direct formatting assertionsNote
uv run pytest tests/unit/test_agent_mcp_user_client.py -qis blocked locally because the test harness requires Postgres onlocalhost:5432, which is not running in this environment.Summary by cubic
Show which agent scope and MCP server failed during strict discovery, and include HTTP status codes when available. Improves error messages and logs for faster debugging.
MCPToolDiscoveryErrorinUserMCPClient.discover_toolsto includeserver_nameand HTTP status (if present)._http_status_code_from_exceptionand_mcp_discovery_error_message; logs now includescope, server, and status; strict errors raise a detailedApplicationError.Written for commit 34c1d0b. Summary will update on new commits.