mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-13 10:22:21 +02:00
constrain directory completion to child files
This commit is contained in:
@@ -624,7 +624,7 @@ def test_artifact_completion_schema_binds_single_required_file_without_mutating_
|
||||
assert 'const' not in source[0]['function']['parameters']['properties']['path']
|
||||
|
||||
|
||||
def test_artifact_completion_schema_does_not_bind_directory_or_multiple_outputs():
|
||||
def test_artifact_completion_schema_binds_directory_descendant_but_not_multiple_outputs():
|
||||
source = [{
|
||||
'type': 'function',
|
||||
'function': {
|
||||
@@ -636,9 +636,14 @@ def test_artifact_completion_schema_does_not_bind_directory_or_multiple_outputs(
|
||||
},
|
||||
}]
|
||||
|
||||
assert artifact_completion_tool_schemas(
|
||||
directory_bound = artifact_completion_tool_schemas(
|
||||
source, ('/workspace/results/',),
|
||||
) == source
|
||||
)
|
||||
directory_path = directory_bound[0]['function']['parameters']['properties']['path']
|
||||
assert re.search(directory_path['pattern'], '/workspace/results/output.md')
|
||||
assert not re.search(directory_path['pattern'], '/workspace/results')
|
||||
assert 'inside the required directory' in directory_path['description']
|
||||
assert 'pattern' not in source[0]['function']['parameters']['properties']['path']
|
||||
assert artifact_completion_tool_schemas(
|
||||
source, ('/workspace/a.txt', '/workspace/b.txt'),
|
||||
) == source
|
||||
@@ -679,7 +684,7 @@ def test_required_binary_artifact_forces_python_instead_of_text_writer():
|
||||
]
|
||||
|
||||
|
||||
def test_required_directory_artifact_does_not_force_writer_to_directory_path():
|
||||
def test_required_directory_artifact_forces_writer_with_descendant_schema():
|
||||
offered = [
|
||||
{'type': 'function', 'function': {'name': 'bash'}},
|
||||
{'type': 'function', 'function': {'name': 'write_file'}},
|
||||
@@ -687,7 +692,7 @@ def test_required_directory_artifact_does_not_force_writer_to_directory_path():
|
||||
|
||||
assert required_artifact_completion_tool_choice(
|
||||
('/tmp_workspace/results',), offered,
|
||||
) is None
|
||||
) == {'type': 'function', 'function': {'name': 'write_file'}}
|
||||
|
||||
|
||||
def test_action_promise_response_rejects_future_work_but_not_real_answers():
|
||||
@@ -5328,11 +5333,14 @@ async def test_native_stream_reserves_remaining_budget_for_required_artifact(mon
|
||||
assert "web_search" not in request_contract["offered_tools"]
|
||||
assert request_contract["tool_choice"] is None
|
||||
reserved_names = [tool["function"]["name"] for tool in requests[12]["tools"]]
|
||||
assert reserved_names == ["bash", "python", "write_file"]
|
||||
assert reserved_names == ["write_file"]
|
||||
assert "tool_choice" not in requests[12]
|
||||
directory_path = requests[12]["tools"][0]["function"]["parameters"]["properties"]["path"]
|
||||
assert re.search(directory_path["pattern"], "/tmp_workspace/results/out.md")
|
||||
assert not re.search(directory_path["pattern"], "/tmp_workspace/results")
|
||||
assert "create one or more files inside" in requests[12]["messages"][-1]["content"]
|
||||
assert "Do not pass the directory itself as a file path" in requests[12]["messages"][-1]["content"]
|
||||
assert "bash" in executed
|
||||
assert "bash" not in executed
|
||||
assert any(
|
||||
event.get("type") == "tool_output" and event.get("tool") == "write_file"
|
||||
and not event.get("error") for event in events
|
||||
|
||||
@@ -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.7"
|
||||
assert version == "0.20.8"
|
||||
assert re.fullmatch(r"\d+\.\d+\.\d+", version)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user