summaryrefslogtreecommitdiff
path: root/makima/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/db')
-rw-r--r--makima/src/db/repository.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/makima/src/db/repository.rs b/makima/src/db/repository.rs
index 95b4d70..33e48a4 100644
--- a/makima/src/db/repository.rs
+++ b/makima/src/db/repository.rs
@@ -654,8 +654,8 @@ pub async fn create_task(pool: &PgPool, req: CreateTaskRequest) -> Result<Task,
let new_depth = parent.depth + 1;
- // Subtasks inherit contract_id from parent
- let contract_id = parent.contract_id.unwrap_or(req.contract_id);
+ // Subtasks inherit contract_id from parent (or use request contract_id if parent has none)
+ let contract_id = parent.contract_id.or(req.contract_id);
// Inherit repo settings if not provided
let repo_url = req.repository_url.clone().or(parent.repository_url);
@@ -669,7 +669,7 @@ pub async fn create_task(pool: &PgPool, req: CreateTaskRequest) -> Result<Task,
(new_depth, contract_id, repo_url, base_branch, target_branch, merge_mode, target_repo_path, completion_action)
} else {
- // Top-level task: depth 0, use contract_id from request
+ // Top-level task: depth 0, use contract_id from request (may be None for branched tasks)
(
0,
req.contract_id,
@@ -689,9 +689,10 @@ pub async fn create_task(pool: &PgPool, req: CreateTaskRequest) -> Result<Task,
INSERT INTO tasks (
contract_id, parent_task_id, depth, name, description, plan, priority,
is_supervisor, repository_url, base_branch, target_branch, merge_mode,
- target_repo_path, completion_action, continue_from_task_id, copy_files
+ target_repo_path, completion_action, continue_from_task_id, copy_files,
+ branched_from_task_id, conversation_state
)
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18)
RETURNING *
"#,
)
@@ -711,6 +712,8 @@ pub async fn create_task(pool: &PgPool, req: CreateTaskRequest) -> Result<Task,
.bind(&completion_action)
.bind(&req.continue_from_task_id)
.bind(&copy_files_json)
+ .bind(&req.branched_from_task_id)
+ .bind(&req.conversation_history)
.fetch_one(pool)
.await
}