Problem
The gh copilot command launches the Copilot CLI binary via exec.Command, but does not pass any environment variable or identifier that would allow the copilot process to know it was launched by gh.
This means the copilot process has no way to distinguish whether it was invoked directly by the user or through gh copilot.
Proposed solution
Set a GH_COPILOT=true environment variable on the subprocess before executing it:
externalCmd.Env = append(os.Environ(), "GH_COPILOT=true")
Problem
The
gh copilotcommand launches the Copilot CLI binary viaexec.Command, but does not pass any environment variable or identifier that would allow the copilot process to know it was launched bygh.This means the copilot process has no way to distinguish whether it was invoked directly by the user or through
gh copilot.Proposed solution
Set a
GH_COPILOT=trueenvironment variable on the subprocess before executing it:Acceptance Criteria
Given I run
gh copilotWhen I check the env of the
copilotprocessThen I see
GH_COPILOT=trueis set