Skip to content

patch: typing error#5

Merged
JohnRichard4096 merged 1 commit intomainfrom
patch/name
Feb 11, 2026
Merged

patch: typing error#5
JohnRichard4096 merged 1 commit intomainfrom
patch/name

Conversation

@JohnRichard4096
Copy link
Member

@JohnRichard4096 JohnRichard4096 commented Feb 11, 2026

Summary by Sourcery

Fix a typo in the LLM configuration memory limit field and propagate the corrected name across code and tests.

Bug Fixes:

  • Correct the LLM configuration field name for the memory length limit to ensure consistent access throughout the codebase.

Build:

  • Bump the project version to 0.4.0.post1 to reflect the patch release.

Tests:

  • Update the memory limit test to reference the corrected configuration field name.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 11, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Fixes a misspelled LLM configuration field for memory length limit across config, implementation, and tests, and bumps the project patch version to reflect the bugfix.

Class diagram for LLMConfig memory_length_limit field rename

classDiagram
    class LLMConfig {
        +bool force_tool_usage
        +int memory_length_limit
        +int max_tokens
    }
Loading

File-Level Changes

Change Details Files
Rename LLMConfig memory length limit field to the correctly spelled name and update all usages.
  • Rename LLMConfig field from memory_lenth_limit to memory_length_limit while preserving default and description.
  • Update ChatManager._limit_length to use the corrected config field name when enforcing the memory limit.
  • Update the memory length limit test to use the corrected field name in both configuration and assertions.
src/amrita_core/config.py
src/amrita_core/chatmanager.py
tests/test_chatmanager.py
Bump project version to a post-release patch to capture the bugfix.
  • Change project version from 0.4.0 to 0.4.0.post1 in pyproject configuration.
pyproject.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • Renaming memory_lenth_limit to memory_length_limit in LLMConfig is a breaking config change; consider adding a backwards-compatible alias or input validation that accepts the old key to avoid silently breaking existing user configs.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Renaming `memory_lenth_limit` to `memory_length_limit` in `LLMConfig` is a breaking config change; consider adding a backwards-compatible alias or input validation that accepts the old key to avoid silently breaking existing user configs.

## Individual Comments

### Comment 1
<location> `src/amrita_core/config.py:81` </location>
<code_context>
         description="Whether to force at least one tool to be used per call",
     )
-    memory_lenth_limit: int = Field(
+    memory_length_limit: int = Field(
         default=50, description="Maximum number of messages in memory context"
     )
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Consider keeping a backward-compatible alias for the old `memory_lenth_limit` field name.

This rename fixes the typo but may break existing configs or stored data that still reference `memory_lenth_limit` (e.g., JSON/YAML config files or env vars). In Pydantic, you can keep `memory_length_limit` as the primary field while defining `memory_lenth_limit` as an alias (via `alias`/`field_alias` or model config) so older configs continue to work without errors.

Suggested implementation:

```python
    # `memory_lenth_limit` kept as an alias for backward compatibility with existing configs
    memory_length_limit: int = Field(
        default=50,
        description="Maximum number of messages in memory context",
        alias="memory_lenth_limit",
    )

```

Depending on your Pydantic version and how this model is used, you may also want to:
1. For Pydantic v1: in the model's `Config` class, set `allow_population_by_field_name = True` so both `memory_length_limit` and `memory_lenth_limit` can be used for input.
2. For Pydantic v2: in the model, set `model_config = ConfigDict(populate_by_name=True)` (or equivalent) to allow population by the new field name as well as the alias.
3. If there are serializers or exported schemas, confirm whether you want the new field name (`memory_length_limit`) to be emitted (via `by_alias=False`) or the legacy name (`memory_lenth_limit`) (`by_alias=True`).
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@JohnRichard4096 JohnRichard4096 merged commit d6e667f into main Feb 11, 2026
2 checks passed
@JohnRichard4096 JohnRichard4096 deleted the patch/name branch February 11, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant