fix(file-safety): distinguish safe-root write denial from credential blocks

Return actionable errors when HERMES_WRITE_SAFE_ROOT blocks a path instead of
labeling every denial as a protected credential file. Wire the helper through
write_file, patch, delete/move, and the Copilot ACP shim; sync docs examples.
This commit is contained in:
HexLab98 2026-07-12 20:34:26 +07:00 committed by kshitij
parent 1b5ceec2a0
commit 55d826ccef
9 changed files with 87 additions and 27 deletions

View file

@ -209,7 +209,11 @@ class CopilotACPClientSafetyTests(unittest.TestCase):
target = home / ".ssh" / "id_rsa"
target.parent.mkdir(parents=True, exist_ok=True)
with patch("agent.copilot_acp_client.is_write_denied", return_value=True, create=True):
with patch(
"agent.copilot_acp_client.get_write_denied_error",
return_value="Write denied: protected",
create=True,
):
response = self._dispatch(
{
"jsonrpc": "2.0",
@ -248,6 +252,7 @@ class CopilotACPClientSafetyTests(unittest.TestCase):
)
self.assertIn("error", response)
self.assertIn("HERMES_WRITE_SAFE_ROOT", str(response["error"]))
self.assertFalse(outside.exists())