UAT: LangGraph GraphState and actor graph config missing memory_enabled/max_history fields — per-actor conversation memory configuration not implemented #3667

Open
opened 2026-04-05 21:16:57 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/langgraph-memory-config-fields
  • Commit Message: fix(langgraph): add memory_enabled and max_history config fields to GraphConfig and StateManager
  • Milestone: None (backlog)
  • Parent Epic: #366

Background

Per docs/specification.md (lines 20303, 20322–20323, 20329–20362), actor graph configurations support memory settings:

| `config.memory_enabled` | boolean | No | Enable conversation memory (default: `false`). |
| `config.max_history`    | integer | No | Maximum conversation turns retained in memory (default: `50`). |

The spec also shows an example actor config:

config:
  actor: local/code-reviewer
  memory_enabled: true
  max_history: 20

Current Behavior

The GraphState class in src/cleveragents/langgraph/state.py (lines 32–83) has no memory_enabled or max_history fields:

class GraphState(BaseModel):
    messages: list[dict[str, Any]] = Field(default_factory=list)
    metadata: dict[str, Any] = Field(default_factory=dict)
    current_node: str | None = None
    execution_count: int = 0
    error: str | None = None

The GraphConfig class in src/cleveragents/langgraph/graph.py (lines 28–38) also has no memory_enabled or max_history fields:

class GraphConfig(BaseModel):
    name: str
    nodes: dict[str, NodeConfig] = Field(default_factory=dict)
    edges: list[Edge] = Field(default_factory=list)
    entry_point: str = "start"
    state_class: type | None = None
    checkpointing: bool = False
    checkpoint_dir: Path | None = None
    enable_time_travel: bool = False
    parallel_execution: bool = True
    metadata: dict[str, Any] = Field(default_factory=dict)

The RxPyLangGraphBridge.create_graph_from_config() in bridge.py also does not pass memory_enabled or max_history when constructing GraphConfig.

The StateManager.update_state() does enforce a 50-message limit in GraphState.update() (hardcoded at line 56–57), but this is not configurable per-actor.

Expected Behavior (per spec)

  1. GraphConfig should have memory_enabled: bool = False and max_history: int = 50 fields
  2. StateManager should respect max_history when trimming the messages list
  3. RxPyLangGraphBridge.create_graph_from_config() should pass memory_enabled and max_history from the config dict to GraphConfig
  4. When memory_enabled=False, the graph should not retain conversation history between invocations

Code Location

  • src/cleveragents/langgraph/graph.py lines 28–38: GraphConfig — missing memory_enabled, max_history fields
  • src/cleveragents/langgraph/state.py lines 86–202: StateManager — hardcoded 50-message limit, not configurable
  • src/cleveragents/langgraph/bridge.py lines 137–179: create_graph_from_config() — does not pass memory config

Impact

Per-actor memory configuration is not functional. All actors use the same hardcoded 50-message limit regardless of their max_history configuration. Actors with memory_enabled: false still retain conversation history.

Subtasks

  • Add memory_enabled: bool = False and max_history: int = 50 to GraphConfig
  • Update StateManager to accept and respect max_history parameter
  • Update create_graph_from_config() to pass memory_enabled and max_history from config
  • When memory_enabled=False, clear messages between invocations
  • Write Behave unit tests verifying memory configuration behavior
  • Verify all nox stages pass; coverage ≥ 97%

Definition of Done

This issue is complete when:

  • GraphConfig has memory_enabled and max_history fields
  • StateManager respects max_history for message trimming
  • memory_enabled=False clears conversation history between invocations
  • Unit tests pass for memory configuration
  • All nox stages pass; coverage ≥ 97%
  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.

Backlog note: This issue was discovered during autonomous operation
on milestone v3.6.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/langgraph-memory-config-fields` - **Commit Message**: `fix(langgraph): add memory_enabled and max_history config fields to GraphConfig and StateManager` - **Milestone**: None (backlog) - **Parent Epic**: #366 ## Background Per `docs/specification.md` (lines 20303, 20322–20323, 20329–20362), actor graph configurations support memory settings: ``` | `config.memory_enabled` | boolean | No | Enable conversation memory (default: `false`). | | `config.max_history` | integer | No | Maximum conversation turns retained in memory (default: `50`). | ``` The spec also shows an example actor config: ```yaml config: actor: local/code-reviewer memory_enabled: true max_history: 20 ``` ## Current Behavior The `GraphState` class in `src/cleveragents/langgraph/state.py` (lines 32–83) has no `memory_enabled` or `max_history` fields: ```python class GraphState(BaseModel): messages: list[dict[str, Any]] = Field(default_factory=list) metadata: dict[str, Any] = Field(default_factory=dict) current_node: str | None = None execution_count: int = 0 error: str | None = None ``` The `GraphConfig` class in `src/cleveragents/langgraph/graph.py` (lines 28–38) also has no `memory_enabled` or `max_history` fields: ```python class GraphConfig(BaseModel): name: str nodes: dict[str, NodeConfig] = Field(default_factory=dict) edges: list[Edge] = Field(default_factory=list) entry_point: str = "start" state_class: type | None = None checkpointing: bool = False checkpoint_dir: Path | None = None enable_time_travel: bool = False parallel_execution: bool = True metadata: dict[str, Any] = Field(default_factory=dict) ``` The `RxPyLangGraphBridge.create_graph_from_config()` in `bridge.py` also does not pass `memory_enabled` or `max_history` when constructing `GraphConfig`. The `StateManager.update_state()` does enforce a 50-message limit in `GraphState.update()` (hardcoded at line 56–57), but this is not configurable per-actor. ## Expected Behavior (per spec) 1. `GraphConfig` should have `memory_enabled: bool = False` and `max_history: int = 50` fields 2. `StateManager` should respect `max_history` when trimming the messages list 3. `RxPyLangGraphBridge.create_graph_from_config()` should pass `memory_enabled` and `max_history` from the config dict to `GraphConfig` 4. When `memory_enabled=False`, the graph should not retain conversation history between invocations ## Code Location - `src/cleveragents/langgraph/graph.py` lines 28–38: `GraphConfig` — missing `memory_enabled`, `max_history` fields - `src/cleveragents/langgraph/state.py` lines 86–202: `StateManager` — hardcoded 50-message limit, not configurable - `src/cleveragents/langgraph/bridge.py` lines 137–179: `create_graph_from_config()` — does not pass memory config ## Impact Per-actor memory configuration is not functional. All actors use the same hardcoded 50-message limit regardless of their `max_history` configuration. Actors with `memory_enabled: false` still retain conversation history. ## Subtasks - [ ] Add `memory_enabled: bool = False` and `max_history: int = 50` to `GraphConfig` - [ ] Update `StateManager` to accept and respect `max_history` parameter - [ ] Update `create_graph_from_config()` to pass `memory_enabled` and `max_history` from config - [ ] When `memory_enabled=False`, clear messages between invocations - [ ] Write Behave unit tests verifying memory configuration behavior - [ ] Verify all nox stages pass; coverage ≥ 97% ## Definition of Done This issue is complete when: - [ ] `GraphConfig` has `memory_enabled` and `max_history` fields - [ ] `StateManager` respects `max_history` for message trimming - [ ] `memory_enabled=False` clears conversation history between invocations - [ ] Unit tests pass for memory configuration - [ ] All nox stages pass; coverage ≥ 97% - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.6.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#366 Epic: Post-MVP Deferred Work
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3667
No description provided.