OpenVision icon indicating copy to clipboard operation
OpenVision copied to clipboard

Resource-cleanup audit: release sensors/network/compute on every completion path

Open rayl15 opened this issue 4 months ago • 0 comments

Part of the power-management roadmap in #36 (Stage 1).

Goal

Guarantee that every request-completion path releases all held resources: camera stream, microphone, speech recognition, network sockets/WebSockets, timers, frame buffers, and model-inference tasks.

Why

OpenVision already does snapshot-first "click-and-go" (camera stops right after capture) and has performFullStop(), conversation-inactivity timeouts, and background/GPU guards. But cleanup isn't verified as a single sweep across all exit paths, so a leak on one path (e.g. an error mid-stream) could leave the camera or a socket alive and drain battery.

Paths that must all release resources

  • [ ] Successful completion
  • [ ] User cancellation / barge-in
  • [ ] Inactivity timeout
  • [ ] Error mid-request
  • [ ] App backgrounding
  • [ ] Glasses disconnection
  • [ ] Repeated network failure

Pointers

  • OpenVision/Views/VoiceAgent/VoiceAgentView.swift — performFullStop(), stopLiveVideoMode(), capture flow (~line 620)
  • OpenVision/Managers/GlassesManager.swift — startStreaming() / stopStreaming()
  • OpenVision/Services/GemmaLocal/GemmaLocalService.swift — background/generation guards (~line 744)

Good first issue — mostly an audit + adding missing teardown calls. Happy to review a PR.

rayl15 avatar Jul 15 '26 05:07 rayl15