Commit 18e7a32
Fix execute_custom_tool bypassed when unity_instance is specified (#724)
* Fix execute_custom_tool bypassed when unity_instance is specified
Move execute_custom_tool handling outside the if/else block so it's
executed regardless of whether unity_instance is provided.
Previously, when unity_instance was specified, the code would take the
if branch (match by hash/name) and return 404 if not found,
but the execute_custom_tool block was only in the else branch,
causing custom tools to fall through to PluginHub.send_command.
Fixes #649
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Handle empty sessions gracefully when selecting default session
When no active sessions exist, next(iter(sessions.sessions.keys()))
raises StopIteration. Catch this exception and set session_id
and session_details to None, allowing execute_custom_tool guard to work
as intended.
Suggested by Sourcery review.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move default session selection into execute_custom_tool block
Per Sourcery review: moving the default session selection
inside execute_custom_tool ensures the empty sessions guard works
correctly. If sessions becomes empty between the initial check
and this code, the StopIteration will now properly trigger the
session validation guard and return a 503 error.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: remove unintended uv.lock changes from PR
* 优化 execute_custom_tool 逻辑以优先使用可用会话
---------
Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 038a39e commit 18e7a32
1 file changed
Lines changed: 73 additions & 53 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | | - | |
398 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
399 | 427 | | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
405 | 431 | | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
413 | 447 | | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
452 | 467 | | |
453 | | - | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
454 | 474 | | |
455 | 475 | | |
456 | 476 | | |
| |||
0 commit comments