Skip to content

Commit df5badf

Browse files
sjarmakclaude
andcommitted
fix: curator nesting detection and dual-retrieval file parsing
- Strip CLAUDE_CODE_ENTRYPOINT in addition to CLAUDECODE when spawning `claude -p` subprocesses, fixing nesting detection false positive - Handle string file entries (V7+ format) in verify_dual_retrieval, not just legacy dict format Validated: V8 hard subset F1=0.394 (vs V7 F1=0.303, +30%). Profile smoke test: all 5 profiles produce correct behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ea09151 commit df5badf

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

scripts/context_retrieval_agent.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,8 +1578,9 @@ def run_agent_cli(
15781578
if mcp_config_path:
15791579
cmd.extend(["--mcp-config", mcp_config_path])
15801580

1581-
# -- Environment: unset CLAUDECODE to avoid nesting detection --
1582-
env = {k: v for k, v in os.environ.items() if k != "CLAUDECODE"}
1581+
# -- Environment: strip nesting-detection vars so `claude -p` runs --
1582+
_nest_vars = {"CLAUDECODE", "CLAUDE_CODE_ENTRYPOINT"}
1583+
env = {k: v for k, v in os.environ.items() if k not in _nest_vars}
15831584
# Ensure SRC_ACCESS_TOKEN is set for ds_wrapper.sh (Deep Search)
15841585
if "SRC_ACCESS_TOKEN" not in env:
15851586
sg_token = env.get("SOURCEGRAPH_ACCESS_TOKEN", "")
@@ -1819,7 +1820,8 @@ def _prune_via_cli(
18191820
"--model", model,
18201821
"--dangerously-skip-permissions",
18211822
]
1822-
env = {k: v for k, v in os.environ.items() if k != "CLAUDECODE"}
1823+
_nest_vars = {"CLAUDECODE", "CLAUDE_CODE_ENTRYPOINT"}
1824+
env = {k: v for k, v in os.environ.items() if k not in _nest_vars}
18231825

18241826
try:
18251827
proc = subprocess.run(
@@ -2460,8 +2462,13 @@ def verify_dual_retrieval(
24602462
verification = []
24612463

24622464
for entry in files:
2463-
repo = entry.get("repo", "")
2464-
path = entry.get("path", "")
2465+
# Normalize: files may be strings (V7+) or dicts (legacy)
2466+
if isinstance(entry, str):
2467+
repo = ""
2468+
path = entry
2469+
else:
2470+
repo = entry.get("repo", "")
2471+
path = entry.get("path", "")
24652472

24662473
# --- Local verification: file exists on disk in any repo_paths ---
24672474
local_ok = False

0 commit comments

Comments
 (0)