mirror of
https://github.com/hanzoai/dataroom.git
synced 2026-11-02 22:22:45 +00:00
hanzo-build-linux-amd64 is the only ARC runner pool installed on hanzo-k8s today (arm64 pool is paused until DigitalOcean ships arm64 droplets, per ~/work/hanzo/.github/RUNNERS.md). The arm64 job was waiting on spark-hanzoai-arm64 — not provisioned in this cluster — so every build sat in queue forever and the amd64 leg got cancelled. Set platforms: linux/amd64 on the reusable build call to skip arm64 entirely. Re-add arm64 if/when DO ships arm64 droplets and the spark runner pool comes back online.
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
|
|
import { authOptions } from "@/pages/api/auth/[...nextauth]";
|
|
import { runs } from "@trigger.dev/sdk/v3";
|
|
import { getServerSession } from "next-auth";
|
|
|
|
import prisma from "@/lib/prisma";
|
|
import { CustomUser } from "@/lib/types";
|
|
|
|
/**
|
|
* GET /api/ai/store/runs/[runId]
|
|
* Get the status of a Trigger.dev run for polling
|
|
*/
|
|
export async function GET(
|
|
req: NextRequest,
|
|
{ params }: { params: { runId: string } },
|
|
) {
|
|
try {
|
|
const session = await getServerSession(authOptions);
|
|
|
|
if (!session) {
|
|
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
}
|
|
|
|
const { runId } = params;
|
|
|
|
const run = await runs.retrieve(runId);
|
|
|
|
// Verify the user is authorized to access this run
|
|
const runTeamId = run.metadata?.teamId as string | undefined;
|
|
const userTeams = await prisma.userTeam.findMany({
|
|
where: { userId: (session.user as CustomUser).id },
|
|
select: { teamId: true },
|
|
});
|
|
const userTeamIds = userTeams.map((ut) => ut.teamId);
|
|
|
|
if (!runTeamId || !userTeamIds.includes(runTeamId)) {
|
|
return NextResponse.json({ error: "Unauthorized" }, { status: 403 });
|
|
}
|
|
|
|
return NextResponse.json({
|
|
id: run.id,
|
|
status: run.status,
|
|
metadata: run.metadata,
|
|
isCompleted: run.isCompleted,
|
|
isFailed: run.isFailed,
|
|
output: run.output,
|
|
});
|
|
} catch (error) {
|
|
console.error("Error retrieving run status:", error);
|
|
return NextResponse.json(
|
|
{ error: "Failed to retrieve run status" },
|
|
{ status: 500 },
|
|
);
|
|
}
|
|
}
|