Commit fd3e29a
Skip and warn on malformed project configs at startup instead of crashing the MCP server (#1424)
* Skip and warn on malformed project configs at startup
`SerenaConfig.from_config_file` iterates the `projects:` list in
`serena_config.yml` and calls `ProjectConfig.load(path)` with no
exception handling. A single malformed `.serena/project.yml`
(missing required key, bad language string, YAML syntax error,
etc.) raises out of the master loader and aborts MCP server
startup before any client handshake or tool registration. Other
projects in the list — even ones that would load cleanly — become
unreachable.
This matches the failure mode behind #997: the schema-migration
shim closed the *cause*, but the surrounding loader still has no
isolation, so the next class of `project.yml` malformation will
take the server down again.
Wrap the `ProjectConfig.load(path)` call in the master loop with
a narrow try/except that logs a warning and continues, matching
the existing skip-with-warning pattern used a few lines above for
inaccessible paths and missing project.yml files. One bad project
becomes one skipped project, not a server-down event.
A new test under `TestSerenaConfigFromConfigFileRobustness`
registers two projects (one healthy, one with invalid YAML),
asserts that `from_config_file` returns successfully, that only
the healthy project ends up registered, and that a warning naming
the bad path is logged.
---------
Co-authored-by: Michael Panchenko <35432522+MischaPanch@users.noreply.github.com>1 parent ae7f106 commit fd3e29a
2 files changed
Lines changed: 68 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
869 | 869 | | |
870 | 870 | | |
871 | 871 | | |
872 | | - | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
873 | 884 | | |
874 | 885 | | |
875 | 886 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
502 | 558 | | |
503 | 559 | | |
504 | 560 | | |
| |||
0 commit comments