Repository navigation
fix(mcp): fail startRecording when the camera cannot be opened - #1371
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Checked on a real Linux machine (Ubuntu 24.04, GNOME Wayland, built-in webcam), through Camera held by another process (
Camera free, this branch: success, take saved with its webcam file. No regression. Side note, not this PR: the MCP message carries the renderer stack trace after that first line, as every CLI runner's 🤖 Generated with Claude Code |
What was wrong
startRecordingwithcamera: true(andopenscreen record --camera) runs the hidden CLI record runner. The runner turned the camera on, which only checks permission and that a camera exists. The actualgetUserMediacomes after: when it fails (camera held by another app, e.g. the running OpenScreen app on Linux,NotReadableError),useScreenRecordershows a toast, turns the camera back off and the capture starts without it. Nothing in the hidden runner reported that, so the take was saved without webcam and the tool returned success.Not Linux-only in the code: any platform where the camera cannot be opened twice (Windows too) takes the same path. Linux is just where the running app keeps it open.
What changed
CliRecordRunner: when the request asked for the camera and the recorder turns it back off before capture starts, the run fails with "The camera could not be opened: another app is using it (OpenScreen itself, when it is running), or it was disconnected". The MCP tool returns that asThe recording did not start: ....How it was tested
src/cli/CliRecordRunner.test.tsx(fails without the fix).npx vitest --run src/cli electron/mcp src/hooks,npx tsc --noEmit,npx tsc -p tsconfig.test.json --noEmit,npm run lint: green. Full suite left to CI.Pending before merge: a real Linux check, app running + MCP take with
camera: true, before/after.Refs #1303
🤖 Generated with Claude Code
Summary by CodeRabbit