Skip to content

hook-augment returns 0 bytes when payload cwd is an indexed linked worktree #1752

Closed

Description

@bmcnaboe

Repro

git worktree add ../wt -b test
# index both the main checkout and ../wt separately

Pipe a PreToolUse payload into hook-augment, varying only the payload's cwd field (process cwd held constant, deadline raised to 8000ms to rule out #1335):

process cwd payload cwd bytes
main main 663
main worktree 0
worktree main 663
worktree worktree 0

The payload's cwd alone decides the outcome; the process's own cwd is irrelevant.

Expected

A payload whose cwd is an indexed linked worktree should return that worktree's own project context — the worktree has its own full index (confirmed via index_status, is_worktree=true, resolving canonical_root back to the main checkout's .git), and search_graph against the worktree's project directly returns correct, non-stale results.

Actual

Empty output (exit 0, nothing on stderr, hook-augment-timeouts.log unaffected) at both the default 2s deadline and an 8s deadline — this is not the deadline/fingerprint issue in #1335, it's a clean no-output path with its own project already indexed.

Notes

index_status already resolves worktree paths correctly (is_worktree, git_common_dir, canonical_root) — the hook's own cwd → project resolution appears not to use that same logic, so an indexed linked worktree's payload cwd fails to resolve to its project. Distinct from #1335 (that's a timeout under the SHA-256 fingerprint cost); this is a resolution defect independent of timing.

Happy to share the full measurement writeup if useful.

Activity

  1. DeusData commented on Aug 20, 2026

    @DeusData
    Owner

    Thanks for the careful reproduction and for separating this from the timeout case — that distinction is genuinely helpful.

    I traced this on current main. With both the main checkout and linked worktree indexed under their path-derived project names, the hook should probe the linked worktree project directly before any registry fallback. I could not derive an honest failing test from the current snapshot, so could you please share the following (local usernames and paths may be redacted consistently):

    • the list_projects entries for both checkouts, including project name and root_path;
    • the exact absolute cwd field in the hook payload;
    • the raw hook JSON for one failing request, especially tool_name and tool_input.pattern;
    • the exact direct search_graph arguments that succeed;
    • confirmation that the hook and direct query use the same binary/version and CBM_CACHE_DIR.

    Those values will let us distinguish project-key mismatch, payload routing, and environment mismatch and turn this into a deterministic regression. Thank you again.

  2. added
    awaiting-reporterWaiting on the reporter for info/repro; stale bot will warn then close
    on Aug 20, 2026
  3. github-actions commented on Aug 20, 2026

    @github-actions

    Thanks for the report! To move this forward we need a bit more so we can reproduce it ourselves:

    • the codebase-memory-mcp --version you're on
    • the exact steps or command you ran
    • a public repo (or a small dummy snippet) that shows the problem — please don't paste proprietary code

    Once that's here we'll pick it straight back up. Heads-up: issues left awaiting-reporter are automatically closed after a few weeks of silence, but a comment reopens the door anytime.

  4. bmcnaboe commented on Sep 3, 2026

    @bmcnaboe
    ContributorAuthor

    Reporter follow-up: the 0-byte case above was measured on v0.10.5. Re-testing on v0.10.8-based main with two real linked worktrees off the same repo, it no longer reproduces — a payload cwd inside the indexed worktree (or a subdirectory of it) resolves to that worktree's own project, an unindexed worktree gets the explicit "no indexed graph project matched" notice rather than 0 bytes, and the main checkout is unchanged. Same binary and CBM_CACHE_DIR for the hook and the direct query.

    So this was fixed somewhere between v0.10.5 and v0.10.8; #1768 pins the behaviour as regression tests on top of main. Fine to close this as not reproducible on current versions — #1768 stands on its own.

  5. added
    bugSomething isn't working
    editor/integrationEditor compatibility and CLI integration
    priority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.
    and removed
    awaiting-reporterWaiting on the reporter for info/repro; stale bot will warn then close
    on Sep 3, 2026
  6. DeusData commented on Sep 3, 2026

    @DeusData
    Owner

    Thank you for re-testing this against the v0.10.8-based main and for reporting that the original zero-byte behavior no longer reproduces.

    I have removed awaiting-reporter. Since indexed linked-worktree paths now resolve to their own project and unindexed worktrees return an explicit no-match result, the reported defect is resolved on current versions. PR #1768 remains the regression-test record for that contract.

    Closing this as completed. Thank you for coming back with the decisive retest instead of leaving the old-version result ambiguous.

  7. added a commit that references this issue on Sep 8, 2026
    e8dcb28
  8. added 2 commits that reference this issue on Sep 29, 2026
    e6467ac
    4881554
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingeditor/integrationEditor compatibility and CLI integrationparsing/qualityGraph extraction bugs, false positives, missing edgespriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.stability/performanceServer crashes, OOM, hangs, high CPU/memory

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions