fix(audiomind): handle file I/O errors in persistBase64Audio - #3
Open
motorbunty wants to merge 1 commit into
Open
fix(audiomind): handle file I/O errors in persistBase64Audio#3motorbunty wants to merge 1 commit into
motorbunty wants to merge 1 commit into
Conversation
Wrap mkdirSync/writeFileSync in try-catch so the CLI returns the original base64 result instead of crashing when the output directory is not writable or the disk is full.
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.
Problem
In
skills/videoagent-audio-studio/cli.js, thepersistBase64Audio()function callsfs.mkdirSync()andfs.writeFileSync()(lines 90-93) without any error handling. If the output directory can't be created (permissions issue) or the file can't be written (disk full, read-only filesystem), the entire CLI crashes with an unhandled exception — even though the audio data is still available in memory as base64.Solution
Wrap the two file system calls in a try-catch. On failure, log a warning to stderr and return the original result object (with base64 still intact), so downstream consumers can still use the audio data. On success, behavior is unchanged.
Testing
Verified that the happy path still works as before. The error path was tested by pointing
AUDIOMIND_OUTPUT_DIRto a read-only directory — the CLI now logs a warning and returns the base64 result instead of crashing.