Commit 3db9365
committed
Address greptile: decouple the client timeouts from EnvironmentVariables
Greptile flagged that adding the four timeout fields to the shared
EnvironmentVariables model meant a malformed value broke far more than the
client factory: refresh() is called from ~20 unguarded places, including
AgentWorker startup and EnvAuth.auth_flow on every request. The try/except in
create_async_agentex_client() did not contain that, it only made it look
handled.
Removing the try/except alone made it worse. agentex/lib/adk/utils/__init__.py
constructs TemplatingModule() at module scope, which builds a client, so
importing the ADK started requiring AGENT_NAME and ACP_URL to be set. The
suppressed exception had been hiding that.
Read the four values from os.environ in client.py instead. The shared model is
untouched, so startup, auth and import are unaffected, and a malformed value
raises a ValueError naming the variable at the point it is used rather than
being swallowed. Adds a regression test asserting the timeout does not depend
on the shared model.1 parent e02c23d commit 3db9365
3 files changed
Lines changed: 73 additions & 65 deletions
File tree
- src/agentex/lib
- adk/utils/_modules
- tests/lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
29 | 40 | | |
30 | 41 | | |
31 | 42 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
36 | 52 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
44 | 64 | | |
45 | 65 | | |
46 | 66 | | |
| |||
50 | 70 | | |
51 | 71 | | |
52 | 72 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 73 | + | |
58 | 74 | | |
59 | 75 | | |
60 | 76 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 23 | | |
29 | 24 | | |
30 | 25 | | |
31 | 26 | | |
32 | 27 | | |
| 28 | + | |
33 | 29 | | |
34 | 30 | | |
35 | 31 | | |
| |||
66 | 62 | | |
67 | 63 | | |
68 | 64 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | 65 | | |
78 | 66 | | |
79 | 67 | | |
80 | 68 | | |
81 | 69 | | |
82 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
83 | 77 | | |
84 | 78 | | |
85 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 22 | + | |
40 | 23 | | |
41 | | - | |
42 | 24 | | |
43 | 25 | | |
44 | 26 | | |
| |||
47 | 29 | | |
48 | 30 | | |
49 | 31 | | |
50 | | - | |
| 32 | + | |
51 | 33 | | |
52 | 34 | | |
53 | 35 | | |
54 | 36 | | |
55 | 37 | | |
56 | 38 | | |
57 | 39 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
65 | 44 | | |
66 | 45 | | |
67 | 46 | | |
| |||
71 | 50 | | |
72 | 51 | | |
73 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
74 | 60 | | |
75 | | - | |
| 61 | + | |
76 | 62 | | |
77 | 63 | | |
78 | 64 | | |
79 | 65 | | |
80 | 66 | | |
81 | | - | |
| 67 | + | |
82 | 68 | | |
83 | 69 | | |
84 | 70 | | |
| |||
87 | 73 | | |
88 | 74 | | |
89 | 75 | | |
90 | | - | |
| 76 | + | |
91 | 77 | | |
92 | | - | |
93 | 78 | | |
94 | 79 | | |
95 | 80 | | |
96 | 81 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
0 commit comments