|
Pass explicit ToolContext to tools instead of hidden ContextVars
Add ToolContext dataclass (session_id, event_sink, stop_event, model, user_id, user_role, user_info) and thread it through the execution chain: Agent._execute_tools_with_sink → ToolExecutor → tool.execute(). All ~25 tools updated to accept ctx parameter. Tools that previously read ContextVar now prefer ctx when provided, falling back to ContextVar for backward compatibility. Tests updated to pass ToolContext explicitly — no more test fixtures that set current_session_id / current_user_id ContextVars. ContextVar setters remain as fallback for non-tool consumers (ai_helper, context_builder, planning) and will be removed in a follow-up refactor. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
|---|
|
|
| docs/architecture_weak_spots.md |
|---|
| navi/core/agent.py |
|---|
| navi/core/subagent_runner.py |
|---|
| navi/core/tool_executor.py |
|---|
| navi/mcp/tools.py |
|---|
| navi/tools/_internal/base.py |
|---|
| navi/tools/code_exec.py |
|---|
| navi/tools/content_publish.py |
|---|
| navi/tools/create_mcp_server.py |
|---|
| navi/tools/filesystem.py |
|---|
| navi/tools/image_view.py |
|---|
| navi/tools/list_profiles.py |
|---|
| navi/tools/list_tools.py |
|---|
| navi/tools/manage_recall.py |
|---|
| navi/tools/mcp_status.py |
|---|
| navi/tools/memory.py |
|---|
| navi/tools/reflect.py |
|---|
| navi/tools/reload_tools.py |
|---|
| navi/tools/schedule_recall.py |
|---|
| navi/tools/scratchpad.py |
|---|
| navi/tools/share_file.py |
|---|
| navi/tools/spawn_agent.py |
|---|
| navi/tools/ssh_exec.py |
|---|
| navi/tools/switch_profile.py |
|---|
| navi/tools/terminal.py |
|---|
| navi/tools/test_mcp_tool.py |
|---|
| navi/tools/todo.py |
|---|
| navi/tools/tool_manual.py |
|---|
| tests/conftest_factory.py |
|---|
| tests/unit/tools/test_content_publish.py |
|---|
| tests/unit/tools/test_memory.py |
|---|
| tests/unit/tools/test_recall_tools.py |
|---|
| tests/unit/tools/test_scratchpad.py |
|---|
| tests/unit/tools/test_share_file.py |
|---|
| tests/unit/tools/test_spawn_agent.py |
|---|
| tests/unit/tools/test_todo.py |
|---|