Skip to content

save synced audios#4320

Open
mdmohsin7 wants to merge 3 commits intomainfrom
sync-files-save
Open

save synced audios#4320
mdmohsin7 wants to merge 3 commits intomainfrom
sync-files-save

Conversation

@mdmohsin7
Copy link
Member

Audio files that were synced through offline sync were not being saved (like how realtime audio is saved when save to cloud is on). This PR adds the ability to save the audio files of offline synced conversations

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces functionality to save audio files from offline synced conversations, making their storage consistent with real-time audio. The changes involve importing new utility functions, adding a new function upload_wav_as_audio_chunks to handle WAV file processing and uploading, and integrating this new function into the conversation processing logic for both new and updated conversations. The overall approach seems sound, and the suggested improvement regarding error handling is valid and has been retained.

Comment on lines +675 to +676
except Exception as e:
print(f"Error uploading audio chunks for conversation {conversation_id}: {e}")
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Catching a generic Exception can mask unexpected issues and make debugging harder. It's generally better to catch more specific exceptions that you anticipate, such as IOError or wave.Error for file operations, or Exception as a last resort after specific ones. Additionally, using print for error messages is not ideal for production systems; consider using a proper logging mechanism (e.g., Python's logging module) which allows for configurable log levels and destinations.

Suggested change
except Exception as e:
print(f"Error uploading audio chunks for conversation {conversation_id}: {e}")
except (IOError, wave.Error, Exception) as e:
logging.error(f"Error uploading audio chunks for conversation {conversation_id}: {e}")

@mdmohsin7 mdmohsin7 requested a review from beastoin January 21, 2026 10:23
@beastoin
Copy link
Collaborator

beastoin commented Jan 23, 2026

@mdmohsin7 Blocking issues before merge: upload_wav_as_audio_chunks rebuilds and overwrites audio_files per segment (backend/routers/sync.py:668/backend/routers/sync.py:671) while process_segment runs in parallel (backend/routers/sync.py:710/backend/routers/sync.py:749), so the last thread can snapshot incomplete chunks and clobber a fuller list; this can leave conversations missing audio. Also chunk sizing assumes 16k mono via fixed sample_rate (backend/routers/sync.py:648), so if WAV metadata differs or the last chunk is short, timestamps/durations drift—derive bytes/sec from the WAV header and pad or store actual duration so audio_files stays accurate.

Can you run backend/test.sh and share a quick demo clip after fixing?


by AI for @beastoin

@mdmohsin7
Copy link
Member Author

Done @beastoin

Already tested locally as well (convos get created alongside the audio files stored correctly and playing them back works)

@beastoin
Copy link
Collaborator

beastoin commented Feb 2, 2026

@mdmohsin7 In backend/routers/sync.py:619 and the new call sites around process_segment/sync_local_files, we now upload private-cloud chunks unconditionally, which bypasses the user’s “save to cloud”/private-cloud setting used in realtime (backend/routers/pusher.py); this is a privacy/data-integrity risk—please gate upload_wav_as_audio_chunks and the subsequent create_audio_files_from_chunks update on users_db.get_user_private_cloud_sync_enabled(uid) (or the same check you use in pusher) so offline sync only writes when enabled. Can you update that and ping me for re-review?


by AI for @beastoin

@beastoin
Copy link
Collaborator

Hey @mdmohsin7, sorry about this — we're closing this one as not planned for now. Thanks for putting in the work, appreciate it.

@beastoin beastoin closed this Feb 17, 2026
@github-actions
Copy link
Contributor

Hey @mdmohsin7 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our roadmap and vision

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community! 💜

@mdmohsin7
Copy link
Member Author

mdmohsin7 commented Feb 17, 2026

Hey @mdmohsin7, sorry about this — we're closing this one as not planned for now. Thanks for putting in the work, appreciate it.

But we need this, right now users can't have playback or download audio of conversations that were synced offline because the audio of those conversations isn't stored even if private cloud sync is enabled. Overall playback and download experience is inconsistent because of this issue

@beastoin
Copy link
Collaborator

Hey 👋 — thanks for putting this together! Before we can review, could you share a quick live demo (screenshot, screen recording, or terminal output) showing this working on your local or dev environment?

In the AI era, writing code is the easy part — what really makes a PR stand out is proof that it works end-to-end. A short video or even a screenshot goes a long way in helping reviewers feel confident about merging.

Feel free to update this PR whenever you have something to show. Thanks! 🙏

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

Comments