Skip to content

fix(agents): reject non-positive LangChainAgent max_size#815

Merged
maciejmajek merged 2 commits into
RobotecAI:bartok9/fixesfrom
Bartok9:fix/agent-reject-nonpositive-max-size
Jul 22, 2026
Merged

fix(agents): reject non-positive LangChainAgent max_size#815
maciejmajek merged 2 commits into
RobotecAI:bartok9/fixesfrom
Bartok9:fix/agent-reject-nonpositive-max-size

Conversation

@Bartok9

@Bartok9 Bartok9 commented Jul 20, 2026

Copy link
Copy Markdown

Summary

LangChainAgent treated any max_size as valid. With max_size <= 0, the queue is always considered full on the first enqueue path (len >= max_size), so the agent either drops/poplefts incorrectly or never buffers usefully.

Change

  • Raise ValueError when max_size <= 0 at construction.
  • Offline unit tests with mocked runnable/connectors.

Test plan

  • uv run python -m pytest tests/agents/langchain/test_langchain_agent_max_size.py -q

AI-assisted; human-reviewed.

Refuse max_size <= 0 so the message buffer cannot be constructed in a
state where every enqueue immediately treats the queue as full.
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.99%. Comparing base (e54f8ca) to head (39a48c3).
⚠️ Report is 16 commits behind head on bartok9/fixes.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@                Coverage Diff                @@
##           bartok9/fixes     #815      +/-   ##
=================================================
+ Coverage          73.19%   73.99%   +0.79%     
=================================================
  Files                 82       82              
  Lines               3582     3584       +2     
=================================================
+ Hits                2622     2652      +30     
+ Misses               960      932      -28     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Require-version-bump gates src/rai_core changes; drop extra blank after pytest import (ruff).
@maciejmajek
maciejmajek changed the base branch from main to bartok9/fixes July 22, 2026 10:04
@maciejmajek
maciejmajek merged commit 460367f into RobotecAI:bartok9/fixes Jul 22, 2026
7 of 8 checks passed
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.

2 participants