fix(cli): remove shadowing local json import breaking A2A setup#6345
fix(cli): remove shadowing local json import breaking A2A setup#6345AnayGarodia wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
@googlebot I signed it! |
cbd1837 to
96765a5
Compare
|
Hi @AnayGarodia , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share. |
|
Hi @wyf7107 , can you please review this. LGTM |
4facc49 to
f23b0e6
Compare
|
Rebased onto Heads-up from the rebase: the underlying The test is skipped on the a2a-sdk v1 path ( |
Fixes #6332
Running
adk api_server --a2a(orget_fast_api_app(..., a2a=True)) silently mounts no A2A routes. Thegemini_enterprise_app_nameblock near the end ofget_fast_api_apphas a redundant function-localimport json. Because of that local import,jsonis a local variable for the entire function, so the earlierjson.load(f)in the A2A discovery loop raisesUnboundLocalError: cannot access local variable 'json'. That exception is caught by the loop'sexcept Exception, logged as "Failed to setup A2A agent", and swallowed, so every A2A agent silently fails to register and no/a2a/...routes are added.jsonis already imported at module scope, so this removes the redundant local import. (The siblingimport inspectin that block is kept:inspectis not imported at module scope.)The existing A2A test only checks
/list-apps, so it passed despite the broken route mounting. The added regression test drivesget_fast_api_app(a2a=True)over a temp agent directory and asserts the A2A application is actually constructed (i.e. execution gets past thejson.loadcall). It fails onmainwith theUnboundLocalErrorpath and passes with this change; the existing A2A tests continue to pass.