Commit 22172db
committed
refactor: simplify agent update logic with clearer conditionals
Refactor _ensure_plugins_loaded to use explicit has_mcp_config flag
and direct self._plugin_specs checks instead of the agent_update_needed
flag. This provides clearer intent while maintaining correctness and
proper type safety.
The agent update is now conditionally executed only when there are
plugins or MCP config to process, avoiding unnecessary model_copy
calls that could interfere with agent initialization.
Also adds comments explaining the keyword-only * syntax (PEP 3102)
in expand_mcp_variables and load_mcp_config functions to prevent
ambiguous positional boolean arguments.
Per review feedback from @neubig.1 parent 5c7ab97 commit 22172db
2 files changed
Lines changed: 18 additions & 12 deletions
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
335 | 338 | | |
336 | 339 | | |
337 | 340 | | |
| |||
359 | 362 | | |
360 | 363 | | |
361 | 364 | | |
| 365 | + | |
362 | 366 | | |
363 | 367 | | |
364 | 368 | | |
| |||
387 | 391 | | |
388 | 392 | | |
389 | 393 | | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
397 | 403 | | |
398 | | - | |
399 | | - | |
400 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
401 | 407 | | |
402 | 408 | | |
403 | 409 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
0 commit comments