Skip to content

ROADMAP-17 — P2 — Dead code removal and default centralization #109

Open

Description

@getdownandcode

Series: ROADMAP — filed from the 2026-10-27 whole-project assessment · Backlog task: M16-T04 · Priority: P2 · Effort: small

Problem

A removal sweep found pure dead weight:

  1. @tool decorator wraps every tool to attach __tool_entry__ / __tool_schema__ — never read anywhere (grep across agentkit/, tests/, examples/)
  2. default_registry module-level singleton — violates the project's "no global state" rule and nothing queries it (only its own definition and the decorator fallback)
  3. db/session.get_session() — defined, never imported
  4. routes.py router = runs_router # backwards compat alias — its target imports it under the same name; compatibility protects nothing
  5. Model-name defaults duplicated: gemini-3.1-flash-lite ×3 (factory.py:41, gemini.py:45, config.py:208), gpt-4o ×2
  6. Error subclasses with no raise site: ToolValidationError, ToolExecutionError, ToolTimeoutError, ToolNotFound(alias) — the executor deliberately returns ToolResult.failure instead of raising

Evidence

  • agentkit/tools/registry.py:107,139,144–155
  • agentkit/db/session.py:26–31; agentkit/api/routes.py:44
  • agentkit/core/errors.py:80,91,102,113 vs agentkit/api/main.py:25

Suggested fix / acceptance criteria

  • Decide and document writer-vs-reader for the tool attributes: either use them or delete the wrapper machinery (plain register + return fn)
  • Remove default_registry (or keep with an explicit deprecation note + consumer), remove get_session, the alias
  • Single source of truth for model-name defaults
  • Dead error subclasses deleted unless mapped in api/main.py handlers — list what was kept and why
  • tests/unit/test_tool_registry.py and friends updated; suite green

Suggested branch / commit

chore/remove-dead-code · chore: delete dead code and centralize default constants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions