From 963d28f2d07692ba9820cd6857971d584fb83380 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 26 Jan 2026 03:23:07 +0000 Subject: [PATCH 1/3] Initial plan From e9bf938ce8960b0776fbcdbda93cb861e2f7d9f2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 26 Jan 2026 03:25:58 +0000 Subject: [PATCH 2/3] Fix API Contract Validation workflow backend startup issues - Add backend logging to backend.log for debugging - Increase wait time from 15 to 30 seconds - Add process validation to check if backend is still running - Increase curl retries from 5 to 10 with 3-second delays - Add error handling to print backend logs on failure Co-authored-by: cliff-de-tech <137389025+cliff-de-tech@users.noreply.github.com> --- .github/workflows/api-contracts.yml | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/api-contracts.yml b/.github/workflows/api-contracts.yml index ce7f801..6e0d81d 100644 --- a/.github/workflows/api-contracts.yml +++ b/.github/workflows/api-contracts.yml @@ -74,13 +74,30 @@ jobs: - name: Start FastAPI backend run: | cd backend - python -m uvicorn app:app --host 0.0.0.0 --port 8000 & + # Start backend with logging + python -m uvicorn app:app --host 0.0.0.0 --port 8000 > ../backend.log 2>&1 & + BACKEND_PID=$! + echo "Backend started with PID: $BACKEND_PID" + # Wait for backend to be ready echo "Waiting for backend to start..." - sleep 15 - # Verify backend is responding - curl --retry 5 --retry-delay 2 --retry-connrefused http://localhost:8000/health || exit 1 - echo "Backend is ready!" + sleep 30 + + # Check if process is still running + if ! ps -p $BACKEND_PID > /dev/null; then + echo "❌ Backend process died! Logs:" + cat ../backend.log + exit 1 + fi + + # Verify backend is responding with more retries + echo "Checking backend health..." + curl --retry 10 --retry-delay 3 --retry-connrefused http://localhost:8000/health || { + echo "❌ Backend health check failed! Logs:" + cat ../backend.log + exit 1 + } + echo "✅ Backend is ready!" env: LINKEDIN_CLIENT_ID: test_client_id LINKEDIN_CLIENT_SECRET: test_client_secret From 89fafe4402318dddd10d50bc6d61b499e9d12319 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 26 Jan 2026 03:26:49 +0000 Subject: [PATCH 3/3] Improve backend log path handling based on code review - Define BACKEND_LOG variable to avoid duplication - Use absolute path with github.workspace for better reliability - Quote variable references for safety Co-authored-by: cliff-de-tech <137389025+cliff-de-tech@users.noreply.github.com> --- .github/workflows/api-contracts.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/api-contracts.yml b/.github/workflows/api-contracts.yml index 6e0d81d..1727f06 100644 --- a/.github/workflows/api-contracts.yml +++ b/.github/workflows/api-contracts.yml @@ -74,8 +74,10 @@ jobs: - name: Start FastAPI backend run: | cd backend + BACKEND_LOG="${{ github.workspace }}/backend.log" + # Start backend with logging - python -m uvicorn app:app --host 0.0.0.0 --port 8000 > ../backend.log 2>&1 & + python -m uvicorn app:app --host 0.0.0.0 --port 8000 > "$BACKEND_LOG" 2>&1 & BACKEND_PID=$! echo "Backend started with PID: $BACKEND_PID" @@ -86,7 +88,7 @@ jobs: # Check if process is still running if ! ps -p $BACKEND_PID > /dev/null; then echo "❌ Backend process died! Logs:" - cat ../backend.log + cat "$BACKEND_LOG" exit 1 fi @@ -94,7 +96,7 @@ jobs: echo "Checking backend health..." curl --retry 10 --retry-delay 3 --retry-connrefused http://localhost:8000/health || { echo "❌ Backend health check failed! Logs:" - cat ../backend.log + cat "$BACKEND_LOG" exit 1 } echo "✅ Backend is ready!"