Wave 7: Integrate JobDevTools into job detail page (FINAL)

- Task #18: Complete integration of all JobDevTools components
  - Updated job detail page (/jobs/[id]) with full JobDevTools UI
  - Connected SSE stream for real-time structured logs + metrics
  - Added crash-report and retry API routes for Next.js
  - Added format conversion for old/new log formats
  - Added DevTools links to JobsView modal and actions column
  - Wired up CrashReport retry with auto-fix parameters
  - Integrated SessionPanel for fingerprint display
  - Integrated MetricsDashboard for real-time charts

Job DevTools implementation complete: 18/18 tasks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-01-24 13:11:19 +00:00
parent f99827717f
commit cd9639f3b1
4 changed files with 699 additions and 85 deletions

View File

@@ -0,0 +1,42 @@
import { NextRequest, NextResponse } from 'next/server';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
/**
* GET /api/jobs/[jobId]/crash-report
*
* Fetches the crash report for a failed or partial job.
* Returns detailed crash analysis including pattern identification,
* confidence score, suggested fixes, and auto-fix parameters.
*/
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ jobId: string }> }
) {
try {
const { jobId } = await params;
const response = await fetch(`${API_BASE_URL}/jobs/${jobId}/crash-report`, {
headers: {
'Accept': 'application/json',
},
});
const data = await response.json();
if (!response.ok) {
return NextResponse.json(
{ error: data.detail || 'Failed to get crash report' },
{ status: response.status }
);
}
return NextResponse.json(data);
} catch (error) {
console.error('Crash report API error:', error);
return NextResponse.json(
{ error: 'Failed to get crash report' },
{ status: 500 }
);
}
}

View File

@@ -0,0 +1,53 @@
import { NextRequest, NextResponse } from 'next/server';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
/**
* POST /api/jobs/[jobId]/retry
*
* Retries a failed or partial job, optionally applying auto-fix parameters.
*
* Query params:
* - apply_fix: boolean (default: false) - Whether to apply auto-fix parameters
* based on crash analysis (e.g., reduced batch size for memory issues)
*
* Returns the new job ID for tracking the retry attempt.
*/
export async function POST(
request: NextRequest,
{ params }: { params: Promise<{ jobId: string }> }
) {
try {
const { jobId } = await params;
const searchParams = request.nextUrl.searchParams;
const applyFix = searchParams.get('apply_fix') === 'true';
const response = await fetch(
`${API_BASE_URL}/jobs/${jobId}/retry?apply_fix=${applyFix}`,
{
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
}
);
const data = await response.json();
if (!response.ok) {
return NextResponse.json(
{ error: data.detail || 'Failed to retry job' },
{ status: response.status }
);
}
return NextResponse.json(data);
} catch (error) {
console.error('Retry job API error:', error);
return NextResponse.json(
{ error: 'Failed to retry job' },
{ status: 500 }
);
}
}