Repository navigation
fix(cli): stop returning exception text from session 400s and finalize credentials - #8340
Draft
ishan-1010 wants to merge 2 commits into
Draft
ishan-1010 wants to merge 2 commits into
ishan-1010 wants to merge 2 commits into
Conversation
The generic except in create_session put str(e) in the response, so a failing session service could hand its paths or database URL to the caller. Use report_error like the A2A executors and trigger routes do. Refs google#8250
…e credentials The session create 400 branch and the /agent-identity/finalize route put the exception text in the response. The text can carry the server's own engine id, stored state errors or upstream resource names. Send them through the same redaction as the 500 paths. 4xx responses are logged as warnings, 5xx as errors. Refs google#8250
Contributor
Author
|
stacked on #8251 so the first commit here is that one. once it merges i'll rebase and mark this ready for review. fyi @surajksharma07 |
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.
Follow up to #8251 for the 4xx paths in #8250. The session create 400 and the
/agent-identity/finalizeroute still put the exception text in the response. That text can carry the server's own engine id, stored state errors or upstream resource names. They now use the same redaction as the 500 paths, a fixed message plus an error id, and the real text only shows withADK_DEBUG_ERRORS.This is stacked on #8251, so the first commit here is that PR. Only the top commit is new. I can rebase once #8251 merges.
Link to issue
Refs #8250
What changed
InvalidArgument), forGoogleAPICallError(same status code as before) and for the generic 500report_errorLeft alone on purpose
The base64 400 in finalize still returns its message, since that is only the caller's own input.
Testing plan
Added cases to
tests/unittests/cli/test_api_server_error_leak.py. They fail without the change (6 failed, 3 passed) and pass with it (9 passed).ValueErrorwith a Vertex engine id, expect a 400 without the id and with an error idADK_DEBUG_ERRORS=1brings the text back on the 400InvalidArgument,PermissionDenied,InternalServerErrorand a plainRuntimeError, expect the same status codes as before, no secret in the body and an error idThe finalize tests fake the optional agent-identity package. pyink and isort pass. I could not run the rest of
tests/unittests/clilocally because of optional dependencies. The two existing finalize tests intest_fast_api.pyonly check for the "Invalid credentials request" and "Failed to finalize credentials" text, which is still in the new messages, but I am relying on CI to confirm.