From 5252a236fc5b9905b35cf52c7cf34ffa7b5557f4 Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 23 Sep 2026 17:53:56 +0000 Subject: [PATCH] fix(gov): probe .codegraph/ with trailing slash for check-ignore --- scripts/agent_worktree.py | 2 +- scripts/agentctl.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/agent_worktree.py b/scripts/agent_worktree.py index b64319f4..b63365b4 100644 --- a/scripts/agent_worktree.py +++ b/scripts/agent_worktree.py @@ -39,7 +39,7 @@ def maybe_codegraph_init(path, *, timeout=180): return {'status': 'not_installed'} target = Path(path).resolve() ignored = subprocess.run( - ['git', '-C', str(target), 'check-ignore', '-q', '--', '.codegraph'], + ['git', '-C', str(target), 'check-ignore', '-q', '--', '.codegraph/'], capture_output=True, check=False).returncode == 0 if not ignored: print(json.dumps({ diff --git a/scripts/agentctl.py b/scripts/agentctl.py index edc6efd2..87f10ddd 100755 --- a/scripts/agentctl.py +++ b/scripts/agentctl.py @@ -755,8 +755,9 @@ def codegraph_is_ignored(path): """True when git will not track .codegraph under path (safe to init).""" target = Path(path).resolve() try: + # Pattern `.codegraph/` only matches directories; probe with trailing slash. completed = subprocess.run( - ['git', '-C', str(target), 'check-ignore', '-q', '--', '.codegraph'], + ['git', '-C', str(target), 'check-ignore', '-q', '--', '.codegraph/'], capture_output=True, check=False) return completed.returncode == 0 except OSError: