mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-13 13:18:56 +02:00
* fix(server): skip auto-comment when agent already posted during task In CompleteTask(), check if the agent already posted a comment on the issue since the task started. If so, skip the automatic output comment to avoid duplicates. This preserves the fallback for agents that don't post comments via CLI. Closes MUL-609 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(server): use StartedAt instead of CreatedAt for duplicate check CreatedAt is the enqueue time, not execution start. If a previous task posted a comment between enqueue and start of the next task, it would incorrectly suppress the auto-comment for the later task. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
58 lines
1.4 KiB
SQL
58 lines
1.4 KiB
SQL
-- name: ListComments :many
|
|
SELECT * FROM comment
|
|
WHERE issue_id = $1 AND workspace_id = $2
|
|
ORDER BY created_at ASC;
|
|
|
|
-- name: ListCommentsPaginated :many
|
|
SELECT * FROM comment
|
|
WHERE issue_id = $1 AND workspace_id = $2
|
|
ORDER BY created_at ASC
|
|
LIMIT $3 OFFSET $4;
|
|
|
|
-- name: ListCommentsSince :many
|
|
SELECT * FROM comment
|
|
WHERE issue_id = $1 AND workspace_id = $2 AND created_at > $3
|
|
ORDER BY created_at ASC;
|
|
|
|
-- name: ListCommentsSincePaginated :many
|
|
SELECT * FROM comment
|
|
WHERE issue_id = $1 AND workspace_id = $2 AND created_at > $3
|
|
ORDER BY created_at ASC
|
|
LIMIT $4 OFFSET $5;
|
|
|
|
-- name: CountComments :one
|
|
SELECT count(*) FROM comment
|
|
WHERE issue_id = $1 AND workspace_id = $2;
|
|
|
|
-- name: GetComment :one
|
|
SELECT * FROM comment
|
|
WHERE id = $1;
|
|
|
|
-- name: GetCommentInWorkspace :one
|
|
SELECT * FROM comment
|
|
WHERE id = $1 AND workspace_id = $2;
|
|
|
|
-- name: CreateComment :one
|
|
INSERT INTO comment (issue_id, workspace_id, author_type, author_id, content, type, parent_id)
|
|
VALUES ($1, $2, $3, $4, $5, $6, sqlc.narg(parent_id))
|
|
RETURNING *;
|
|
|
|
-- name: UpdateComment :one
|
|
UPDATE comment SET
|
|
content = $2,
|
|
updated_at = now()
|
|
WHERE id = $1
|
|
RETURNING *;
|
|
|
|
-- name: HasAgentCommentedSince :one
|
|
SELECT EXISTS (
|
|
SELECT 1 FROM comment
|
|
WHERE issue_id = @issue_id
|
|
AND author_type = 'agent'
|
|
AND author_id = @author_id
|
|
AND created_at >= @since
|
|
) AS commented;
|
|
|
|
-- name: DeleteComment :exec
|
|
DELETE FROM comment WHERE id = $1;
|