Skip to content

fix(acq): make kit fetch non-interactive; never prompt for git creds (#207) - #209

Merged
mogul merged 8 commits into
mainfrom
fix/acq-kit-fetch-noninteractive
Jul 23, 2026
Merged

mogul merged 8 commits into
mainfrom
fix/acq-kit-fetch-noninteractive

Conversation

@wz-gsa

@wz-gsa wz-gsa commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

acq run … could drop into an interactive git credential prompt (Username for 'https://github.com':) and hang/fail while fetching a hybrid/v1 kit from the public patterns repo — even when the user was authenticated via gh. Reported by a real user; gh auth setup-git worked around it.

Closes #207. Addresses #208 (fallback loudness + KNOWN_FAILURE_MODES doc).

Root cause

gh auth login authenticates the gh CLI, not plain git. kit_translate_fetch ran a bare git fetch with no GIT_TERMINAL_PROMPT=0 and no credential isolation, so a global git credential helper or a url.*.insteadOf rewrite forced git to authenticate to a public repo — and dropped into an interactive prompt (GitHub disabled git password auth in 2021).

Fix (design approved by consensus vote, 7/7)

kit_translate_fetch now fetches non-interactively:

  • GIT_TERMINAL_PROMPT=0 + GIT_ASKPASS=/bin/echo + GCM_INTERACTIVE=never on every git call — it can never hang on a prompt.
  • Attempt 1 (anonymous): neutralizes any inherited credential.helper and the github.com insteadOf rewrite, so a public fetch just works.
  • Attempt 2 (authed retry, still prompt-disabled): system git config intact for legitimately private / enterprise-mirror sources (an egress-restricted mirror that needs the rewrite).
  • Actionable error on genuine failure: points at gh auth setup-git and the insteadOf check.
  • Hardening: reject a hostile dir= (absolute path / .. / illegal chars) before any git call — defense-in-depth parity with kit_spec_files (from the security review).

acq.backends/sbx.sh: the passthrough-on-fetch-failure warning is now loud + actionable for git+http* refs (#208 item 1) rather than a terse one-liner, while preserving the passthrough behavior.

docs/KNOWN_FAILURE_MODES.md: new entry #25 — the prompt symptom, the gh auth setup-git fix, and the prevention note.

Testing

scripts/test-acq: +5 assertions — fetch runs with GIT_TERMINAL_PROMPT=0; anonymous attempt carries the credential-neutralizing -c flags; traversal dir= rejected with no git call. 153/153 pass. shellcheck + markdownlint clean.

Reviews performed

Design consensus vote (7/7 approve), plus a read-only QA/security fan-out review that verified: no shell injection (all ref-derived values double-quoted), rm -rf .git is cd-guarded + relative, attempt-2 can't hang, the insteadOf neutralization is correctly github.com-scoped — and surfaced the dir= traversal gap now closed here.

AI-assisted (OpenCode). Non-contract bug fix.

…207)

acq run … could drop into an interactive git credential prompt
(Username for 'https://github.com') and hang/fail when fetching a hybrid/v1
kit from the (public) patterns repo — even when the user was authed via gh.
Root cause: gh auth authenticates the gh CLI, not plain git, and kit-translate
ran a bare git fetch with no GIT_TERMINAL_PROMPT=0 and no credential isolation,
so a global git credential helper or url.*.insteadOf rewrite forced auth on a
public clone.

kit_translate_fetch now fetches NON-INTERACTIVELY:
- GIT_TERMINAL_PROMPT=0 + GIT_ASKPASS=/bin/echo + GCM_INTERACTIVE=never on every
  git call, so it can never hang on a prompt.
- Attempt 1 (anonymous): neutralizes any inherited credential.helper and the
  github.com insteadOf rewrite, so a public fetch just works.
- Attempt 2 (authed retry, still prompt-disabled): system git config intact for
  legitimately private / enterprise-mirror sources.
- Actionable error on genuine failure (gh auth setup-git; check insteadOf).
- Hardening: reject a hostile dir= (absolute path / '..' / illegal chars) before
  any git call (defense-in-depth, parity with kit_spec_files).

sbx.sh: the passthrough-on-fetch-failure warning is now loud + actionable for
git+http* refs (#208 item 1) instead of a terse one-liner.

docs/KNOWN_FAILURE_MODES.md: new entry #25 (the prompt symptom + gh auth
setup-git fix + the prevention note).

test-acq: +5 assertions (prompt disabled, anon credential-neutralizing flags,
traversal dir rejected + no git call). 153/153 pass. shellcheck clean.

Closes #207. Addresses #208 (item 1 fallback loudness + KNOWN_FAILURE_MODES doc).

Co-authored-by: OpenCode Agent <[email protected]>
@wz-gsa
wz-gsa requested a review from a team as a code owner July 21, 2026 20:42
@wz-gsa wz-gsa added the bug Something isn't working label Jul 21, 2026
…-it 5.0.2)

Markdown Quality CI gates on npm audit --audit-level=high and has been red on
main since two new high-severity advisories landed against the pinned linter
deps: js-yaml GHSA-52cp-r559-cp3m (YAML merge-key quadratic CPU, affects
4.0.0-4.2.0) and linkify-it GHSA-v245-v573-v5vm (mailto: quadratic DoS). Bump
the overrides to js-yaml 4.3.0 (patched 4.x, still compatible with
markdownlint-cli2 0.22.1) and pin linkify-it 5.0.2; regenerate lockfile.
npm audit --audit-level=high: 0 vulnerabilities.

Co-authored-by: OpenCode Agent <[email protected]>
The kit fetch printed a harmless-but-noisy error on every kit
('.git/info/sparse-checkout: No such file or directory') because 'git init'
does not always create .git/info/ (platform-dependent — reproduced on macOS
where it is absent right after init). Add 'mkdir -p .git/info' before the
sparse-checkout redirect. Reported live during 'acq run' (3x, one per kit);
non-fatal (fetch fell back) but should not emit errors.

Co-authored-by: OpenCode Agent <[email protected]>
Comment thread acq.backends/kit-translate.sh Resolved
Comment thread acq.backends/sbx.sh Resolved
mogul
mogul previously approved these changes Jul 22, 2026

@mogul mogul left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving as already-useful-as-is, though I'd like to see reference to the public/non-public status of the -playbook repository removed as irrelevant, particularly since the assertion as to the current status is not correct.

wz-gsa and others added 3 commits July 23, 2026 11:50
…209 review)

Per @mogul's review: the messages asserted the kit repo is public, which is (a)
incorrect and (b) irrelevant to the fix — the problem is plain git dropping into
an interactive credential prompt (gh auth != git auth), regardless of repo
visibility. Reword the kit-translate.sh + sbx.sh guidance and the
KNOWN_FAILURE_MODES #25 entry to focus on the actual cause + remedy
(gh auth setup-git; check url.*.insteadOf) without any public/private claim.
Comment/message text only; no logic change.

Co-authored-by: OpenCode Agent <[email protected]>
@mogul
mogul merged commit b505336 into main Jul 23, 2026
4 checks passed
@mogul
mogul deleted the fix/acq-kit-fetch-noninteractive branch July 23, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

acq kit fetch drops into interactive git credential prompt (should fetch public kit anonymously, never prompt)

3 participants