mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-10-18 14:07:31 +02:00
Prevent --json from prompting interactively on a 403
Per review: --json still went through _create_host_backend_client and _call_host_backend_with_optional_tenant, both of which prompt interactively (writing to stdout, reading stdin) when the module- level _no_input flag is left at its default False. deploy_listeners_ list never set it, unlike the main deploy command, so a missing API key or an org-scoped key without LANGSMITH_TENANT_ID would corrupt the JSON output with warning text and could hang waiting for input that a scripted invocation never provides. Sets _no_input = json_output at the top of the command, same pattern _deploy_cmd already uses, so both paths raise a ClickException to stderr instead. Added a regression test that fails without the fix (click.prompt is genuinely invoked) and passes with it.
This commit is contained in:
@@ -2536,6 +2536,8 @@ def deploy_listeners() -> None:
|
||||
def deploy_listeners_list(
|
||||
api_key: str | None, host_url: str | None, json_output: bool
|
||||
) -> None:
|
||||
global _no_input
|
||||
_no_input = json_output
|
||||
client = _create_host_backend_client(host_url, api_key)
|
||||
listeners = _call_host_backend_with_optional_tenant(
|
||||
client, lambda c: c.list_listeners()
|
||||
|
||||
Reference in New Issue
Block a user