mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-25 07:12:20 +01:00
trust runtime materialization evidence
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
0.20.16
|
0.20.17
|
||||||
|
|||||||
@@ -1514,7 +1514,9 @@ def required_artifacts_have_content(required_artifacts):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def successful_required_artifact_mutation(tool_name, arguments, required_artifacts):
|
def successful_required_artifact_mutation(
|
||||||
|
tool_name, arguments, required_artifacts, execution_result=None,
|
||||||
|
):
|
||||||
"""Recognize completed outputs without letting an empty directory pass.
|
"""Recognize completed outputs without letting an empty directory pass.
|
||||||
|
|
||||||
Typed tools can authoritatively report a successful exact file write even
|
Typed tools can authoritatively report a successful exact file write even
|
||||||
@@ -1523,6 +1525,13 @@ def successful_required_artifact_mutation(tool_name, arguments, required_artifac
|
|||||||
container, so they require observable non-empty file content.
|
container, so they require observable non-empty file content.
|
||||||
"""
|
"""
|
||||||
targets = [str(path or '').strip().rstrip('/') for path in required_artifacts]
|
targets = [str(path or '').strip().rstrip('/') for path in required_artifacts]
|
||||||
|
materialized = {
|
||||||
|
str(path or '').strip().rstrip('/')
|
||||||
|
for path in (execution_result or {}).get('materialized_artifacts', ())
|
||||||
|
if str(path or '').strip()
|
||||||
|
}
|
||||||
|
if targets and all(target in materialized for target in targets):
|
||||||
|
return True
|
||||||
if required_artifacts_have_content(targets):
|
if required_artifacts_have_content(targets):
|
||||||
return True
|
return True
|
||||||
if not targets or any(not Path(target).suffix for target in targets):
|
if not targets or any(not Path(target).suffix for target in targets):
|
||||||
@@ -5864,7 +5873,7 @@ async def stream_preview(*, endpoint_url, model, messages, headers, turn_contrac
|
|||||||
if canonical(block.tool_type) in {'edit_document', 'update_document'}:
|
if canonical(block.tool_type) in {'edit_document', 'update_document'}:
|
||||||
successful_editor_writer = canonical(block.tool_type)
|
successful_editor_writer = canonical(block.tool_type)
|
||||||
if successful_required_artifact_mutation(
|
if successful_required_artifact_mutation(
|
||||||
block.tool_type, args, required_artifacts,
|
block.tool_type, args, required_artifacts, result,
|
||||||
):
|
):
|
||||||
successful_artifact_write = True
|
successful_artifact_write = True
|
||||||
except (ValueError, jsonschema.ValidationError) as exc:
|
except (ValueError, jsonschema.ValidationError) as exc:
|
||||||
|
|||||||
@@ -504,6 +504,12 @@ def test_required_artifact_mutation_trusts_exact_files_but_not_empty_directory_s
|
|||||||
output_dir.mkdir()
|
output_dir.mkdir()
|
||||||
assert not module.successful_required_artifact_mutation(
|
assert not module.successful_required_artifact_mutation(
|
||||||
'bash', {'command': f'mkdir -p {output_dir}'}, (str(output_dir),),
|
'bash', {'command': f'mkdir -p {output_dir}'}, (str(output_dir),),
|
||||||
|
{'workspace_mutated': True, 'mutated_artifacts': [str(output_dir)]},
|
||||||
|
)
|
||||||
|
assert module.successful_required_artifact_mutation(
|
||||||
|
'python', {'code': f"open('{output_dir}/1.tex', 'w').write('table')"},
|
||||||
|
(str(output_dir),),
|
||||||
|
{'materialized_artifacts': [str(output_dir)]},
|
||||||
)
|
)
|
||||||
output_file = tmp_path / 'output.html'
|
output_file = tmp_path / 'output.html'
|
||||||
assert module.successful_required_artifact_mutation(
|
assert module.successful_required_artifact_mutation(
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ ROOT = Path(__file__).resolve().parents[1]
|
|||||||
def test_original_harness_version_is_canonical_semver() -> None:
|
def test_original_harness_version_is_canonical_semver() -> None:
|
||||||
version = (ROOT / "HARNESS_VERSION").read_text(encoding="utf-8").strip()
|
version = (ROOT / "HARNESS_VERSION").read_text(encoding="utf-8").strip()
|
||||||
|
|
||||||
assert version == "0.20.16"
|
assert version == "0.20.17"
|
||||||
assert re.fullmatch(r"\d+\.\d+\.\d+", version)
|
assert re.fullmatch(r"\d+\.\d+\.\d+", version)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user