Skip to content

bound_root collapses .. lexically, so a typed root that crosses a symlink then .. binds the wrong repository in every generated command #6960

Closed

Description

@EffortlessSteven

Problem

agent::loop_commands::bound_root_path joins a relative root onto the working directory and runs lexically_clean, which drops .. without touching the filesystem. The operating system instead follows a symlink before applying the next ... Take a typed root link/../repo, where link points to /outside/child:

  • the analysis reads /outside/repo;
  • every bound command prints --root /work/repo.

This applies to every producer that binds through bound_root or bound_root_path, not just one surface: check drill-ins, the agent loop, first-pr, pilot (its next commands and, since #6959, its language routes), the LSP, and anchored_redirect_target. Devin raised it on #6959 (thread), and the #6959 review lane noted the same for portable redirects.

#3999 lists "no general filesystem canonicalization or symlink-security claim" as a non-goal, and lexically_clean avoids filesystem I/O on purpose because redirect targets usually do not exist yet.

Repro

From /work, with link -> /outside/child and repositories at both /outside/repo and /work/repo, run ripr pilot --root link/../repo or ripr check --root link/../repo --base HEAD. The printed commands name /work/repo.

Expected

The root that commands are bound to is the directory the producer actually analyzed. One option: canonicalize the selected root once at the producer boundary when it exists (std::fs::canonicalize, or dunce-style on Windows to avoid \\?\ prefixes), and keep lexical cleaning only for redirect targets that do not exist yet. Note that canonicalizing changes the display of every symlinked checkout (/tmp → /private/tmp on macOS), so the golden <cwd>/ projection would need to follow.

Goal hurt

Trustworthy verdicts: a pasted command silently analyzes a different repository. This is an edge case, since it needs a typed root that crosses a symlink and then uses ...

Activity

  1. EffortlessSteven commented on Oct 7, 2026

    @EffortlessSteven
    MemberAuthor

    Codex raised this as P1 on #6963 (pr_summary/json.rs), and Devin raised it earlier on the same line. The #3948 follow-ups thread takes this next, after #6963 merges, so every bound surface changes together.


    Generated by Claude Code

  2. EffortlessSteven commented on Oct 7, 2026

    @EffortlessSteven
    MemberAuthor

    Delivered by #6996 (2518647). On Unix, bound roots, redirect targets, generated-command route recovery and gap-ledger refresh sources keep a .. that follows an existing symlink, so the printed commands name the directory that was analyzed. Windows is unchanged. Follow-ups are in #7017 (edge cases) and #7005 (test temp-dir cleanup).


    Generated by Claude Code

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions