Self-hosted AI workspace.
Python
trust runtime materialization evidence
pewdiepie-archdaemon3f9ff9d580c8
diff --git a/HARNESS_VERSION b/HARNESS_VERSIONindex 1d2240e20..b9f2e9bce 100644--- a/HARNESS_VERSION+++ b/HARNESS_VERSION@@ -1 +1 @@-0.20.16+0.20.17diff --git a/src/clean_agent_preview.py b/src/clean_agent_preview.pyindex e5e60ee8e..d1f34da13 100644--- a/src/clean_agent_preview.py+++ b/src/clean_agent_preview.py@@ -1514,7 +1514,9 @@ def required_artifacts_have_content(required_artifacts):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.Typed tools can authoritatively report a successful exact file write even@@ -1523,6 +1525,13 @@ def successful_required_artifact_mutation(tool_name, arguments, required_artifaccontainer, so they require observable non-empty file content."""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 Trueif required_artifacts_have_content(targets):return Trueif 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_contracif canonical(block.tool_type) in {'edit_document', 'update_document'}:successful_editor_writer = canonical(block.tool_type)if successful_required_artifact_mutation(- block.tool_type, args, required_artifacts,+ block.tool_type, args, required_artifacts, result,):successful_artifact_write = Trueexcept (ValueError, jsonschema.ValidationError) as exc:diff --git a/tests/test_clean_agent_preview.py b/tests/test_clean_agent_preview.pyindex fb4bc5d2e..52c232a08 100644--- a/tests/test_clean_agent_preview.py+++ b/tests/test_clean_agent_preview.py@@ -504,6 +504,12 @@ def test_required_artifact_mutation_trusts_exact_files_but_not_empty_directory_soutput_dir.mkdir()assert not module.successful_required_artifact_mutation('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'assert module.successful_required_artifact_mutation(diff --git a/tests/test_harness_version.py b/tests/test_harness_version.pyindex e534fee74..3bf5c53da 100644--- a/tests/test_harness_version.py+++ b/tests/test_harness_version.py@@ -8,7 +8,7 @@ ROOT = Path(__file__).resolve().parents[1]def test_original_harness_version_is_canonical_semver() -> None: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)