aft icon indicating copy to clipboard operation
aft copied to clipboard

Call graph unavailable for git worktrees and other checkouts outside project_root

Open iceteaSA opened this issue 1 month ago • 1 comments

Problem

AFT's call graph covers only the session's project_root. Work in another checkout gets no call graph, even when that checkout is a linked git worktree of the same repository. Parallel-agent workflows give each lane its own worktree, so every agent working there loses aft_callgraph (callers, impact, trace_to, trace_data, call_tree).

This is the longer-term item from #222 ("Call-graph and semantic overlays are a larger design and come after"); the close comment there asked for a fresh issue.

Repro (aft 0.60.0, OpenCode 1 host)

project_root is a repository's main checkout; git worktree list shows a linked worktree at ~/worktrees/repo/lane.

  1. aft_callgraph({op: "callers", path: "~/worktrees/repo/lane/src/permissions.ts", symbol: "requestPermission"}):

    callers: path_outside_project_root — Callgraph target is not indexed: path is outside project_root. Got: …/worktrees/repo/lane/src/permissions.ts (project_root: …/projects/repo); use grep or aft_search with pattern to find references
    
  2. Same result for a file in a checkout of a different repository.

  3. aft_search behaves differently in the two cases. In the same-repo worktree it uses the shared index: "Checked the saved AFT index of against all 5024 files on disk". In a different repository's checkout, a reporter got "No AFT index is available for . The bounded lexical scan checked all 279 files on disk", which is unranked and has no definitions.

  4. aft_inspect on a file there returns an authoritative clean result even when the file has a type error. That part is a defect, filed separately as #559.

  5. aft_zoom with callgraph: true still works within one file (same-file calls only).

The check is ctx.config().project_root only (crates/aft/src/commands/callers.rs:61-80, and the same path_outside_project_root check in call_tree.rs, impact.rs, trace_to.rs, trace_data.rs). User-tier index.roots (standing roots, config.rs IndexConfig) is not consulted there.

Possible directions

a) Treat the repository's own git worktree list entries as call-graph roots: built on first use and evicted when idle, or as an overlay on the main checkout's graph, as the search index already does. b) Let the call-graph commands accept a path in another git root and build a bounded on-demand graph for it, as aft_search already accepts path for another project. c) Let the commands serve paths under a configured index.roots entry, which already exists as a user-tier setting.

(a) covers the common case with no configuration; (b) or (c) covers cross-repository work.

Impact

In one multi-lane arc, every lane worktree and every review tree fell back to grep and serial reads for "who calls X" and "what breaks if X changes". That costs tool calls and context, and grep misses the callers it cannot resolve.

iceteaSA avatar Oct 18 '26 19:10 iceteaSA

Confirmed: the current call-graph commands still reject a target outside the session's project_root before selecting a graph. The 0.64 repository index is shared by worktrees, but that does not yet make a cross-root query from another checkout work. A session rooted in the target worktree is a different case from the one reported here.

aft-alfonso[bot] avatar Nov 11 '26 19:11 aft-alfonso[bot]