Skip to content

Report failed batch renders as failures - #277

Open
toneywick wants to merge 1 commit into
nmbrthirteen:mainfrom
toneywick:claude/keen-austin-ac7589
Open

toneywick wants to merge 1 commit into
nmbrthirteen:mainfrom
toneywick:claude/keen-austin-ac7589

Conversation

@toneywick

@toneywick toneywick commented Nov 18, 2026 •

Copy link
Copy Markdown

The Python batch task succeeds as a task even when every clip fails, and both batch export handlers marked the job "done" / "Export complete!" regardless. job_status also dropped the job's result for web-server jobs, so per-clip errors and output paths never reached the caller.

  • summarizeBatchOutcome derives the job's final state from the per-clip rows: nothing rendered -> error with the first clip's error; some failed -> "N of M clips rendered. Failed: ..."
  • /api/batch-clips and /api/mcp/export use it and broadcast job-error when nothing rendered
  • job_status passes job.result through for web-server jobs

What this does

How I tested it

Checklist

  • npx tsc --noEmit and npm test pass (plus pytest tests/ if you touched the backend)
  • Docs updated if commands or behavior changed
  • No secrets, personal config, or generated output committed

Summary by CodeRabbit

  • Bug Fixes
    • Batch export jobs now report an error when every clip fails, including the first failure and per-clip error details.
    • Partially successful batches remain marked complete and report how many clips rendered and which clips failed.
    • Fully successful batches retain their existing success messages. Job-status responses now include batch results, making output paths and per-clip errors available in the response.

The Python batch task succeeds as a task even when every clip fails, and
both batch export handlers marked the job "done" / "Export complete!"
regardless. job_status also dropped the job's result for web-server
jobs, so per-clip errors and output paths never reached the caller.

- summarizeBatchOutcome derives the job's final state from the per-clip
  rows: nothing rendered -> error with the first clip's error; some
  failed -> "N of M clips rendered. Failed: ..."
- /api/batch-clips and /api/mcp/export use it and broadcast job-error
  when nothing rendered
- job_status passes job.result through for web-server jobs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Batch export jobs now report outcomes based on per-clip results. Job-status responses retain result data and provide guidance for locating output paths and clip errors.

Changes: Batch export outcomes

Layer / File(s) Summary
Summarize clip results
src/utils/clip-results.ts, src/utils/clip-results.test.ts
A new summarizer classifies missing, empty, successful, partially successful, and failed results. Unit tests cover outcome messages and error formatting.
Apply outcomes to export jobs
src/ui/web-server.ts, src/ui/web-server-batch-outcome.test.ts
Batch clip and MCP export jobs use summarized outcomes to set job status, message, error, export state, and event. Integration tests cover failure, partial success, and success for both endpoints.
Report job results
src/handlers/transcribe.handler.ts, src/handlers/transcribe.handler.test.ts
The job-status response includes result data and updated guidance for output paths and per-clip errors. A test checks that the result is preserved.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Request as Batch export request
  participant WebServer as Web server
  participant Summarizer as Outcome summarizer
  participant JobStatus as Job status
  participant ExportEvent as Export event
  Request->>WebServer: Submit batch export
  WebServer->>Summarizer: Pass batch result and success message
  Summarizer-->>WebServer: Return status, message, and error
  WebServer->>JobStatus: Update job fields
  alt Error outcome
    WebServer->>JobStatus: Set export state to review
    WebServer->>ExportEvent: Emit job-error with error and result
  else Done outcome
    WebServer->>JobStatus: Set export state to done
    WebServer->>ExportEvent: Emit job-complete
  end
Loading
Merge Risk: Minimal · up to 05adc

Batch exports now report per-clip failures instead of always reporting success. No merge-blocking issues were identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Report failed batch renders as failures" matches the main change. The PR makes batch-clip and MCP-export jobs report an error status, via summarizeBatchOutcome, when clips fail. It is speci…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Report failed batch renders as failures" matches the main change. The PR makes batch-clip and MCP-export jobs report an error status, via summarizeBatchOutcome, when clips fail. It is specific and concise, and a teammate scanning history would understand the primary change.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1ee18898-9390-4534-ad27-6f9ca3823ad0
Commits

Reviewing files that changed from the base of the PR and between c6841c5 and 05adc28.

Files selected for processing: 6

  • src/handlers/transcribe.handler.test.ts
  • src/handlers/transcribe.handler.ts
  • src/ui/web-server-batch-outcome.test.ts
  • src/ui/web-server.ts
  • src/utils/clip-results.test.ts
  • src/utils/clip-results.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@nmbrthirteen nmbrthirteen left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for this. The batch outcome logic is right, and tsc, npm test (468 passed) and lint pass locally. Two side effects need fixing before merge.

1. job_status now returns the full transcript for transcription jobs.
src/handlers/transcribe.handler.ts passes job.result through for every web-server job. The transcribe job stores the full word-level transcript in job.result (src/ui/web-server.ts, the transcribe handler). Polling a 1-hour transcription with job_status now puts the whole transcript into the agent's context. The next_step text already points agents to get_ui_state(include_transcript: true) for that.
Fix: /api/job/:id already returns type. Add it to the poll schema and leave result out when type === "transcribe". A test that polls a finished transcribe job and asserts no result would cover it.

2. An all-failed batch can render twice.
All-failed batches now finish with status: "error", so the sync polling loops in src/server.ts throw job.error. That error lands in the catch that calls studioUnreachable, which only checks the text for "fetch failed" or "ECONNREFUSED". A clip error such as "TypeError: fetch failed" from a render then reads as "studio down", and the MCP server renders the whole batch again inline.
Fix: throw job failures outside the studioUnreachable catch, or tag them so they skip that check. Please add a test with a clip error containing "fetch failed".

Smaller points, your call:

  • Sync create_clip and batch_create_clips used to return every clip's error. On an all-failed batch they now get only the first, cut to 300 chars. Including result in the thrown error, or returning it, would keep them.
  • When every clip fails, the studio shows one banner and stays in review. The per-clip errors and Retry buttons only render in done.
  • "All 1 clips failed" for a single clip. A 15-clip batch with 14 failures builds a status line of about 4 KB. Capping the listed failures would help.

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.

2 participants