Bound investigation prompts and paginate research evidence

This commit is contained in:
Nico committed 2026-10-20 17:04:49 +02:00
1 parent 377644ffa0
commit 682f275590
24 files changed
+1005 -37

No files matched your search

+7 -20
View File
@@ -189,30 +189,17 @@ def test_gateway_schema_location_persists_in_retry_without_leaking_values(tool_c
assert info['validation_path']=='/update/working_brief' and info['validation_fields']==['retired']
def test_v14_positive_early_review_reaches_independent_diagnosis_with_rest_budget(tool_case):
service=service_for(tool_case)
def change(reply,c):
early=c['early_review']['request']
if early and early['status']=='preparing':
reply['next']={'kind':'defer','reason':'Settle pending evidence.'}
elif c['selected_hypothesis']=='H1' and c['previous_result']:
eid=c['previous_result']['evidence_id']
other=next(e for e,v in c['evidence'].items() if v['record']['hypothesis_id']=='H2')
reply['update'].update(confidence='strongly_supported',
causal_review={'effect':'supports','support':[eid],'against':[],'reason':'Fixture causal defect.'})
reply['next']={'kind':'request_diagnosis','reason':'Scoped defect with countercheck.','countercheck_refs':[other]}
else:reply['next']={'kind':'tool','operation':'project.query','arguments':rows()}
loop=Investigator(tool_case[0],gateway(LoopAdapter(change)),router=InvestigationToolRouter(project_research=service))
def test_oversized_legacy_v14_request_is_blocked_without_spending_budget(tool_case):
# The old verbose v14 contract exceeds the new universal character limit.
# Compatibility does not authorize sending an oversized request.
loop=Investigator(tool_case[0],gateway(LoopAdapter()),
router=InvestigationToolRouter(project_research=service_for(tool_case)))
original=loop._context
loop._context=lambda *args:dict(original(*args),prompt_version='investigation_project_v14')
done=run(loop,steps=10)
assert done.status=='COMPLETED' and state(done)['early_stop']['status']=='requested'
assert done.status=='BLOCKED' and done.code=='INVESTIGATION_PROMPT_LIMIT'
budget=BudgetManager(tool_case[0]).snapshot(*CASE).state
assert all(a['remaining']>0 for a in budget['accounts'].values())
adapter=FinalAdapter(True,lambda p,c:p.update(confidence='strongly_supported'))
result=build(DiagnosisBuilder(tool_case[0],gateway(adapter)))
assert result.status=='COMPLETED' and adapter.calls==1
assert BudgetManager(tool_case[0]).snapshot(*CASE).state==budget
assert all(a['remaining']==a['initial'] and not a['actions'] for a in budget['accounts'].values())
def test_v14_can_finish_inconclusively_without_invented_cause(tool_case):