Skip to content

Honor GitHub CLI account selection from XDG and GH_CONFIG_DIR #1501

Done

Description

@eowca

Reproducer

On a68ef3b1, use an isolated HOME with a synthetic github.com login in $HOME/.config/gh/hosts.yml. Put a different synthetic login in $XDG_CONFIG_HOME/gh/hosts.yml. With no token environment variables or app token, compare direct GitHub CLI config selection against the same child process launched through loopzero.github.run(..., env_allowlist=GH_ENV). This can run entirely offline with fake credentials and compare only which fixture was selected. Repeat with GH_CONFIG_DIR pointing to the alternate directory.

Observed. Direct gh selects the alternate profile. The loop-zero child selects the default HOME profile because its allowlist drops the override. A fallback GitHub operation can run under a different account from the one the operator configured.

Expected. The GitHub CLI subprocess uses the configured CLI profile when an explicit or app token is absent.

Acceptance

  • Honor both config-directory overrides in GitHub CLI calls and retain GitHub CLI's precedence when both are set.
  • Preserve explicit and app token precedence and keep credential contents out of output.
  • Reuse existing GitHub subprocess coverage with zero net new test lines.

Activity

  1. eowca commented on Nov 26, 2026

    @eowca
    ContributorAuthor

    PR #1517 changes which GitHub CLI account may be used when no explicit or app token is available. The delivery contract reserves auth changes for the decisions owner. The merge hold can be cleared after the owner approves forwarding the two CLI profile selectors with token precedence preserved.

  2. eowca commented on Nov 26, 2026

    @eowca
    ContributorAuthor

    OD ruling (auth reserved class), 2026-11-26: APPROVED forwarding GH_CONFIG_DIR and XDG_CONFIG_HOME to gh subprocesses (PR #1517 at 79c0af5). Reason: it adds no new identity capability, because GH_TOKEN is already forwarded and outranks both selectors, and the App and explicit token precedence is unchanged and covered by the test. The selectors only choose among logins the operator has already configured. Checked: neither variable is set on miki, on danio-3, or in any live agent process, so current hosts see no behavior change. The hold label is removed from #1517, and it lands through normal checks.

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