The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: anchor V4A editor approval paths to session cwd
Teknium490453f7b844
diff --git a/acp_adapter/edit_approval.py b/acp_adapter/edit_approval.pyindex 00cdc6becc7..e38b9906643 100644--- a/acp_adapter/edit_approval.py+++ b/acp_adapter/edit_approval.py@@ -110,7 +110,7 @@ def _proposal_for_patch_v4a(arguments: dict[str, Any]) -> EditProposal:patch_body = arguments.get("patch")if not isinstance(patch_body, str) or not patch_body:raise ValueError("patch content required")- paths = _extract_v4a_patch_paths(patch_body)+ paths = [_required_path({'path': path}) for path in _extract_v4a_patch_paths(patch_body)]if not paths:raise ValueError("no file paths found in V4A patch")single = len(paths) == 1diff --git a/tests/acp/test_gateway_editor_v4a.py b/tests/acp/test_gateway_editor_v4a.pynew file mode 100644index 00000000000..6130a3eb1a5--- /dev/null+++ b/tests/acp/test_gateway_editor_v4a.py@@ -0,0 +1,25 @@+"""V4A edit cards resolve every referenced path in the session workspace."""+import pytest++from acp_adapter.edit_approval import build_edit_proposal+from gateway.session_policy import build_policy, policy_scope++[email protected]('multiple', [False, True])+def test_v4a_permission_paths_use_execution_workspace(tmp_path, multiple):+ (tmp_path / 'one.txt').write_text('old one')+ (tmp_path / 'two.txt').write_text('old two')+ patch = '*** Begin Patch\n*** Update File: one.txt\n@@\n-old one\n+new one\n'+ if multiple:+ patch += '*** Update File: two.txt\n@@\n-old two\n+new two\n'+ patch += '*** End Patch'+ policy = build_policy({'source': 'acp', 'cwd': str(tmp_path), 'model': 'fixture'}, {})+ with policy_scope(policy):+ proposal = build_edit_proposal('patch', {'mode': 'patch', 'patch': patch})+ expected = [str(tmp_path / 'one.txt')]+ if multiple:+ expected.append(str(tmp_path / 'two.txt'))+ assert proposal.path == ', '.join(expected)+ assert proposal.old_text == (None if multiple else 'old one')+ assert proposal.new_text == patch # V4A protocol card shows the exact patch.+ assert (tmp_path / 'one.txt').read_text() == 'old one'