My Git CLI lost its environment outside its own checkout
My Git CLI needs configuration even when I run it from a repository other than its own.
That is its normal use. The code for pr-agent lives in one project, but the diff it describes belongs to whichever repository I’m working on. Installing the command doesn’t automatically supply the environment its model client needs.
The March 13 change adds python-dotenv and loads it when the package is imported:
from dotenv import load_dotenv
load_dotenv()
It is a small addition with a location question attached: which environment file does that call find?

Illustration: looking for configuration in different places.
Separate the command from its configuration
The CLI already accepted a command and model choice in December. The March change doesn’t introduce that interface. It adds an attempt to load environment-file values before the application initializes its work.
A sanitized invocation might select a provider-qualified model and ask for a preview:
pr-agent commit --model openai:example-model --dry-run
The model name here is a placeholder for the example. The application’s configuration trace is:
launch command -> import pr_agent -> load_dotenv()
|
v
process environment
|
v
model client setup
The command-line model selection and a provider credential are different inputs. Having one doesn’t establish that the other was loaded.
The default search has rules
The added call doesn’t specify an environment-file path. In python-dotenv’s version 1.2.1 implementation, that uses find_dotenv.
For an ordinary Python-file invocation, the search starts from a calling file’s directory and walks upward. Interactive and some other execution contexts use the current working directory. A packaged command importing its installed module therefore shouldn’t be assumed to read the target repository’s .env merely because I launched it there.
Existing process variables also take precedence by default. Loading a file isn’t the same as replacing an already exported value.
That makes the useful check specific: launch the installed CLI in the intended environment and confirm which file was discovered and whether the needed variable is present. I can report the variable’s presence without printing its value.
Configuration is another input boundary
In the diff-direction repair, I needed to inspect the patch before blaming the generated description. Here, I need to inspect configuration loading before blaming the model client.
I can load the environment file explicitly now. I still need to decide which directory supplies it when I run the CLI from somewhere else.