sdd.md 1.38 KB

The graphlemon Work Node (planner) workflow finished. It produced an SDD design doc (status: ready for coding, not yet implemented) for fixing a real bug in src/work_node_run.py::run_work_node():

Bug: execution_log_file is inserted unconditionally on every call. If a Work Node is re-invoked for the same node_exec_id (e.g. after a crash mid-execution, or a blocked node resumed via manual_resume), the second call hits the table's UNIQUE(node_exec_id) constraint and raises sqlite3.IntegrityError, permanently blocking REQ-06's break-point resume.

Proposed fix: replace the blind INSERT with a SELECT-then-branch: reuse the existing log_file_id row (resetting its status back to 'active') if one exists for that node_exec_id, otherwise insert as before. Scope is narrowly the ~10-line block at work_node_run.py:272-280; no changes to resume_work_graph_run(), work_graph_execute.py, or the worktree-restore logic (which already follows this query-then-create pattern).

Test plan: adds ExecutionLogFileIdempotentInsertTest in src/test_work_node_run.py, which fails with the IntegrityError on current code and should pass once the fix lands, plus a run of the full existing test_work_node_run.py suite as a regression check.

This is planning output only — no code was written yet. Awaiting direction on whether to proceed to implementation (Coder step).