Skip to content

Make worktree prerequisite diagnostics locale-independent #196

Description

@xz-dev

Summary

Worktree prerequisite classification depends on English git stderr, and Agent guidance does not explicitly say that isolation is based on the parent session cwd rather than a repository path mentioned in the prompt.

I plan to implement this.

Reproduction

With LC_ALL=zh_CN.UTF-8, run an Agent call from a non-Git parent cwd with:

{ "isolation": "worktree" }

git rev-parse --is-inside-work-tree returns the localized equivalent of “not a git repository”. The current English regex classifies it as git_probe_failed rather than the factual not_git_repo prerequisite miss.

Separately, a prompt may name another repository, but the Agent tool has no cwd parameter: worktree isolation still probes the parent session cwd. The current model-facing guidance does not state that explicitly.

Expected

  • classify non-repository and missing-HEAD prerequisites without depending on localized human-readable stderr
  • distinguish those from Git infrastructure/probe failures and real worktree add failures
  • recommend one unisolated retry only for confirmed prerequisites
  • explicitly state that worktree isolation uses the parent session cwd; prompt text cannot select another repository
  • never initialize or commit a repository solely to enable isolation

This should remain fail-closed for ambiguous/infrastructure failures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions