fix(reply): known user location reaches getWeather; retries are not blocked by the previous reply
- Drop the engine's deterministic Korean weather shortcut. It bypassed the chat model and the tool runner, so a location the user had stated could never be used. The tool already returns one clean Korean sentence. - getWeather and the tool-argument prompts pass the place the user has said they are (conversation or memory) and leave the argument empty otherwise, so the detected location is not copied into it. - getWeather retries a "district, city, country" name with its leading parts dropped when the geocoder finds nothing. - The planner gets the live time/location line and plans searchMemory topic='where the user lives' only when the location is unknown or disabled. - The per-reply repeat guard counts only this reply's tool messages, so calls carried over from the previous reply no longer block a retry the user asks for. - Memory extractor: the context block sits after the examples and the no-location example uses a different query, so a location already in context is not asked for again. New counterpart eval checks that it is still asked for when the context has none. - Tool retry eval fails every call in turn 1, so a model that retries by itself inside turn 1 still exercises the user's "try again". - Specs (planner, reply), docs/llm_contexts.md and the roadmap updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -524,3 +524,32 @@ def test_direct_exec_fires_despite_prior_query_tool_carryover(
|
||||
"direct-exec must fire for the current plan's getWeather step even when "
|
||||
"prior-query tool results are present in dialogue carryover"
|
||||
)
|
||||
|
||||
|
||||
def test_planner_receives_live_location_context(mock_config, db, dialogue_memory):
|
||||
"""The planner gets the same live time/location line as the rest of
|
||||
the turn, so it can tell an unknown location from a known one."""
|
||||
from jarvis.reply import engine as engine_mod
|
||||
|
||||
mock_config.ollama_chat_model = "gpt-oss:20b"
|
||||
mock_config.evaluator_enabled = False
|
||||
mock_config.location_enabled = False
|
||||
|
||||
seen: dict = {}
|
||||
|
||||
def fake_plan(*args, **kwargs):
|
||||
seen.update(kwargs)
|
||||
return ["Reply to the user."]
|
||||
|
||||
with patch.object(engine_mod, "chat_with_messages",
|
||||
return_value=_assistant_content("Hello.")), \
|
||||
patch.object(engine_mod, "select_tools", return_value=["stop"]), \
|
||||
patch.object(engine_mod, "plan_query", side_effect=fake_plan):
|
||||
engine_mod.run_reply_engine(
|
||||
db=db, cfg=mock_config, tts=None,
|
||||
text="how is the weather today",
|
||||
dialogue_memory=dialogue_memory,
|
||||
)
|
||||
|
||||
assert seen.get("live_context") == engine_mod._live_time_location_string(mock_config)
|
||||
assert "Location: Disabled" in seen["live_context"]
|
||||
|
||||
Reference in New Issue
Block a user