Skip to content

JGC-501 - Force non-interactive mode when CLI is invoked by an agent#1573

Open
ehl-jf wants to merge 1 commit into
masterfrom
bugfix/JGC-501
Open

JGC-501 - Force non-interactive mode when CLI is invoked by an agent#1573
ehl-jf wants to merge 1 commit into
masterfrom
bugfix/JGC-501

Conversation

@ehl-jf

@ehl-jf ehl-jf commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Problem

Since v2.107.0, jf api (and any other command) prompts for interactive configuration when no server profile exists and $CI is not set. This causes automation scripts driven by AI agents (Claude Code, Cursor, Gemini, etc.) to hang waiting for a yes/no answer — even when --url and auth flags are supplied on the command line.

Root cause: ShouldOfferConfig() suppresses the prompt only for $CI=true. The existing DetectExecutionContext().IsAgent infrastructure — already used for AI-help rendering — was not consulted here.

Fix

Add a second early-return guard in ShouldOfferConfig() (common/cliutils/utils.go) that mirrors the CI check:

server config exists?            → no offer (unchanged)
CI=true?                         → no offer (unchanged)
DetectExecutionContext().IsAgent? → no offer  ← new
AskYesNo(…)                      → interactive prompt (unchanged for human TTY)

When the guard fires, the CLI skips the offer and proceeds. If no URL is known (not configured, not passed via --url), the existing fast-fail error fires normally — the script gets a non-zero exit code instead of hanging.


  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • All static analysis checks passed.
  • This pull request is on the master branch.
  • I used gofmt for formatting the code before submitting the pull request.

@ehl-jf ehl-jf added improvement Automatically generated release notes safe-to-test labels Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Automatically generated release notes safe-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants