Skip to content

tech-debt(mcp): decide how autobot_knowledge_mcp gets a crash-safe env reader #15709

Open

Description

@mrveiss

Found while delivering #15691 (module-level env casts that crash a service at import on a malformed value).

autobot-infrastructure/shared/mcp/tools/knowledge-base-mcp/autobot_knowledge_mcp/server.py:48 has:

KB_TIMEOUT = int(os.getenv("AUTOBOT_KB_TIMEOUT", "30"))

Same defect shape as the rest of #15691 (a malformed AUTOBOT_KB_TIMEOUT raises ValueError at import, so the MCP server will not start), and the registry declares range=(1, 300) for this var in autobot_shared/env_registry.py, so a clamped reader is the right fix in principle.

This package is different from the other 36 sites #15691 converted: it is independently packaged (own pyproject.toml, own dependency list, its own console-script entry point autobot-knowledge-mcp) and does not declare autobot_shared as a dependency. Importing autobot_shared.env_utils here would add an undeclared runtime dependency this package's own packaging does not include, and could break wherever it is installed from its own wheel rather than run inside the monorepo checkout.

Left as a bare cast in #15691, recorded with this reason, pending a decision:

  • vendor a small crash-safe int-parse helper into autobot_knowledge_mcp itself (no new dependency), or
  • add autobot_shared (or just autobot_shared.env_utils) as a declared dependency of this package, if it is acceptable for this MCP tool to depend on the monorepo's shared library.

Acceptance criteria

  • Decide which of the two approaches above (or another) is correct for this package's packaging boundary
  • KB_TIMEOUT reads via a crash-safe path (no ValueError at import on a malformed AUTOBOT_KB_TIMEOUT), clamped to (1, 300) to match the registry's declared range
  • Remove the corresponding entry from repo_tests/env_var_bare_cast_allowlist.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions