Add resumable LLM investigation loop with bounded controller execution

This commit is contained in:
Nico committed 2026-10-14 06:18:52 +02:00
1 parent c03f70e3e1
commit c39b5881d1
23 files changed
+2872 -15

No files matched your search

+14
View File
@@ -128,4 +128,18 @@ def test_full_bug20_package_pair(tmp_path):
budget.record_evidence(*identity,asked["hypothesis_id"],asked["action_id"],ref)
budget.settle(*identity,asked["hypothesis_id"],asked["action_id"],semantic_score=50,reason="Offline provenance regression")
assert CaseBuilder(store).build(*identity).reused
from viano_bug_analysis.analysis import Investigator,InvestigationConfig,InvestigationLimits
from test_investigator import LoopAdapter
def choose_packaged_source(reply,context):
if context["previous_result"] is None:
reply["next"]={"kind":"tool","operation":"source.read_context","arguments":{"source_ref":code_ref,"start_line":1,"end_line":3}}
loop_adapter=LoopAdapter(choose_packaged_source)
investigated=asyncio.run(Investigator(store,gateway(loop_adapter,max_request_bytes=4*1024*1024),
InvestigationConfig(max_iterations_per_hypothesis=1),InvestigationLimits(max_context_bytes=2*1024*1024),
router=InvestigationToolRouter(database_tool=DatabaseQueryTool(normalize_schema_descriptor))).run(*identity,max_steps=10))
assert investigated.status=="COMPLETED" and len(loop_adapter.contexts)==6
with PackageReader(investigated.package) as reader:
assert reader.manifest["state"]=="BUILDING_DIAGNOSIS"
assert reader.manifest["artifacts"]["diagnosis"] is None
assert reader.manifest["artifacts"]["change_request"] is None
assert [hashlib.sha256(path.read_bytes()).hexdigest() for path in (diag, src)] == original_hashes