@@ -147,12 +147,15 @@ def _truncate_scope_text(text: str, limit: int = 3500) -> str:
147147 return clipped .rstrip () + note
148148
149149
150- def _graphtrail_markdown (cwd : Path , db_path : Path , args : list [str ]) -> str :
150+ def _graphtrail_scope_text (cwd : Path , db_path : Path , args : list [str ], * , markdown : bool = False ) -> str :
151151 binary = _graphtrail_bin ()
152152 if binary is None :
153153 return ""
154+ # Only `context` accepts --markdown/--limit; callers, callees, and impact
155+ # reject them and would exit non-zero, leaving the planner one scope short.
156+ extra = ["--markdown" , "--limit" , "8" ] if markdown else []
154157 result = proc .run (
155- [binary , "--db" , str (db_path ), * args , "--markdown" , "--limit" , "8" ],
158+ [binary , "--db" , str (db_path ), * args , * extra ],
156159 timeout = 10.0 ,
157160 cwd = cwd ,
158161 )
@@ -208,7 +211,7 @@ def _candidate_graphtrail_scopes(cwd: Path, task: str) -> list[EvidenceScope]:
208211 if not db_path .is_file ():
209212 return []
210213 candidates : list [EvidenceScope ] = []
211- context_text = _graphtrail_markdown (cwd , db_path , ["context" , task ])
214+ context_text = _graphtrail_scope_text (cwd , db_path , ["context" , task ], markdown = True )
212215 if context_text :
213216 candidates .append (
214217 EvidenceScope (
@@ -228,7 +231,7 @@ def _candidate_graphtrail_scopes(cwd: Path, task: str) -> list[EvidenceScope]:
228231 ("graphtrail-callees" , ["callees" , symbol ]),
229232 ("graphtrail-impact" , ["impact" , symbol ]),
230233 ):
231- text = _graphtrail_markdown (cwd , db_path , command )
234+ text = _graphtrail_scope_text (cwd , db_path , command )
232235 if not text :
233236 continue
234237 candidates .append (
0 commit comments