ci: reduce Python test overhead and Windows latency (#6357)

* test: merge overlapping semantic contract coverage

Consolidate the six confirmed NAN-310 overlap groups while preserving replay, usage, generation kwargs, archive metadata, inspect fields, and subagent crash/redelivery assertions.

* test: lighten history seeds and layer runner progress rules

* ci: defer test storage setup and record phase timings

Close each listener-owned binary bridge before waiting for its TCP server; retain active upload and undecided-connection regressions. Avoid consuming readiness twice and run the repository import scan once in its static gate. NAN-310.

* test: scope filesystem mocks and observe consumed socket prefixes

* test: publish subprocess readiness files atomically

* ci: isolate external tool discovery and use three Windows workers
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-21 14:47:55 +08:00
1 parent 743c51e81f
commit f284749d2f
28 files changed
+518 -448

No files matched your search

+9 -25
View File
@@ -467,11 +467,13 @@ class TestAutoCompact:
await loop.aclose()
@pytest.mark.asyncio
async def test_auto_compact_stores_summary(self, tmp_path):
"""_archive should store the summary in _summaries."""
async def test_auto_compact_stores_summary_in_cache_and_metadata(self, tmp_path):
"""_archive caches and persists the summary without exposing archived history."""
loop = _make_loop(tmp_path, session_ttl_minutes=15)
session = loop.sessions.get_or_create("cli:test")
_add_turns(session, 6, prefix="hello")
last_active = datetime.now() - timedelta(minutes=20)
session.updated_at = last_active
loop.sessions.save(session)
loop.consolidator.compact_idle_session = _make_fake_compact(
@@ -483,7 +485,12 @@ class TestAutoCompact:
entry = loop.auto_compact._summaries.get("cli:test")
assert entry is not None
assert entry["text"] == "User said hello."
loop.sessions.invalidate("cli:test")
session_after = loop.sessions.get_or_create("cli:test")
meta = session_after.metadata.get("_last_summary")
assert meta is not None
assert meta["text"] == "User said hello."
assert meta["last_active"] == last_active.isoformat()
assert len(session_after.messages) == 13
assert session_after.get_history(max_messages=12) == []
await loop.aclose()
@@ -1238,29 +1245,6 @@ class TestProactiveAutoCompact:
class TestSummaryPersistence:
"""Test that summary survives restart via session metadata."""
@pytest.mark.asyncio
async def test_summary_persisted_in_session_metadata(self, tmp_path):
"""After archive, _last_summary should be in session metadata."""
loop = _make_loop(tmp_path, session_ttl_minutes=15)
session = loop.sessions.get_or_create("cli:test")
_add_turns(session, 6, prefix="hello")
session.updated_at = datetime.now() - timedelta(minutes=20)
loop.sessions.save(session)
loop.consolidator.compact_idle_session = _make_fake_compact(
loop, summary="User said hello.",
)
await loop.auto_compact._archive("cli:test", runtime=loop.llm_runtime())
# Summary should be persisted in session metadata
session_after = loop.sessions.get_or_create("cli:test")
meta = session_after.metadata.get("_last_summary")
assert meta is not None
assert meta["text"] == "User said hello."
assert "last_active" in meta
await loop.aclose()
@pytest.mark.asyncio
async def test_summary_recovered_after_restart(self, tmp_path):
"""Summary should be recovered from metadata when _summaries is empty (simulates restart)."""