feat: vk/xxxx-xxxx-xxxx branch naming convention (#535)

* use vk/xxxx-xxxx... branch name format

* add refetch interval for taskAttempts query
This commit is contained in:
Gabriel Gordon-Hall
2025-09-05 11:33:09 +01:00
committed by GitHub
parent 97c3226ac0
commit 15eae338fa
2 changed files with 13 additions and 4 deletions

View File

@@ -465,6 +465,11 @@ impl LocalContainerService {
format!("vk-{}-{}", short_uuid(attempt_id), task_title_id) format!("vk-{}-{}", short_uuid(attempt_id), task_title_id)
} }
pub fn git_branch_from_task_attempt(attempt_id: &Uuid, task_title: &str) -> String {
let task_title_id = git_branch_id(task_title);
format!("vk/{}-{}", short_uuid(attempt_id), task_title_id)
}
async fn track_child_msgs_in_store(&self, id: Uuid, child: &mut AsyncGroupChild) { async fn track_child_msgs_in_store(&self, id: Uuid, child: &mut AsyncGroupChild) {
let store = Arc::new(MsgStore::new()); let store = Arc::new(MsgStore::new());
@@ -720,9 +725,12 @@ impl ContainerService for LocalContainerService {
.await? .await?
.ok_or(sqlx::Error::RowNotFound)?; .ok_or(sqlx::Error::RowNotFound)?;
let task_branch_name = let worktree_dir_name =
LocalContainerService::dir_name_from_task_attempt(&task_attempt.id, &task.title); LocalContainerService::dir_name_from_task_attempt(&task_attempt.id, &task.title);
let worktree_path = WorktreeManager::get_worktree_base_dir().join(&task_branch_name); let worktree_path = WorktreeManager::get_worktree_base_dir().join(&worktree_dir_name);
let git_branch_name =
LocalContainerService::git_branch_from_task_attempt(&task_attempt.id, &task.title);
let project = task let project = task
.parent_project(&self.db.pool) .parent_project(&self.db.pool)
@@ -731,7 +739,7 @@ impl ContainerService for LocalContainerService {
WorktreeManager::create_worktree( WorktreeManager::create_worktree(
&project.git_repo_path, &project.git_repo_path,
&task_branch_name, &git_branch_name,
&worktree_path, &worktree_path,
&task_attempt.base_branch, &task_attempt.base_branch,
true, // create new branch true, // create new branch
@@ -766,7 +774,7 @@ impl ContainerService for LocalContainerService {
) )
.await?; .await?;
TaskAttempt::update_branch(&self.db.pool, task_attempt.id, &task_branch_name).await?; TaskAttempt::update_branch(&self.db.pool, task_attempt.id, &git_branch_name).await?;
Ok(worktree_path.to_string_lossy().to_string()) Ok(worktree_path.to_string_lossy().to_string())
} }

View File

@@ -68,6 +68,7 @@ export function ProjectTasks() {
queryKey: ['taskAttempts', selectedTask?.id], queryKey: ['taskAttempts', selectedTask?.id],
queryFn: () => attemptsApi.getAll(selectedTask!.id), queryFn: () => attemptsApi.getAll(selectedTask!.id),
enabled: !!selectedTask?.id, enabled: !!selectedTask?.id,
refetchInterval: 5000,
}); });
// Selected attempt logic // Selected attempt logic