Repository navigation
fix: work around pydantic-settings 2.13.0 nested subcommand bug (ENG-6707) - #49
Merged
johnsca merged 5 commits intoFeb 23, 2026
Merged
Conversation
…6707) [ENG-6707](https://stacklet.atlassian.net/browse/ENG-6707) What ---- - Replace `CliApp.run_subcommand(self)` in `AgentConfigCommand.cli_cmd` with `get_subcommand(self, is_required=True).cli_cmd()` - Pin pydantic-settings to `>=2.13.0,<2.14.0` Why --- - pydantic-settings 2.13.0 rewrote `run_subcommand` to navigate `_parser_map` via a `_subcommand_stack`. When computing the nested `subcommand_dest` key it applies `get_kebab_case()` to `preferred_alias` (snake_case field name), converting e.g. `agent_config` → `agent-config`. But `_parser_map` is keyed using the raw `arg.dest` which preserves snake_case. With `cli_kebab_case=True` on `CLIArguments`, the lookup fails with `KeyError: <class AgentConfigGenerateCommand>` when dispatching the third-level subcommand. - `get_subcommand` finds the active subcommand field directly without using `_parser_map`, bypassing the broken navigation entirely. Testing ------- - [x] All 211 existing tests pass Docs ---- N/A Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sontek
approved these changes
Feb 20, 2026
jtroup
approved these changes
Feb 20, 2026
fwereade
approved these changes
Feb 23, 2026
fwereade
left a comment
Contributor
There was a problem hiding this comment.
LGTM as well, but could we also update the
__version__ = "2026.02.0"
then once that's all landed we can just tag-release and (hopefully) fix everybody
johnsca
deleted the
johnsca/fix/ENG-6707/pydantic-settings-2.13.0-error
branch
February 23, 2026 15:54
sampsre
added a commit
that referenced
this pull request
Oct 30, 2026
### what Relax pydantic-settings from `>=2.13,<2.14` to `>=2.13,<2.15` and update the lockfile to 2.14.2. Retain support for 2.13 and the direct nested-command dispatch introduced in #49. Keep 2.15 and later excluded pending validation. Update the Python and uv tool pins to 3.12.16 and 0.13.6. ### why Chainlit 2.12 requires pydantic-settings >=2.14.2, so the current cap prevents it from sharing an environment with stacklet-mcp. The existing CLI workaround remains compatible with 2.14.2. This allows stacklet/platform#5404 to replace its temporary dependency override after this change merges. CI's shared bootstrap fails before lint or tests because Python 3.12.10 has no build for the current Ubuntu 26.04 runner. Python 3.12.16 has a supported build; uv 0.13.6 also knows how to provision that release. ### testing - `just test-coverage`: 258 passed on Python 3.12.16, with 98.40% coverage, including nested CLI commands and settings. - `just lint`, `uv lock --check` and `git diff --check` passed. - `uv pip compile` resolved the candidate package alongside Chainlit 2.12.0 and pydantic-settings 2.14.2 without overrides. ### docs Added a compatibility note under Next Release in NEWS.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ENG-6707
What
CliApp.run_subcommand(self)inAgentConfigCommand.cli_cmdwithget_subcommand(self, is_required=True).cli_cmd()>=2.13.0,<2.14.0Why
run_subcommandto navigate_parser_mapvia a_subcommand_stack. When computing the nestedsubcommand_destkey it appliesget_kebab_case()topreferred_alias(snake_case field name), converting e.g.agent_config→agent-config. But_parser_mapis keyed using the rawarg.destwhich preserves snake_case. Withcli_kebab_case=TrueonCLIArguments, the lookup fails withKeyError: <class AgentConfigGenerateCommand>when dispatching the third-level subcommand.get_subcommandfinds the active subcommand field directly without using_parser_map, bypassing the broken navigation entirely.Testing
Docs
N/A