diff options
| author | soryu <soryu@soryu.co> | 2026-01-21 16:10:08 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-01-21 16:10:08 +0000 |
| commit | 242626b9d2532f716d6b1543f55aa6b16173d1b8 (patch) | |
| tree | ce2182513b5f4df15991520ef0ef06e52f7d529c | |
| parent | 3b3734e9c8cd889e6f7369d284ec530413821919 (diff) | |
| download | soryu-242626b9d2532f716d6b1543f55aa6b16173d1b8.tar.gz soryu-242626b9d2532f716d6b1543f55aa6b16173d1b8.zip | |
Update create_task_for_owner for task branching
- Handle optional contract_id (None for anonymous/branched tasks)
- Add branched_from_task_id to INSERT statement
- Add conversation_state (conversation_history) to INSERT statement
- Update comment to clarify contract_id inheritance behavior
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| -rw-r--r-- | makima/src/db/repository.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/makima/src/db/repository.rs b/makima/src/db/repository.rs index 536bc9b..95b4d70 100644 --- a/makima/src/db/repository.rs +++ b/makima/src/db/repository.rs @@ -1041,8 +1041,8 @@ pub async fn create_task_for_owner( ))); } - // 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); @@ -1056,7 +1056,7 @@ pub async fn create_task_for_owner( (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, @@ -1076,9 +1076,10 @@ pub async fn create_task_for_owner( INSERT INTO tasks ( owner_id, 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, $17) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19) RETURNING * "#, ) @@ -1099,6 +1100,8 @@ pub async fn create_task_for_owner( .bind(&completion_action) .bind(&req.continue_from_task_id) .bind(©_files_json) + .bind(&req.branched_from_task_id) + .bind(&req.conversation_history) .fetch_one(pool) .await } |
