Skip to content

fix(testing): lazy-load BROWSER_TOOL_NAMES import in tool_registry — breaks circular import (#4557)#4734

Merged
mrveiss merged 1 commit intoDev_new_guifrom
issue-4557
Apr 15, 2026
Merged

fix(testing): lazy-load BROWSER_TOOL_NAMES import in tool_registry — breaks circular import (#4557)#4734
mrveiss merged 1 commit intoDev_new_guifrom
issue-4557

Conversation

@mrveiss
Copy link
Copy Markdown
Owner

@mrveiss mrveiss commented Apr 15, 2026

Closes #4557

Summary

Root cause was a circular import in tools/tool_registry.py — the module-level from chat_workflow.tool_handler import BROWSER_TOOL_NAMES created a cycle: chat_workflow.__init__managertool_handlertools.__init__tool_registrychat_workflow.tool_handler (partially initialized → ImportError).

Fix: moved the import inside get_available_tools() as a lazy import. Single-source-of-truth semantics from #2609 fully preserved — import resolves at call time when both modules are fully initialized.

Tests

  • 262 chat_workflow/ tests pass
  • Pre-existing: prompt_hooks_test.py::test_total_hook_count_increased asserts 24 HookPoints but finds 25 — unrelated to this change

🤖 Generated with Claude Code

…circular import (#4557)

Circular import chain: chat_workflow.__init__ → manager → tool_handler
→ tools (code_interpreter) → tools.__init__ → tool_registry →
chat_workflow.tool_handler (partially initialized, ImportError).

Fix: remove the module-level `from chat_workflow.tool_handler import
BROWSER_TOOL_NAMES` in tool_registry.py and move it inside
get_available_tools() as a lazy import. This breaks the cycle while
preserving the single-source-of-truth semantics documented in #2609.

Result: 262 chat_workflow unit tests now collect and pass.
@mrveiss mrveiss merged commit 0f06f17 into Dev_new_gui Apr 15, 2026
3 of 4 checks passed
@mrveiss mrveiss deleted the issue-4557 branch April 15, 2026 18:44
@github-actions
Copy link
Copy Markdown

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant