Skip to content

Fix clearTimeout leaks, transcript_segments shape mismatch, and ENABLE_VERTEX_AI boolean parsing#35

Merged
groupthinking merged 4 commits intomainfrom
copilot/sub-pr-33-again
Feb 27, 2026
Merged

Fix clearTimeout leaks, transcript_segments shape mismatch, and ENABLE_VERTEX_AI boolean parsing#35
groupthinking merged 4 commits intomainfrom
copilot/sub-pr-33-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

Four bugs from PR #33 review: dangling timers on fetch abort, wrong property path for segment count, and Vertex AI importing when ENABLE_VERTEX_AI=0.

Changes

  • video/route.ts & transcribe/route.tsclearTimeout in finally
    clearTimeout was placed after await fetch(...), so it never ran on abort or network error, leaving timers pending. Moved into finally blocks on both the 15s backend timeout and the 8s YouTube transcript timeout.

    // Before
    const response = await fetch(..., { signal: controller.signal });
    clearTimeout(timeout);
    
    // After
    try {
      response = await fetch(..., { signal: controller.signal });
    } finally {
      clearTimeout(timeout);
    }
  • video/route.tstranscript_segments shape
    Was reading result.transcript?.length, but the backend returns transcript as { text, source, segments }. Fixed to result.transcript?.segments?.length.

  • gemini_service.pyENABLE_VERTEX_AI boolean gate
    Raw os.getenv("ENABLE_VERTEX_AI") is truthy for any non-empty string including "0", defeating the intent. Now parsed strictly:

    os.getenv("ENABLE_VERTEX_AI", "").lower() in {"1", "true", "yes"}
  • video/route.ts — duplicate let transcript declaration removed (would cause a compile error).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Contributor

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
v0-uvai Error Error Feb 27, 2026 11:10pm

@railway-app
Copy link

railway-app bot commented Feb 27, 2026

🚅 Deployed to the EventRelay-pr-35 environment in EventRelay

Service Status Web Updated (UTC)
guides ✅ Success (View Logs) Web Feb 27, 2026 at 11:02 pm
web ✅ Success (View Logs) Web Feb 27, 2026 at 11:02 pm
EventRelay ✅ Success (View Logs) Web Feb 27, 2026 at 11:01 pm
eslint-config ✅ Success (View Logs) Web Feb 27, 2026 at 11:01 pm
supabase ✅ Success (View Logs) Feb 27, 2026 at 11:01 pm

…E_VERTEX_AI boolean parsing

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
@railway-app railway-app bot temporarily deployed to EventRelay / EventRelay-pr-35 February 27, 2026 22:39 Destroyed
Copilot AI changed the title [WIP] Add frontend-only video analysis pipeline with multi-strategy transcription Fix clearTimeout leaks, transcript_segments shape mismatch, and ENABLE_VERTEX_AI boolean parsing Feb 27, 2026
Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

Multiple TypeScript compilation errors in embedding.ts: missing module import, unknown type errors, and implicit any parameters

Fix on Vercel

@railway-app railway-app bot temporarily deployed to EventRelay / EventRelay-pr-35 February 27, 2026 22:58 Destroyed
@groupthinking groupthinking marked this pull request as ready for review February 27, 2026 22:59
@groupthinking groupthinking self-requested a review as a code owner February 27, 2026 22:59
Copilot AI review requested due to automatic review settings February 27, 2026 22:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes request-timeout cleanup in the Next.js API routes to prevent dangling timers when fetch() aborts/errors, and aligns the /api/video response’s transcript_segments count with the backend’s transcript shape.

Changes:

  • Move clearTimeout(...) into finally blocks so timers are always cleared (even on abort/network error) in both /api/video (15s) and /api/transcribe (8s) backend calls.
  • Update /api/video to compute transcript_segments from result.transcript.segments.length (while still tolerating the legacy “array transcript” shape).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
apps/web/src/app/api/video/route.ts Ensures backend timeout is always cleared; fixes transcript_segments counting against { text, source, segments }.
apps/web/src/app/api/transcribe/route.ts Ensures YouTube-backend timeout is always cleared to avoid dangling timers on abort/errors.

Base automatically changed from claude/slack-check-status-update-R47Ph to main February 27, 2026 23:05
@railway-app railway-app bot temporarily deployed to EventRelay / EventRelay-pr-35 February 27, 2026 23:09 Destroyed
@groupthinking groupthinking merged commit 4a32a44 into main Feb 27, 2026
11 of 13 checks passed
@groupthinking groupthinking deleted the copilot/sub-pr-33-again branch February 27, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants