Fix profile switch: reload tools/schema after switch_profile tool call
switch_profile updates profile_id in DB, but run_stream() held a stale
local session object — the final save would overwrite the change, and
subsequent LLM calls in the same turn still used the old tool schemas.

After each tool-call iteration, compare DB profile_id with the local
session object. On mismatch: update session.profile_id, reload profile,
tools, tool_schemas, and llm backend so the next LLM call gets the
correct schema and the final save preserves the new profile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9746fcc commit 5386b61c27aa125d1ac90080001f4354bb318db6
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored on 10 Apr
Showing 1 changed file
View
navi/core/agent.py