fix(roles): skip the agent harness directory when copying a local custom role

A custom role with a local source (`source.url: /opt/src/custom`) is copied with shutil.copytree, which skipped only .git and __pycache__. A dev checkout that Claude Code has worked in carries an empty `.claude/.cc-writes` (mode 0700, ignored by the global gitignore), unreadable for the runner uid, so `infinito administration deploy dedicated` aborted before the play with "Custom roles refused: ... [Errno 13] Permission denied". A git source never carries that directory, because it is staged through `git archive`.

The copy now skips `.claude` as well. The ignore list has one consumer, the local branch of stage(); git sources are unchanged. A new test creates `.claude/.cc-writes` at mode 000: before the fix it fails in shutil with the reported Permission denied, after it all 102 custom-role tests pass. Reported by the GUI lane on efd72474a6.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-10-30 08:23:20 +01:00
1 parent 0111e0e7fb
commit 828515483b
2 files changed
+10 -1

No files matched your search

@@ -127,6 +127,15 @@ class TestStage(_SourceFixture, unittest.TestCase):
self.assertFalse((target / "__pycache__").exists())
self.assertIn("(working tree)", origin)
def test_local_directory_skips_unreadable_agent_harness_state(self):
harness = self.repo / ROLE_PATH / ".claude" / ".cc-writes"
harness.mkdir(parents=True)
harness.chmod(0o000)
self.addCleanup(harness.chmod, 0o700)
target = self.root / "staged"
stage(ROLE, Source(str(self.repo), None, ROLE_PATH), target)
self.assertFalse((target / ".claude").exists())
def test_path_that_is_a_file_is_refused(self):
with self.assertRaisesRegex(CustomRoleError, "source.path is not a directory"):
stage(ROLE, Source(str(self.repo), "v1.0.0", "README.md"), self.root / "s")