Skip to content

Honor GitHub CLI config directory overrides - #1517

Merged
mergify[bot] merged 2 commits into
mainfrom
lean178/1501-gh-config-overrides
Nov 26, 2026
Merged

mergify[bot] merged 2 commits into
mainfrom
lean178/1501-gh-config-overrides

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Honor GitHub CLI config directory overrides

Context and goal

  • Goal: Use the GitHub CLI profile selected by the operator.
  • Problem: The subprocess environment drops XDG_CONFIG_HOME and GH_CONFIG_DIR. With two configured profiles, the CLI can use the wrong account.
  • Context: The operator normally selects a profile with GitHub CLI's existing settings. Explicit and installation tokens still take precedence.

Closes #1501

Acceptance

  • GitHub CLI calls inherit both directory overrides and GitHub CLI owns their precedence.
  • Existing explicit and app token selection still applies. No credential contents appear in output.
  • Offline coverage reuses existing fakes and adds zero net test lines.

Base

Base: a68ef3b

Notes

The operator already controls these variables and the HOME passed to gh. Passing the two profile selectors to the GitHub CLI restores the intended fallback identity. Token selection remains unchanged, and the values are never emitted by production code. The existing architecture account still holds because token precedence, review publisher checks, and the subprocess allowlist remain intact.

Validation

(no loopzero check run recorded)


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Review

Architecture-Review: unchanged; the existing subprocess allowlist passes two operator profile selectors while explicit and App token precedence and publisher gates stay the same.
Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loopzero primary review by claude on 79c0af527318d5360955e7b1b070a4fc2cbb8737, 32.8s: approve (0 critical, 0 important, 1 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)

Native Claude output is retained in the restricted local review receipt.

Comment thread tests/fake_gh.py
argv: list[str], calls: str, scenario: str, cwd: str, token: str | None,
) -> tuple[int, str, str]:
record = {"argv": argv, "token": token}
record = dict(argv=argv, token=token, config=[os.getenv(k) for k in ("GH_CONFIG_DIR", "XDG_CONFIG_HOME")])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: In-process replay records the host's config variables, not the allowlisted ones

replay gets config by calling os.getenv in whatever process runs it. The subprocess fake (tests/test_github.py:50-55) runs as a child of run(..., env_allowlist=GH_ENV), so there the value reflects GH_ENV correctly, and that is the path test_app_identity_selection_and_cache checks. The in-process replay_gh fixture (tests/test_cli.py:160-172) is different: it works out GH_TOKEN from build_env(env_allowlist, extra_env) but calls replay inside the pytest process. Its recorded config therefore shows the test host's environment even when the allowlist would drop those variables. Nothing asserts on it today, but a later test that checks config under replay_gh would pass even if the allowlist were wrong. Smallest fix: pass the environment into replay the same way the token is passed, e.g. an env mapping (the build_env(...) result in-process, os.environ in the script), and read both selectors from that mapping instead of the global environment.

Architecture-Review: unchanged; GitHub CLI profile selection still uses the existing subprocess boundary and token precedence.
Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loopzero delta review by claude on d9b3234c73c7eb3dae6dc248308d60d87e36ccdd, 9.2s: approve (0 critical, 0 important, 0 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)

Native Claude output is retained in the restricted local review receipt.

@eowca
eowca marked this pull request as ready for review November 26, 2026 11:53
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as b14697c at 12:02 UTC

6 min in the queue, 4 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 11:56 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1861
  • ✅ Merged 12:02 · b14697c · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 26, 2026
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit b14697c into main Nov 26, 2026
14 checks passed
@eowca
eowca deleted the lean178/1501-gh-config-overrides branch November 26, 2026 12:02
@mergify mergify Bot removed the queued label Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Honor GitHub CLI account selection from XDG and GH_CONFIG_DIR

1 participant