mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-07 09:19:39 +00:00
chore: add error logs (#815)
* chore: add error logs * chore: add error logs
This commit is contained in:
parent
8c1fbfac3c
commit
998655385b
2 changed files with 37 additions and 3 deletions
|
|
@ -68,7 +68,8 @@ export async function getInstallationNameFromReq(
|
||||||
installationId: string,
|
installationId: string,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
try {
|
try {
|
||||||
const requestJson = await req.json();
|
const reqCopy = req.clone();
|
||||||
|
const requestJson = await reqCopy.json();
|
||||||
const installationName = requestJson?.input?.targetRepository?.owner;
|
const installationName = requestJson?.input?.targetRepository?.owner;
|
||||||
if (installationName) {
|
if (installationName) {
|
||||||
return installationName;
|
return installationName;
|
||||||
|
|
@ -79,7 +80,8 @@ export async function getInstallationNameFromReq(
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await getInstallationName(installationId);
|
return await getInstallationName(installationId);
|
||||||
} catch {
|
} catch (error) {
|
||||||
|
console.error("Failed to get installation name:", error);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,8 @@ async function createNewSession(
|
||||||
*/
|
*/
|
||||||
export async function POST(request: NextRequest): Promise<NextResponse> {
|
export async function POST(request: NextRequest): Promise<NextResponse> {
|
||||||
try {
|
try {
|
||||||
const body: RestartRunRequest = await request.json();
|
const reqCopy = request.clone();
|
||||||
|
const body: RestartRunRequest = await reqCopy.json();
|
||||||
const { managerThreadId, plannerThreadId, programmerThreadId } = body;
|
const { managerThreadId, plannerThreadId, programmerThreadId } = body;
|
||||||
|
|
||||||
const langGraphClient = new Client({
|
const langGraphClient = new Client({
|
||||||
|
|
@ -142,6 +143,37 @@ export async function POST(request: NextRequest): Promise<NextResponse> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!("config" in managerThread)) {
|
||||||
|
console.error("Manager thread must have a config.");
|
||||||
|
console.dir(managerThread, { depth: null });
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
error: "Failed to restart run. Manager thread must have a config.",
|
||||||
|
},
|
||||||
|
{ status: 500 },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!("config" in plannerThread)) {
|
||||||
|
console.error("Planner thread must have a config.");
|
||||||
|
console.dir(plannerThread, { depth: null });
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
error: "Failed to restart run. Planner thread must have a config.",
|
||||||
|
},
|
||||||
|
{ status: 500 },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (programmerThread && !("config" in programmerThread)) {
|
||||||
|
console.error("Programmer thread must have a config.");
|
||||||
|
console.dir(programmerThread, { depth: null });
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
error: "Failed to restart run. Programmer thread must have a config.",
|
||||||
|
},
|
||||||
|
{ status: 500 },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const newProgrammerSession = programmerThreadState
|
const newProgrammerSession = programmerThreadState
|
||||||
? await createNewSession(langGraphClient, {
|
? await createNewSession(langGraphClient, {
|
||||||
graphId: PROGRAMMER_GRAPH_ID,
|
graphId: PROGRAMMER_GRAPH_ID,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue