## Summary (#299)
I've successfully updated the `has_in_progress_attempt` logic to account for cleanup scripts. Here's what was changed: **Problem**: The `has_in_progress_attempt` field in the [`tasks endpoint`](file:///private/var/folders/kr/jdxkcn7129j376nrg0stj9zm0000gn/T/vibe-kanban/vk-2d91-tasks-endp/backend/src/models/task.rs#L100) wasn't considering running cleanup scripts when determining if a task has an in-progress attempt. **Solution**: Updated the SQL query in [`backend/src/models/task.rs`](file:///private/var/folders/kr/jdxkcn7129j376nrg0stj9zm0000gn/T/vibe-kanban/vk-2d91-tasks-endp/backend/src/models/task.rs#L100) to include `'cleanupscript'` in the process types checked: - Line 100: Added `'cleanupscript'` to the `has_in_progress_attempt` logic - Line 118: Added `'cleanupscript'` to the `last_attempt_failed` logic for consistency The changes ensure that when cleanup scripts are running, the task correctly reports `has_in_progress_attempt: true`. All tests pass and the backend builds successfully.
This commit is contained in:
committed by
GitHub
parent
220b9c4944
commit
c010128f04
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "SELECT\n t.id AS \"id!: Uuid\",\n t.project_id AS \"project_id!: Uuid\",\n t.title,\n t.description,\n t.status AS \"status!: TaskStatus\",\n t.parent_task_attempt AS \"parent_task_attempt: Uuid\",\n t.created_at AS \"created_at!: DateTime<Utc>\",\n t.updated_at AS \"updated_at!: DateTime<Utc>\",\n\n CASE WHEN EXISTS (\n SELECT 1\n FROM task_attempts ta\n JOIN execution_processes ep\n ON ep.task_attempt_id = ta.id\n WHERE ta.task_id = t.id\n AND ep.status = 'running'\n AND ep.process_type IN ('setupscript','codingagent')\n LIMIT 1\n ) THEN 1 ELSE 0 END AS \"has_in_progress_attempt!: i64\",\n\n CASE WHEN EXISTS (\n SELECT 1\n FROM task_attempts ta\n WHERE ta.task_id = t.id\n AND ta.merge_commit IS NOT NULL\n LIMIT 1\n ) THEN 1 ELSE 0 END AS \"has_merged_attempt!: i64\",\n\n CASE WHEN (\n SELECT ep.status\n FROM task_attempts ta\n JOIN execution_processes ep\n ON ep.task_attempt_id = ta.id\n WHERE ta.task_id = t.id\n AND ep.process_type IN ('setupscript','codingagent')\n ORDER BY ep.created_at DESC\n LIMIT 1\n ) IN ('failed','killed') THEN 1 ELSE 0 END\n AS \"last_attempt_failed!: i64\",\n\n ( SELECT ta.executor\n FROM task_attempts ta\n WHERE ta.task_id = t.id\n ORDER BY ta.created_at DESC\n LIMIT 1\n ) AS \"latest_attempt_executor\"\n\nFROM tasks t\nWHERE t.project_id = $1\nORDER BY t.created_at DESC",
|
||||
"query": "SELECT\n t.id AS \"id!: Uuid\",\n t.project_id AS \"project_id!: Uuid\",\n t.title,\n t.description,\n t.status AS \"status!: TaskStatus\",\n t.parent_task_attempt AS \"parent_task_attempt: Uuid\",\n t.created_at AS \"created_at!: DateTime<Utc>\",\n t.updated_at AS \"updated_at!: DateTime<Utc>\",\n\n CASE WHEN EXISTS (\n SELECT 1\n FROM task_attempts ta\n JOIN execution_processes ep\n ON ep.task_attempt_id = ta.id\n WHERE ta.task_id = t.id\n AND ep.status = 'running'\n AND ep.process_type IN ('setupscript','cleanupscript','codingagent')\n LIMIT 1\n ) THEN 1 ELSE 0 END AS \"has_in_progress_attempt!: i64\",\n\n CASE WHEN EXISTS (\n SELECT 1\n FROM task_attempts ta\n WHERE ta.task_id = t.id\n AND ta.merge_commit IS NOT NULL\n LIMIT 1\n ) THEN 1 ELSE 0 END AS \"has_merged_attempt!: i64\",\n\n CASE WHEN (\n SELECT ep.status\n FROM task_attempts ta\n JOIN execution_processes ep\n ON ep.task_attempt_id = ta.id\n WHERE ta.task_id = t.id\n AND ep.process_type IN ('setupscript','cleanupscript','codingagent')\n ORDER BY ep.created_at DESC\n LIMIT 1\n ) IN ('failed','killed') THEN 1 ELSE 0 END\n AS \"last_attempt_failed!: i64\",\n\n ( SELECT ta.executor\n FROM task_attempts ta\n WHERE ta.task_id = t.id\n ORDER BY ta.created_at DESC\n LIMIT 1\n ) AS \"latest_attempt_executor\"\n\nFROM tasks t\nWHERE t.project_id = $1\nORDER BY t.created_at DESC",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
@@ -82,5 +82,5 @@
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "6333d1cf94f67854143c413f183ae2d5543729dce49f63208ca6681420531ce2"
|
||||
"hash": "315cf28396b52c1215a53c72c57e0277d6143d8fd658f141a86d6fd0770fb539"
|
||||
}
|
||||
@@ -97,7 +97,7 @@ impl Task {
|
||||
ON ep.task_attempt_id = ta.id
|
||||
WHERE ta.task_id = t.id
|
||||
AND ep.status = 'running'
|
||||
AND ep.process_type IN ('setupscript','codingagent')
|
||||
AND ep.process_type IN ('setupscript','cleanupscript','codingagent')
|
||||
LIMIT 1
|
||||
) THEN 1 ELSE 0 END AS "has_in_progress_attempt!: i64",
|
||||
|
||||
@@ -115,7 +115,7 @@ impl Task {
|
||||
JOIN execution_processes ep
|
||||
ON ep.task_attempt_id = ta.id
|
||||
WHERE ta.task_id = t.id
|
||||
AND ep.process_type IN ('setupscript','codingagent')
|
||||
AND ep.process_type IN ('setupscript','cleanupscript','codingagent')
|
||||
ORDER BY ep.created_at DESC
|
||||
LIMIT 1
|
||||
) IN ('failed','killed') THEN 1 ELSE 0 END
|
||||
|
||||
Reference in New Issue
Block a user