UAT: decision_dependencies table never written to — influence DAG not persisted to database #4701

Open
opened 2026-04-08 18:03:00 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area: Decision tree and correction model — decision dependency persistence
Severity: Medium — influence DAG (used for correction impact analysis) is lost on process restart; agents plan correct affected subtree computation is broken after restart
Source: src/cleveragents/application/services/decision_service.py, src/cleveragents/infrastructure/database/repositories.py


What Was Tested

Code-level analysis of DecisionService._record_dependencies() and DecisionRepository to verify that decision influence edges are persisted to the decision_dependencies table.

Expected Behavior (from spec §Decision Tree Storage Schema, lines 18882–18891)

The spec defines a decision_dependencies table for the influence DAG:

CREATE TABLE decision_dependencies (
    upstream_decision_id TEXT NOT NULL,
    downstream_decision_id TEXT NOT NULL,
    dependency_type TEXT NOT NULL,  -- 'decision', 'plan', 'artifact'
    downstream_ref TEXT NOT NULL,
    PRIMARY KEY (upstream_decision_id, downstream_decision_id, downstream_ref),
    FOREIGN KEY (upstream_decision_id) REFERENCES decisions(decision_id)
);

The influence DAG is used by CorrectionService._compute_affected_subtree() to determine which decisions are transitively affected by a correction. This requires the edges to be persisted so they survive process restarts.

Actual Behavior

DecisionService._record_dependencies() (lines 919–935) only updates the in-memory _dependencies dict:

def _record_dependencies(self, decision_id, upstream_ids):
    for upstream_id in upstream_ids:
        self._dependencies.setdefault(upstream_id, []).append(decision_id)

There is no database write. The DecisionDependencyModel class is defined in models.py (line 2918) but is never imported or used in repositories.py. The DecisionRepository has no method for persisting dependency edges.

Deviations:

  1. No persistence: decision_dependencies table is never written to
  2. DecisionDependencyModel unused: Defined in models.py but never referenced in repositories.py
  3. Influence DAG lost on restart: DecisionService.get_influence_edges() returns empty dict after process restart
  4. Correction impact analysis broken after restart: agents plan correct will compute empty affected subtrees after restart because the influence DAG is not rehydrated from DB

Code Location

  • src/cleveragents/application/services/decision_service.py lines 919–935 — _record_dependencies() (in-memory only)
  • src/cleveragents/infrastructure/database/models.py line 2918 — DecisionDependencyModel (defined but unused)
  • src/cleveragents/infrastructure/database/repositories.pyDecisionRepository (no dependency methods)

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Feature Area:** Decision tree and correction model — decision dependency persistence **Severity:** Medium — influence DAG (used for correction impact analysis) is lost on process restart; `agents plan correct` affected subtree computation is broken after restart **Source:** `src/cleveragents/application/services/decision_service.py`, `src/cleveragents/infrastructure/database/repositories.py` --- ## What Was Tested Code-level analysis of `DecisionService._record_dependencies()` and `DecisionRepository` to verify that decision influence edges are persisted to the `decision_dependencies` table. ## Expected Behavior (from spec §Decision Tree Storage Schema, lines 18882–18891) The spec defines a `decision_dependencies` table for the influence DAG: ```sql CREATE TABLE decision_dependencies ( upstream_decision_id TEXT NOT NULL, downstream_decision_id TEXT NOT NULL, dependency_type TEXT NOT NULL, -- 'decision', 'plan', 'artifact' downstream_ref TEXT NOT NULL, PRIMARY KEY (upstream_decision_id, downstream_decision_id, downstream_ref), FOREIGN KEY (upstream_decision_id) REFERENCES decisions(decision_id) ); ``` The influence DAG is used by `CorrectionService._compute_affected_subtree()` to determine which decisions are transitively affected by a correction. This requires the edges to be persisted so they survive process restarts. ## Actual Behavior `DecisionService._record_dependencies()` (lines 919–935) only updates the in-memory `_dependencies` dict: ```python def _record_dependencies(self, decision_id, upstream_ids): for upstream_id in upstream_ids: self._dependencies.setdefault(upstream_id, []).append(decision_id) ``` There is no database write. The `DecisionDependencyModel` class is defined in `models.py` (line 2918) but is **never imported or used** in `repositories.py`. The `DecisionRepository` has no method for persisting dependency edges. ### Deviations: 1. **No persistence**: `decision_dependencies` table is never written to 2. **`DecisionDependencyModel` unused**: Defined in `models.py` but never referenced in `repositories.py` 3. **Influence DAG lost on restart**: `DecisionService.get_influence_edges()` returns empty dict after process restart 4. **Correction impact analysis broken after restart**: `agents plan correct` will compute empty affected subtrees after restart because the influence DAG is not rehydrated from DB ## Code Location - `src/cleveragents/application/services/decision_service.py` lines 919–935 — `_record_dependencies()` (in-memory only) - `src/cleveragents/infrastructure/database/models.py` line 2918 — `DecisionDependencyModel` (defined but unused) - `src/cleveragents/infrastructure/database/repositories.py` — `DecisionRepository` (no dependency methods) --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-08 18:05:35 +00:00
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#4701
No description provided.