fix(cua-driver): report encoder exit and shutdown timeout errors - #3714
Merged
Conversation
Refs #3713. Compare native FFmpeg process shutdown with and without the package-manager shim; preserve all attempts as diagnostics, not certification.
Refs #3713. Preserve forty independent diagnostic observations across shim/direct launch and immediate/held stdin closure. Retain errors, exit status, deadline termination, descendant cleanup and media metadata. No product changes or certification claims.
Chocolatey HTTP 504 prevented the first diagnostic from observing any recordings. Retain the setup transcript and explicitly distinguish an officially generated shim around the verified fallback from a package-installed shim. No product behavior or recording deadline change.
Refs #3713. Diagnostic-only instrumentation captures pre-stop process status, stdin write/flush results, exit status, shutdown duration, and forced termination. Preserve existing stop timing and finalization acceptance; standalone process controls did not reproduce the native preflight failure.
Refs #3713. Red: an external encoder fixture exits with code 23, but public stop_recording and get_recording_state lose that cause. Exercise the real FFmpeg backend through public tools in an isolated process; no recording internals are mocked.
Red: a nonresponsive external encoder is terminated at the unchanged deadline, but public recording responses still erase the timeout cause.
Review the completed red/green slices: consolidate isolated external-encoder fixture setup, keep public assertions explicit, and derive timeout text from the unchanged deadline. Windows now executes these integration tests; Linux already runs all targets.
injaneity
marked this pull request as ready for review
September 11, 2026 04:55
Replace correlated finalization and forced-kill flags with explicit exit and timeout outcomes. Derive the caller result once, name stdin observations, and join stderr through one shared cleanup path. Preserve failure logging before stderr collection, the existing deadline and strict recording acceptance. Existing public recording regression tests remain unchanged.
Remove the outcome enum and investigation-only process, stdin, and timing observations. Return the specific error directly from the existing wait loop, retain stderr diagnostics, and preserve the deadline and public regression tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
stop_recordinghid encoder exit failures and shutdown timeouts behind the same generic “did not finalize” error.get_recording_state.last_error. Add public-tool regression tests and execute them in Windows CI; Linux already runs them. Remove the standalone diagnostic workflow and process-comparison scripts. The existing wait loop returns success or the specific error directly, followed by shared stderr cleanup. No outcome enum, diagnostic bookkeeping, or generic process framework remains. The production method is four lines shorter than the original main-branch implementation; most of the remaining diff is durable regression coverage.This is an error-reporting fix, not a fix for the intermittent Windows recording failure in #3713.
Related work
Refs #3713
RFC: not required for this correction to existing error reporting. No new tool, response schema, permission, or recording lifecycle contract is introduced.
Compatibility and risk
Validation
ad0e78efa→796c73593) and shutdown timeout (bf2e15727→3f6f12213). Both verify error responses, disabled recording state, no successful video path, and retained failure cause. At current head5f088c831c5b7a41a8b52637fb729aeb18da9afd, 604 core unit tests and both unchanged integration tests pass locally; formatting and diff checks pass. The cleanup preserves the three-second deadline and strict acceptance, with the failure cause returned to callers and stderr retained in failure logs. Current-head platform CI is pending; the preceding head’s ordinary platform CI passed.f96f8f849bbc24cab4ecd5e92d25d64cbeab5343, before the shutdown refactor. These runs do not certify the current head. Existing preflight records real fixture activity and independently decodes the resulting video. Local fault-injection tests exercise the FFmpeg adapter, not native macOS recording.Contributor and release checks
no-releaselabel is applied.Release intent: a Cua Driver patch for user-visible error reporting; the conditional
no-releaserequirement does not apply. No external contribution is included.