kin: auto-commit after pipeline

This commit is contained in:
Gros Frumos 2026-03-17 16:01:51 +02:00
parent 6eea439c16
commit 7027252a84
3 changed files with 12 additions and 18 deletions

View file

@ -1090,15 +1090,6 @@ def _execute_department_head_step(
role = step["role"] role = step["role"]
dept_name = role.replace("_head", "") dept_name = role.replace("_head", "")
# Create child pipeline in DB
child_pipeline = models.create_pipeline(
conn, task_id, project_id,
route_type="dept_sub",
steps=sub_pipeline,
parent_pipeline_id=parent_pipeline_id,
department=dept_name,
)
# Build initial context for workers: dept head's plan + artifacts # Build initial context for workers: dept head's plan + artifacts
dept_plan_context = json.dumps({ dept_plan_context = json.dumps({
"department_head_plan": { "department_head_plan": {
@ -1109,12 +1100,16 @@ def _execute_department_head_step(
}, ensure_ascii=False) }, ensure_ascii=False)
# Run the sub-pipeline (noninteractive=True — Opus already reviewed the plan) # Run the sub-pipeline (noninteractive=True — Opus already reviewed the plan)
# pass parent_pipeline_id and department so run_pipeline creates the child
# pipeline with correct attributes (route_type='dept_sub') — no double create
sub_result = run_pipeline( sub_result = run_pipeline(
conn, task_id, sub_pipeline, conn, task_id, sub_pipeline,
dry_run=False, dry_run=False,
allow_write=allow_write, allow_write=allow_write,
noninteractive=True, noninteractive=True,
initial_previous_output=dept_plan_context, initial_previous_output=dept_plan_context,
parent_pipeline_id=parent_pipeline_id,
department=dept_name,
) )
# Extract decisions from sub-pipeline results for handoff # Extract decisions from sub-pipeline results for handoff

View file

@ -518,10 +518,11 @@ class TestContextBuilderDuplicateAssignment:
assert "PROJ-001" in result assert "PROJ-001" in result
assert "My test task" in result assert "My test task" in result
def test_source_code_has_duplicate_task_assignment(self): def test_source_code_has_single_task_assignment(self):
"""Documents that the duplicate assignment still exists in the source. """Duplicate assignment was removed from context_builder.py.
This test will FAIL once the duplicate is removed (cleanup completed). Issue 4 fixed: task = context.get('task') now appears exactly once
inside format_prompt().
""" """
import ast import ast
import pathlib import pathlib
@ -533,14 +534,12 @@ class TestContextBuilderDuplicateAssignment:
task_assign_count = 0 task_assign_count = 0
for node in ast.walk(tree): for node in ast.walk(tree):
if isinstance(node, ast.Assign): if isinstance(node, ast.Assign):
# Check target is 'task'
targets_are_task = any( targets_are_task = any(
isinstance(t, ast.Name) and t.id == "task" isinstance(t, ast.Name) and t.id == "task"
for t in node.targets for t in node.targets
) )
if not targets_are_task: if not targets_are_task:
continue continue
# Check value is context.get('task') or context.get("task")
val = node.value val = node.value
if ( if (
isinstance(val, ast.Call) isinstance(val, ast.Call)
@ -554,8 +553,7 @@ class TestContextBuilderDuplicateAssignment:
): ):
task_assign_count += 1 task_assign_count += 1
assert task_assign_count == 2, ( assert task_assign_count == 1, (
f"Expected exactly 2 duplicate 'task = context.get(\"task\")' assignments " f"Expected exactly 1 'task = context.get(\"task\")' assignment, "
f"(documenting Issue 4), found {task_assign_count}. " f"found {task_assign_count}. Duplicate may have been re-introduced."
"If count is 1, the duplicate was removed — this test can be deleted."
) )

View file

@ -68,6 +68,7 @@ export interface Project {
tech_stack: string[] | null tech_stack: string[] | null
execution_mode: string | null execution_mode: string | null
autocommit_enabled: number | null autocommit_enabled: number | null
auto_test_enabled: number | null
obsidian_vault_path: string | null obsidian_vault_path: string | null
deploy_command: string | null deploy_command: string | null
test_command: string | null test_command: string | null