minor fixes
This commit is contained in:
parent
729a3910d8
commit
0f0c3a076f
3 changed files with 2 additions and 18 deletions
|
|
@ -41,8 +41,6 @@ async def _update_context_background(
|
||||||
)
|
)
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
pass
|
pass
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def create_chat_agent(config: AppConfig) -> Agent[ChatDeps, str]:
|
def create_chat_agent(config: AppConfig) -> Agent[ChatDeps, str]:
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,7 @@ def cache_session_context(session_id: str, context: SessionContext) -> None:
|
||||||
|
|
||||||
|
|
||||||
def get_cached_session_context(session_id: str) -> SessionContext | None:
|
def get_cached_session_context(session_id: str) -> SessionContext | None:
|
||||||
"""Get session context from server cache.
|
"""Get session context from server cache."""
|
||||||
|
|
||||||
Args:
|
|
||||||
session_id: The session identifier.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Cached SessionContext, or None if not cached.
|
|
||||||
"""
|
|
||||||
_cleanup_stale_cache()
|
_cleanup_stale_cache()
|
||||||
return _session_context_cache.get(session_id)
|
return _session_context_cache.get(session_id)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,21 +15,14 @@ def test_plan_prompt_instructs_gather_context():
|
||||||
|
|
||||||
|
|
||||||
def test_prompt_selection_uses_context_prompt_with_session_context():
|
def test_prompt_selection_uses_context_prompt_with_session_context():
|
||||||
"""When session_context exists, should use PLAN_PROMPT_WITH_CONTEXT.
|
"""When session_context exists, should use PLAN_PROMPT_WITH_CONTEXT."""
|
||||||
|
|
||||||
This tests the logic pattern used in _plan_step_logic.
|
|
||||||
"""
|
|
||||||
# Simulate the selection logic from graph.py
|
|
||||||
has_prior_answers = False
|
has_prior_answers = False
|
||||||
has_session_context = True
|
has_session_context = True
|
||||||
|
|
||||||
# Current buggy behavior would select plan_prompt (the one with gather_context)
|
|
||||||
# Expected behavior: use PLAN_PROMPT_WITH_CONTEXT when session_context exists
|
|
||||||
effective_plan_prompt = (
|
effective_plan_prompt = (
|
||||||
PLAN_PROMPT_WITH_CONTEXT
|
PLAN_PROMPT_WITH_CONTEXT
|
||||||
if has_prior_answers or has_session_context
|
if has_prior_answers or has_session_context
|
||||||
else PLAN_PROMPT
|
else PLAN_PROMPT
|
||||||
)
|
)
|
||||||
|
|
||||||
# Since session_context exists, we should use PLAN_PROMPT_WITH_CONTEXT
|
|
||||||
assert effective_plan_prompt == PLAN_PROMPT_WITH_CONTEXT
|
assert effective_plan_prompt == PLAN_PROMPT_WITH_CONTEXT
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue