Add index-free MiniCPM scout, local QLoRA training, and measured evaluation
Tests / core (push) Canceled after 0s

This commit is contained in:
emil28092005
2026-09-16 15:28:39 +03:00
parent f49400932b
commit 84aeb3f6de
55 changed files with 14249 additions and 2 deletions
+51
View File
@@ -69,3 +69,54 @@ def test_real_stdio_tool_roundtrip_and_stale_read(tmp_path):
assert not status.isError
asyncio.run(asyncio.wait_for(roundtrip(), timeout=30))
def test_live_stdio_reads_file_changes_without_reindexing(tmp_path):
root = tmp_path / "repo"
root.mkdir()
source = root / "answer.py"
source.write_text("answer = 1\n")
script = tmp_path / "live_server.py"
script.write_text("""import json, sys
from pathlib import Path
from micro_scout.live_server import create_live_server
class Policy:
model = "scripted-offline-policy"
context = 8192
max_tokens = 512
turn = 0
def prompt_tokens(self, messages):
return 100
def generate(self, messages, **kwargs):
ref = {"path": "answer.py", "start_line": 1, "end_line": 1}
action = ({"calls": [{"tool": "read", **ref}], "results": []}
if self.turn % 2 == 0 else {"calls": [], "results": [ref]})
self.turn += 1
return {"response": json.dumps(action), "done_reason": "stop"}
create_live_server(Path(sys.argv[1]), Policy()).run(transport="stdio")
""")
async def roundtrip():
parameters = StdioServerParameters(
command=sys.executable,
args=[str(script), str(root)],
env=dict(os.environ),
)
async with (
stdio_client(parameters) as (reader, writer),
ClientSession(reader, writer) as session,
):
await session.initialize()
tools = await session.list_tools()
assert [t.name for t in tools.tools] == ["scout_live_search"]
first = await session.call_tool("scout_live_search", {"query": "find the answer"})
assert not first.isError
assert first.structuredContent["results"][0]["content"] == "answer = 1"
source.write_text("answer = 42\n")
second = await session.call_tool("scout_live_search", {"query": "find the answer"})
assert second.structuredContent["results"][0]["content"] == "answer = 42"
assert not (root / ".micro-scout").exists()
asyncio.run(asyncio.wait_for(roundtrip(), timeout=30))