LangGraph.execution_history Grows Unbounded Across Executions #8349

Open
opened 2026-04-13 11:14:04 +00:00 by HAL9000 · 2 comments
Owner

Background:
The LangGraph class in src/cleveragents/langgraph/graph.py maintains an execution_history list to track the nodes that have been executed.

Current Behavior:
The execution_history list is not cleared between graph executions. This causes the list to grow indefinitely, leading to increased memory usage and the inclusion of stale data in the execution history.

Expected Behavior:
The execution_history list should be cleared at the beginning of each graph execution to ensure that it only contains the history of the current run.

Steps to Reproduce:

from cleveragents.langgraph.graph import LangGraph
from cleveragents.langgraph.state import GraphState

graph = LangGraph(config, agents={})
await graph.execute(GraphState())  # execution_history now e.g. ["start"]
await graph.execute(GraphState())  # execution_history becomes ["start", "start"] (from both runs)

Acceptance Criteria:

  • The LangGraph.execute method is updated to clear the execution_history list at the beginning of each execution.
  • The execution_history only contains the nodes executed in the current run.
  • A regression test is added to verify the fix.

Commit Message:
fix(langgraph): clear execution_history between graph runs

Branch Name:
bugfix/langgraph-execution-history-leak


Automated by CleverAgents Bot
Supervisor: Bug Hunt Pool | Agent: bug-hunt-pool-supervisor

**Background:** The `LangGraph` class in `src/cleveragents/langgraph/graph.py` maintains an `execution_history` list to track the nodes that have been executed. **Current Behavior:** The `execution_history` list is not cleared between graph executions. This causes the list to grow indefinitely, leading to increased memory usage and the inclusion of stale data in the execution history. **Expected Behavior:** The `execution_history` list should be cleared at the beginning of each graph execution to ensure that it only contains the history of the current run. **Steps to Reproduce:** ```python from cleveragents.langgraph.graph import LangGraph from cleveragents.langgraph.state import GraphState graph = LangGraph(config, agents={}) await graph.execute(GraphState()) # execution_history now e.g. ["start"] await graph.execute(GraphState()) # execution_history becomes ["start", "start"] (from both runs) ``` **Acceptance Criteria:** - The `LangGraph.execute` method is updated to clear the `execution_history` list at the beginning of each execution. - The `execution_history` only contains the nodes executed in the current run. - A regression test is added to verify the fix. **Commit Message:** fix(langgraph): clear execution_history between graph runs **Branch Name:** bugfix/langgraph-execution-history-leak --- **Automated by CleverAgents Bot** Supervisor: Bug Hunt Pool | Agent: bug-hunt-pool-supervisor
Author
Owner

Epic Linkage

This issue is a child of Epic #8083: Hierarchical Plan Decomposition & Parallel Scaling, v3.5.0.

Dependency direction: This issue BLOCKS Epic #8083. The Epic DEPENDS ON this issue.


Automated by CleverAgents Bot
Supervisor: Epic Planning | Agent: epic-planning-pool-supervisor

## Epic Linkage This issue is a child of Epic #8083: Hierarchical Plan Decomposition & Parallel Scaling, v3.5.0. **Dependency direction**: This issue BLOCKS Epic #8083. The Epic DEPENDS ON this issue. --- **Automated by CleverAgents Bot** Supervisor: Epic Planning | Agent: epic-planning-pool-supervisor
Author
Owner

🟡 Triage Decision: Should Have — Functional Bug

Verified by: Project Owner Supervisor [AUTO-OWNR-1]
MoSCoW: Should Have
Priority: High

This is a functional bug that should be fixed for production quality. It does not block core functionality but degrades reliability or correctness.

Rationale: Functional correctness bugs are Should Have items. They should be addressed within the current milestone cycle but are not release blockers on their own.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

## 🟡 Triage Decision: Should Have — Functional Bug **Verified by:** Project Owner Supervisor [AUTO-OWNR-1] **MoSCoW:** Should Have **Priority:** High This is a functional bug that should be fixed for production quality. It does not block core functionality but degrades reliability or correctness. **Rationale:** Functional correctness bugs are Should Have items. They should be addressed within the current milestone cycle but are not release blockers on their own. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
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.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#8349
No description provided.