fix(agent): recheck idle expiry after acquiring session lock
Reload settled activity inside the existing session lock before an idle archive delegates to the consolidator. A fresh turn restarts the idle interval; manual compaction keeps its existing behavior. Cover both scheduling orderings and later genuine idleness, and give existing direct idle-archive fixtures explicit idle preconditions.
This commit is contained in:
1 parent
6b930432cb
commit
9650f4fd5b
5 files changed
+157
-10
No files matched your search
@@ -165,6 +165,9 @@ async def test_compacted_session_waits_for_new_input_without_continuation(
|
||||
session = loop.sessions.get_or_create(key)
|
||||
session.add_message("user", "Inspect the checkpoint")
|
||||
session.add_message("assistant", "Inspection complete.")
|
||||
if trigger == "idle":
|
||||
loop.auto_compact._ttl = 15
|
||||
session.updated_at = datetime.now() - timedelta(minutes=20)
|
||||
loop.sessions.save(session)
|
||||
loop.provider.estimate_prompt_tokens.return_value = (100, "test")
|
||||
loop.provider.chat_stream_with_retry.return_value = LLMResponse(content=summary)
|
||||
|
||||
Reference in new issue
Block a user