test(ci): isolate flaky scenarios and retain failure diagnostics (#6622)
* test(ci): isolate HTTP stubs and retain failure diagnostics * test(agent): scope compaction watchdogs to each phase * test(webui): isolate settings skeleton scenarios * test(webui): await rendered rail content before scroll checks
This commit is contained in:
1 parent
220d5e6970
commit
62c05e7f7e
7 files changed
+40
-22
No files matched your search
@@ -1361,7 +1361,7 @@ async def test_idle_compaction_rechecks_settled_activity(tmp_path, monkeypatch,
|
||||
_add_turns(session, 2)
|
||||
session.updated_at = now[0] - timedelta(minutes=20)
|
||||
loop.sessions.save(session)
|
||||
entered, release = asyncio.Event(), asyncio.Event()
|
||||
entered, release, settled = asyncio.Event(), asyncio.Event(), asyncio.Event()
|
||||
archived = []
|
||||
other_responses = []
|
||||
|
||||
@@ -1381,30 +1381,30 @@ async def test_idle_compaction_rechecks_settled_activity(tmp_path, monkeypatch,
|
||||
try:
|
||||
await asyncio.wait_for(entered.wait(), 5)
|
||||
now[0] += timedelta(minutes=20)
|
||||
if ordering == "scan_during_turn":
|
||||
loop._next_idle_compact_check_at = 0
|
||||
await loop._check_expired_sessions_if_due()
|
||||
other_responses.append(await asyncio.wait_for(
|
||||
loop.process_direct("other input", session_key="cli:other"), 5,
|
||||
))
|
||||
assert archived == []
|
||||
async with asyncio.timeout(5):
|
||||
if ordering == "scan_during_turn":
|
||||
loop._next_idle_compact_check_at = 0
|
||||
await loop._check_expired_sessions_if_due()
|
||||
other_responses.append(await loop.process_direct("other input", session_key="cli:other"))
|
||||
assert archived == []
|
||||
finally:
|
||||
release.set()
|
||||
await asyncio.wait_for(settled.wait(), 5)
|
||||
|
||||
loop.provider.chat_stream_with_retry.side_effect = respond
|
||||
loop.consolidator.archive_session = archive
|
||||
finishing = None
|
||||
try:
|
||||
if ordering == "archive_queued_before_turn":
|
||||
loop._next_idle_compact_check_at = 0
|
||||
await loop._check_expired_sessions_if_due()
|
||||
assert key in loop.auto_compact._archiving
|
||||
finishing = asyncio.create_task(finish_turn())
|
||||
# Await inline: the direct call takes the free lock before the already
|
||||
# scheduled archive task runs. No scheduler or lock is replaced.
|
||||
async with asyncio.timeout(5):
|
||||
# Each phase owns its watchdog; the held turn intentionally waits for
|
||||
# another session. A phase failure cancels the inline turn through the group.
|
||||
async with asyncio.TaskGroup() as tasks:
|
||||
tasks.create_task(finish_turn())
|
||||
# Await inline so admission still precedes the queued archive task.
|
||||
response = await loop.process_direct("new input", session_key=key)
|
||||
await asyncio.wait_for(finishing, 5)
|
||||
settled.set()
|
||||
await asyncio.wait_for(_drain_background_tasks(loop), 5)
|
||||
assert len(archived) == 0
|
||||
saved = await loop.sessions.state.get(key)
|
||||
@@ -1426,6 +1426,4 @@ async def test_idle_compaction_rechecks_settled_activity(tmp_path, monkeypatch,
|
||||
assert key not in loop.auto_compact._archiving
|
||||
finally:
|
||||
release.set()
|
||||
if finishing is not None:
|
||||
await asyncio.wait_for(asyncio.gather(finishing, return_exceptions=True), 5)
|
||||
await asyncio.wait_for(loop.aclose(), 10)
|
||||
@@ -24,6 +24,7 @@ def test_timing_report_preserves_phases_and_failed_results(pytester: pytest.Pyte
|
||||
cases = {key.rsplit("::", 1)[-1]: value for key, value in report["cases"].items()}
|
||||
assert cases["test_pass"]["phases"]["call"]["outcome"] == "passed"
|
||||
assert cases["test_fail"]["phases"]["call"]["outcome"] == "failed"
|
||||
assert "AssertionError" in cases["test_fail"]["phases"]["call"]["failure"]
|
||||
assert cases["test_skip"]["phases"]["setup"]["outcome"] == "skipped"
|
||||
assert sum(phase["seconds"] for case in cases.values()
|
||||
for phase in case["phases"].values()) > 0
|
||||
|
||||
Reference in new issue
Block a user