fix: add ::uuid casts to all agent_sessions queries

PostgreSQL can't implicitly coerce text params to UUID columns.
Add explicit ::uuid casts on id and project_id in all agent session
routes (list, get, patch, stop, approve).

Made-with: Cursor
This commit is contained in:
2026-03-07 11:49:40 -08:00
parent 18f61fe95c
commit f7d38317b2
4 changed files with 11 additions and 11 deletions

View File

@@ -21,7 +21,7 @@ export async function POST(
`SELECT s.status FROM agent_sessions s
JOIN fs_projects p ON p.id = s.project_id
JOIN fs_users u ON u.id = p.user_id
WHERE s.id = $1 AND s.project_id = $2 AND u.data->>'email' = $3 LIMIT 1`,
WHERE s.id = $1::uuid AND s.project_id = $2::uuid AND u.data->>'email' = $3 LIMIT 1`,
[sessionId, projectId, session.user.email]
);
@@ -45,7 +45,7 @@ export async function POST(
`UPDATE agent_sessions
SET status = 'stopped', completed_at = now(), updated_at = now(),
output = output || '[{"ts": "now", "type": "info", "text": "Stopped by user."}]'::jsonb
WHERE id = $1`,
WHERE id = $1::uuid`,
[sessionId]
);