fix: reset task status to active on new human message
When a user sends a new message while the task is in merge_ready, review_ready, or in_review status, the owner's turn was incorrectly treated as a finalize turn. This caused premature task completion (DONE → completed) even when the user wanted to continue working. Now resets status to active alongside round_trip_count, ensuring the owner gets a fresh working turn instead of a finalize turn.
This commit is contained in:
@@ -215,11 +215,17 @@ export function preparePairedExecutionContext(args: {
|
||||
const now = new Date().toISOString();
|
||||
|
||||
if (roomRoleContext.role === 'owner') {
|
||||
// New human message → new ping-pong cycle. Reset the round trip counter
|
||||
// so previous interactions don't block the auto-review trigger.
|
||||
if (latestTask.round_trip_count > 0) {
|
||||
// New human message → new ping-pong cycle. Reset round trip counter
|
||||
// AND status so the owner turn is not treated as a finalize turn.
|
||||
const needsReset =
|
||||
latestTask.round_trip_count > 0 ||
|
||||
latestTask.status === 'merge_ready' ||
|
||||
latestTask.status === 'review_ready' ||
|
||||
latestTask.status === 'in_review';
|
||||
if (needsReset) {
|
||||
updatePairedTask(latestTask.id, {
|
||||
round_trip_count: 0,
|
||||
status: 'active',
|
||||
updated_at: now,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user