Commit db11dbe
fix: preserve picklable credentials, drop only non-picklable ones
The previous commit cleared both _credentials and _user_credentials
unconditionally in __getstate__, silently dropping picklable user
credentials (service-account, AnonymousCredentials) after unpickle.
This caused the plugin to fall back to ADC instead of the user's
configured identity.
Now __getstate__ tests whether _user_credentials is picklable:
- Picklable: preserved — survives pickle and restored on unpickle
- Non-picklable: dropped gracefully — falls back to ADC
Adds two tests covering both paths.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent babf2a7 commit db11dbe
2 files changed
Lines changed: 66 additions & 8 deletions
File tree
- src/google/adk/plugins
- tests/unittests/plugins
Lines changed: 16 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2546 | 2546 | | |
2547 | 2547 | | |
2548 | 2548 | | |
2549 | | - | |
2550 | | - | |
2551 | | - | |
2552 | | - | |
| 2549 | + | |
2553 | 2550 | | |
2554 | | - | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
2555 | 2561 | | |
2556 | 2562 | | |
2557 | 2563 | | |
| |||
2561 | 2567 | | |
2562 | 2568 | | |
2563 | 2569 | | |
2564 | | - | |
2565 | | - | |
2566 | | - | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
2567 | 2575 | | |
2568 | 2576 | | |
2569 | 2577 | | |
| |||
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2093 | 2093 | | |
2094 | 2094 | | |
2095 | 2095 | | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
2096 | 2146 | | |
2097 | 2147 | | |
2098 | 2148 | | |
| |||
0 commit comments