feat: Add errands table, errand agent mode, and push rollback on merge failure
- Add `errands` table to schema with status enum and relations to agents/projects - Add `errand` mode to agents.mode enum - Add push rollback in orchestrator: if push fails after merge, reset to previousRef to preserve the review diff - Extend MergeResult with previousRef for rollback support; update branch-manager and simple-git-branch-manager - Add orchestrator tests for push rollback behaviour Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -262,7 +262,7 @@ export const agents = sqliteTable('agents', {
|
|||||||
})
|
})
|
||||||
.notNull()
|
.notNull()
|
||||||
.default('idle'),
|
.default('idle'),
|
||||||
mode: text('mode', { enum: ['execute', 'discuss', 'plan', 'detail', 'refine', 'chat'] })
|
mode: text('mode', { enum: ['execute', 'discuss', 'plan', 'detail', 'refine', 'chat', 'errand'] })
|
||||||
.notNull()
|
.notNull()
|
||||||
.default('execute'),
|
.default('execute'),
|
||||||
pid: integer('pid'),
|
pid: integer('pid'),
|
||||||
@@ -629,3 +629,35 @@ export const reviewComments = sqliteTable('review_comments', {
|
|||||||
|
|
||||||
export type ReviewComment = InferSelectModel<typeof reviewComments>;
|
export type ReviewComment = InferSelectModel<typeof reviewComments>;
|
||||||
export type NewReviewComment = InferInsertModel<typeof reviewComments>;
|
export type NewReviewComment = InferInsertModel<typeof reviewComments>;
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// ERRANDS
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
export const errands = sqliteTable('errands', {
|
||||||
|
id: text('id').primaryKey(),
|
||||||
|
description: text('description').notNull(),
|
||||||
|
branch: text('branch').notNull(),
|
||||||
|
baseBranch: text('base_branch').notNull().default('main'),
|
||||||
|
agentId: text('agent_id').references(() => agents.id, { onDelete: 'set null' }),
|
||||||
|
projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }),
|
||||||
|
status: text('status', {
|
||||||
|
enum: ['active', 'pending_review', 'conflict', 'merged', 'abandoned'],
|
||||||
|
}).notNull().default('active'),
|
||||||
|
createdAt: integer('created_at', { mode: 'timestamp' }).notNull(),
|
||||||
|
updatedAt: integer('updated_at', { mode: 'timestamp' }).notNull(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const errandsRelations = relations(errands, ({ one }) => ({
|
||||||
|
agent: one(agents, {
|
||||||
|
fields: [errands.agentId],
|
||||||
|
references: [agents.id],
|
||||||
|
}),
|
||||||
|
project: one(projects, {
|
||||||
|
fields: [errands.projectId],
|
||||||
|
references: [projects.id],
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
|
||||||
|
export type Errand = InferSelectModel<typeof errands>;
|
||||||
|
export type NewErrand = InferInsertModel<typeof errands>;
|
||||||
|
|||||||
@@ -246,6 +246,13 @@
|
|||||||
"when": 1772496000000,
|
"when": 1772496000000,
|
||||||
"tag": "0034_add_task_retry_count",
|
"tag": "0034_add_task_retry_count",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 35,
|
||||||
|
"version": "6",
|
||||||
|
"when": 1772796561474,
|
||||||
|
"tag": "0035_faulty_human_fly",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user