From 319565783719e686754e322eeb5e01b99dda1522 Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Mon, 4 May 2026 08:16:12 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20bot-lint=20nits=20=E2=80=94=20drop=20unu?= =?UTF-8?q?sed=20imports,=20add=20reason=20to=20except?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves three github-code-quality threads blocking PR-2739 merge: - workspace/tests/test_mcp_cli_multi_workspace.py: remove unused `import os` and `from unittest.mock import patch` (left over from an earlier test draft that mocked at the os.environ layer). - workspace/mcp_cli.py:523: replace bare `pass` in the register_workspace_token ImportError handler with a debug log line + one-line comment explaining the silent-degrade contract (older installs that don't yet ship the helper fall back to the legacy single-token path; single-workspace operators see no behavior change). Co-Authored-By: Claude Opus 4.7 (1M context) --- workspace/mcp_cli.py | 5 ++++- workspace/tests/test_mcp_cli_multi_workspace.py | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/workspace/mcp_cli.py b/workspace/mcp_cli.py index ccae2d4a..feea0b83 100644 --- a/workspace/mcp_cli.py +++ b/workspace/mcp_cli.py @@ -521,7 +521,10 @@ def main() -> None: for wsid, tok in workspaces: register_workspace_token(wsid, tok) except ImportError: - pass + # Older installs that don't yet ship register_workspace_token — + # multi-workspace resolution silently degrades to the legacy + # single-token path; single-workspace operators see no change. + logger.debug("platform_auth.register_workspace_token unavailable; skipping registry populate") # Standalone-mode register + heartbeat. Skipped via env var so an # in-container caller (which has its own heartbeat loop) can reuse diff --git a/workspace/tests/test_mcp_cli_multi_workspace.py b/workspace/tests/test_mcp_cli_multi_workspace.py index fbef22df..9ca4f434 100644 --- a/workspace/tests/test_mcp_cli_multi_workspace.py +++ b/workspace/tests/test_mcp_cli_multi_workspace.py @@ -8,10 +8,8 @@ breaks multi-workspace doesn't get hidden in a 1000-line test file. from __future__ import annotations import json -import os import sys from pathlib import Path -from unittest.mock import patch import pytest