langgraph/libs/cli/langgraph_cli
raghavverma-langchain c6335a4255
fix(cli): omit an empty secrets list when updating a deployment (#9737)
## Summary

`langgraph deploy` builds its secrets list from `.env`, so without one
(or with one that has no values) it sent `secrets: []` on every update.
the control plane already reads an empty list on update as "keep the
current values", so nothing changed, but the request said "replace with
nothing". now updates leave `secrets` out when there's nothing to send

- the check lives in the two update methods on the host backend client,
so local builds, remote builds and `--push-to` / `--image-uri` updates
all get it
- creating a deployment still sends `secrets`, even when empty, since
the control plane requires it there
- no change when your `.env` has variables: the full list is still sent
and replaces the deployment's variables as before
- the js cli gets the same change in langchain-ai/langgraphjs#3414

## Test Plan
- [x] `make test` passes in `libs/cli` (743 tests). ruff and format are
clean; `ty` only reports the two `contextmanager` deprecation warnings
that are also on main
- [x] New client test: an update with an empty list omits `secrets`.
Updated the four deploy command tests that expected `"secrets": []` on
update. All of these fail without the change
- [x] New client test: a remote-build update still forwards a non-empty
list. Fails if that update drops `secrets`
- [ ] After release, `langgraph deploy` without a `.env` against an
existing deployment keeps the variables set in the UI

## Demo

real cli runs, main vs this branch, against a local server that records
each request, with no .env in the project. the control plane handles
both requests the same way; the difference is the `secrets` field in the
update

<img width="1100" alt="langgraph deploy update request before and after"
src="https://github.com/user-attachments/assets/578b6edf-170f-4e4a-95d0-84a9ec97bc9a"
/>
2026-11-20 10:33:23 -08:00
..
__init__.py release(cli): 0.4.43 (#9682) 2026-11-12 16:04:37 +00:00
__main__.py feat: CLI: Add __main__.py (#4637) 2025-05-09 13:14:45 -07:00
_ignore.py chore: mixup cli formatting (#7585) 2026-04-22 11:29:23 -07:00
analytics.py fix(cli): remove discontinued local debugger image (#8543) 2026-11-11 20:43:53 -05:00
archive.py chore: mixup cli formatting (#7585) 2026-04-22 11:29:23 -07:00
cli.py feat(cli): use Agent Server flags with hidden deployment aliases (#9666) 2026-11-12 09:51:38 -05:00
config.py feat(cli): add the priority section to langgraph.json (#9393) 2026-10-22 17:26:01 -04:00
constants.py cli: add analytics (#754) 2024-06-24 18:14:56 -04:00
dependency_tracking.py chore(langgraph): Track ADK/other library usage when deploying using cli (#7939) 2026-05-29 13:46:10 -07:00
deploy.py feat(cli): deploy to BYOC data planes with only an API key (#9692) 2026-11-13 20:21:54 -05:00
deployment_metrics.py feat(cli): add deploy metrics command (#9479) 2026-11-05 18:20:14 -05:00
docker.py feat(cli): use Agent Server flags with hidden deployment aliases (#9666) 2026-11-12 09:51:38 -05:00
exec.py fix(cli): stop printing subprocess stdin in verbose output (#9350) 2026-10-19 13:45:42 +00:00
host_backend.py fix(cli): omit an empty secrets list when updating a deployment (#9737) 2026-11-20 10:33:23 -08:00
image_reference.py feat(cli): add --image-uri flag for self-hosted deployments (#8482) 2026-09-22 11:50:02 -04:00
progress.py feat(cli): support studio deploy (#7394) 2026-05-06 03:20:50 +01:00
py.typed libs: add py.typed (#729) 2024-06-20 17:08:35 -04:00
schemas.py feat(cli): use Agent Server flags with hidden deployment aliases (#9666) 2026-11-12 09:51:38 -05:00
templates.py release(cli): 0.4.17 (#7166) 2026-03-13 16:07:27 -04:00
util.py feat(cli): support studio deploy (#7394) 2026-05-06 03:20:50 +01:00
uv_lock.py feat(cli): add the priority section to langgraph.json (#9393) 2026-10-22 17:26:01 -04:00
version.py cli: add analytics (#754) 2024-06-24 18:14:56 -04:00