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.
87 lines
3.3 KiB
JSON
87 lines
3.3 KiB
JSON
{
|
|
"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','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": [
|
|
{
|
|
"name": "id!: Uuid",
|
|
"ordinal": 0,
|
|
"type_info": "Blob"
|
|
},
|
|
{
|
|
"name": "project_id!: Uuid",
|
|
"ordinal": 1,
|
|
"type_info": "Blob"
|
|
},
|
|
{
|
|
"name": "title",
|
|
"ordinal": 2,
|
|
"type_info": "Text"
|
|
},
|
|
{
|
|
"name": "description",
|
|
"ordinal": 3,
|
|
"type_info": "Text"
|
|
},
|
|
{
|
|
"name": "status!: TaskStatus",
|
|
"ordinal": 4,
|
|
"type_info": "Text"
|
|
},
|
|
{
|
|
"name": "parent_task_attempt: Uuid",
|
|
"ordinal": 5,
|
|
"type_info": "Blob"
|
|
},
|
|
{
|
|
"name": "created_at!: DateTime<Utc>",
|
|
"ordinal": 6,
|
|
"type_info": "Text"
|
|
},
|
|
{
|
|
"name": "updated_at!: DateTime<Utc>",
|
|
"ordinal": 7,
|
|
"type_info": "Text"
|
|
},
|
|
{
|
|
"name": "has_in_progress_attempt!: i64",
|
|
"ordinal": 8,
|
|
"type_info": "Integer"
|
|
},
|
|
{
|
|
"name": "has_merged_attempt!: i64",
|
|
"ordinal": 9,
|
|
"type_info": "Integer"
|
|
},
|
|
{
|
|
"name": "last_attempt_failed!: i64",
|
|
"ordinal": 10,
|
|
"type_info": "Integer"
|
|
},
|
|
{
|
|
"name": "latest_attempt_executor",
|
|
"ordinal": 11,
|
|
"type_info": "Text"
|
|
}
|
|
],
|
|
"parameters": {
|
|
"Right": 1
|
|
},
|
|
"nullable": [
|
|
true,
|
|
false,
|
|
false,
|
|
true,
|
|
false,
|
|
true,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
true
|
|
]
|
|
},
|
|
"hash": "315cf28396b52c1215a53c72c57e0277d6143d8fd658f141a86d6fd0770fb539"
|
|
}
|