Skip to content

fix: handle decoder reader thread startup failures - #4

Merged
programmersd21 merged 3 commits into
mainfrom
audit/worker-ingest-startup
Nov 28, 2026
Merged

programmersd21 merged 3 commits into
mainfrom
audit/worker-ingest-startup

Conversation

@programmersd21

@programmersd21 programmersd21 commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

summary

  • replace panic-based decoder reader thread startup with explicit errors
  • if the audio reader cannot start, terminate and reap the decoder and join the stderr drainer
  • propagate startup failures through the worker pipeline

validation

  • reviewed the failure paths for both thread spawns
  • CI will validate formatting, clippy, tests, MSRV, and release builds

Summary by Sourcery

Replace panic-based decoder reader startup with error handling and cleanup throughout the worker pipeline.

Bug Fixes:

  • Handle decoder stderr and audio reader thread startup failures without panicking.
  • Terminate and reap decoder processes and clean up the stderr drainer when audio reader startup fails.
  • Propagate decoder ingestion startup errors through the worker pipeline.

Tests:

  • Update ingestion tests to handle the fallible startup API.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

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: a783f782-33cc-4490-8004-d6b2392a6a64
  • 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

@sourcery-ai

sourcery-ai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Uses of the API

Propagate ingest startup failures from the worker pipeline instead of continuing without a reader.

  • src/worker.rs L615

Implementation

Make decoder reader thread startup fallible and clean up decoder processes and the stderr drainer when either spawn fails.

  • src/worker.rs L471-482, L509-521

Tests

Update ingest tests to unwrap the new fallible startup result.

  • src/worker.rs L1010-1011, L1041-1042

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sourcery assessment

Approved.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/worker.rs" line_range="471" />
<code_context>
     cancel: Arc<AtomicBool>,
     children: Children,
-) -> Ingest {
+) -> Result<Ingest, String> {
     let diagnostics = thread::Builder::new()
         .name("scribe-stderr".into())
</code_context>
<issue_to_address>
**Decoder tests fail to compile**

When the test target is compiled, both test call sites call `.finish()` directly on the `Result<Ingest, String>` returned by `spawn_ingest`, so method resolution fails and the test build does not compile.

Unwrap or otherwise handle the `Result` at both test call sites before calling `.finish()`.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and if starting the stderr reader fails, the function returns an error without calling kill_all, so decoder child processes may continue running and hold resources after the job fails. Reverting restores the previous panic behavior but does not clean up children from an already-running instance; the leak is bounded and can be repaired by stopping those processes.

Blocking findings: src/worker.rs:471


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread src/worker.rs Resolved

Copy link
Copy Markdown
Owner Author

@sourcery-ai review

@programmersd21
programmersd21 merged commit a946f6e into main Nov 28, 2026
5 checks passed
@programmersd21
programmersd21 deleted the audit/worker-ingest-startup branch November 28, 2026 03:34

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

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.

1 participant