Repository navigation
fix(cli): every command reports a DevOpsCLIError through one exit seam - #2502
Merged
Merged
Conversation
The wrapper of new_typer() reports each DevOpsCLIError that a command, or a callback that runs as a command, raises: one error line with the markup of its message escaped, the error's exit status, and no traceback. Before, a DevOpsCLIError that no block caught ended the command with a traceback and status 1. - OTelTyper loses exit_on, and exit_on_error becomes the private _report_devops_error of the wrapper. - The exit_on= arguments of 18 apps, 41 exit_on_error blocks and 21 hand-rolled `raise typer.Exit(exc.exit_code)` handlers are deleted, with the two error printers that they left without a caller. - The config app is a new_typer() app, so its commands pass through the seam. - A Cloudflare, Valkey, sandbox-logs or SBOM error now prints its own message without the text the handler put before it. Each exit status stays the same.
Owner
Author
|
Test evidence:
Pending a person: run a |
dan-petty
force-pushed
the
fix/2487-one-exit-seam
branch
from
October 28, 2026 19:12
7b9ae9f to
29ee200
Compare
dan-petty
marked this pull request as ready for review
October 28, 2026 19:18
dan-petty
pushed a commit
that referenced
this pull request
Oct 28, 2026
🤖 I have created a release *beep* *boop* --- ## [0.11.0](v0.10.1...v0.11.0) (2026-10-28) ### Features * **monitoring:** the roadmap Service's identity refusals, failing and stalled jobs, restarts, and GitHub and model request volume raise alerts ([#2496](#2496)) ([0137f23](0137f23)), closes [#2472](#2472) * **service:** roadmap-service runs at one replica, and each model call in the cluster is sent at most two times ([#2500](#2500)) ([2d32dae](2d32dae)), closes [#2494](#2494) ### Bug Fixes * **cli:** every command reports a DevOpsCLIError through one exit seam ([#2502](#2502)) ([eadd55f](eadd55f)), closes [#2487](#2487) * **github:** pr monitor waits until the checks settle and names every blocker, and pr ready reads the merge-readiness verdict ([#2498](#2498)) ([43326ea](43326ea)) * **k8s:** a pod that does not call the Kubernetes API mounts no service account token ([#2522](#2522)) ([305d3ba](305d3ba)) * **k8s:** the cloudflared tunnel replicas prefer different nodes and keep one up through a drain ([#2499](#2499)) ([d4edaf6](d4edaf6)), closes [#1023](#1023) * **k8s:** the grafana, prometheus, argo cd and loki clients dial through the egress-checked factory, and their pre-flight address checks go ([#2497](#2497)) ([e7ca1d5](e7ca1d5)) * **monitoring:** the roadmap Service alerts count a series that starts in the hour, and a lane of a new pod can stall ([#2514](#2514)) ([c7692b2](c7692b2)), closes [#2505](#2505) * **review:** a review's scanners leave out the rules that never gave a valid finding here ([#2508](#2508)) ([fe953ac](fe953ac)) * **roadmap:** a refine round leaves an outside account issue to a person, and refine neutralizes comment openers, www links and cross-repository references ([#2507](#2507)) ([e6230dc](e6230dc)), closes [#2478](#2478) * **sandbox:** the metrics scrape and the whitelist NetworkPolicy resolve each host one time, through the egress check ([#2521](#2521)) ([7c01426](7c01426)) * **security:** the subprocess environment guard refuses the zsh and interpreter keys that make a child run code ([#2510](#2510)) ([459621a](459621a)) * **service:** a restart keeps the halt, the budget window and the failure ledger, and a rate limit or a suspended installation stops every worker ([#2515](#2515)) ([3630de1](3630de1)), closes [#2474](#2474) ### Code Refactoring * **config:** settings resolve in one declared order through pydantic-settings sources ([#2518](#2518)) ([6a5447a](6a5447a)), closes [#2445](#2445) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
dan-petty
added a commit
that referenced
this pull request
Oct 28, 2026
… address A command of each `devops cloudflare` group runs against api.cloudflare.com, whose DNS answer is 10.0.0.1. The client refuses the address at the connect and raises SSRFBlockedError. The test expects the command to print the message of SSRFBlockedError and to exit with its exit code, 2, with no traceback, and expects no dial to 10.0.0.1. The exit seam of OTelTyper.command (#2502) reports the error. Before the client fix, the client sent the request with no address check, and the command exited with code 1, so the rows fail on that code.
dan-petty
added a commit
that referenced
this pull request
Oct 28, 2026
…efused cloudflare request The exit seam of new_typer() (#2502) reports each DevOpsCLIError that a command raises. SSRFBlockedError is a DevOpsCLIError. Thus a `devops cloudflare` command prints the refusal and exits with code 2, with no traceback, and commands/cloudflare.py does not change. The design decision, the rejected alternative, the proposal and the task of 2430 name the seam. The requirement of public-api-egress stays the same. The feasibility record names the new base, 305d3ba, and records that the socket gets neither 10.0.0.1 nor api.cloudflare.com on the fixed code, and the host name on the code before the move.
dan-petty
added a commit
that referenced
this pull request
Oct 28, 2026
…o main The branch was rebased onto main after #2502 deleted exit_on. This merge keeps the old commits of the remote branch, so that the push does not rewrite the remote history. The merge uses the strategy ours: the tree is the tree of the rebased branch.
dan-petty
added a commit
that referenced
this pull request
Oct 28, 2026
…dial through the egress-checked factory at the public level (#2509) The clients of four fixed public APIs get their HTTP client from the egress-checked factory (`devops_cli.http.client`) at the public level: the OSV lookup (`api.osv.dev`), the Shodan InternetDB lookup (`internetdb.shodan.io`), the Cloudflare Radar lookup and the Cloudflare API client (`api.cloudflare.com`). Before, each client built a raw `httpx2.Client`. httpx2 resolved the API host at the socket and dialled each answer with no check. Thus a bad or rebinding DNS answer could send the request to a loopback, private or link-local address. For the Cloudflare clients, the request also sent the Cloudflare API token to that address. - Each client resolves its API host one time, at the connect, and dials only a public address. `ai.allow_private_network` does not change this level. Cloud metadata addresses are refused at every level. The factory checks each redirect hop in the same way. The timeouts do not change. - A refused lookup of OSV, InternetDB or Radar gives the same result as a failed connect. - A refused request of the Cloudflare API client raises `SSRFBlockedError`. The exit seam of `new_typer()` (#2502) reports this `DevOpsCLIError` for each command of the `cloudflare`, `dns`, `tunnel` and `access` groups. Thus each `devops cloudflare` command prints the message and exits with code 2, with no traceback. - The `transport` argument of `CloudflareRadarClient` is deleted. No caller gave it, and the factory takes no transport. - The four clients do not use a proxy from `HTTP_PROXY`, `HTTPS_PROXY` or `ALL_PROXY`, because no factory client does. On a workstation that gets to the internet only through a proxy, the lookups give the result of a failed connect, and the `devops cloudflare` commands fail. - `README.md` names the moved clients. The new capability `public-api-egress` holds the requirements. This change is part 3 of the split of #1381. Part 5 (#2437) deletes `_resolve_host_ips` and `_enforce_non_private_ssrf`. The outcome `ok` of a failed InternetDB lookup is a separate defect, #2504. Closes #2430 Change: `openspec/changes/archive/2026-10-28-2430-public-api-clients-egress-factory/` --------- Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every
devopscommand now reports aDevOpsCLIErrorin one way. The wrapper ofnew_typer()(OTelTyper.command) reports eachDevOpsCLIErrorthat a command raises: it prints the error's message in one error line, with any Rich markup in it escaped, and exits with the error'sexit_code, with no traceback.OTelTyper.callbackdoes the same for a callback that runs as a command (devops benchmark,devops dashboard).Before, a command reported the error in four ways:
exit_on=on 18 apps, 41exit_on_errorblocks, 21 hand-rolledraise typer.Exit(exc.exit_code)handlers, or not at all. ADevOpsCLIErrorthat no block caught ended the command with a traceback and status 1, not with its own status.devops docker sandbox --dry-runon a refused workspace was one example.OTelTyperlosesexit_on, andexit_on_errorbecomes the private_report_devops_errorof the wrapper.exit_on=arguments, theexit_on_errorblocks and the hand-rolled handlers are deleted, with_print_cloudflare_errorand_print_valkey_error, which had no caller left.commands/config.pybuilds its app withnew_typer(), so its commands pass through the seam and get thecli.<command>span, which holds no parameter value.DevOpsCLIErrorpropagates as before.OTelTyper; a source invariant refusesexit_on=,exit_on_errorand a hand-rolledtyper.Exit(exc.exit_code)undercommands/.ARCHITECTURE.mdandCONTRIBUTING.mddescribe the seam.This is part 1 of #1006. Part 2, #2490, moves the error codes onto the exception classes.
Closes #2487
Change:
openspec/changes/archive/2026-10-28-2487-one-exit-seam/