Skip to content

feat(channels): retain inbound voice/audio recordings with bounded cleanup - #671

Merged
edenreich merged 1 commit into
mainfrom
feat/retain-voice-recordings
Jun 28, 2026
Merged

edenreich merged 1 commit into
mainfrom
feat/retain-voice-recordings

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

Inbound Telegram voice/audio messages were transcribed to text and the original audio deleted
immediately. This adds opt-in local retention: keep the last N original recordings under a
configurable directory, pruning the oldest once the cap is exceeded.

Default is off (retain_recordings: 0 = prior behavior), so nothing changes unless you opt in.

Changes

  • internal/services/channels/voice_retention.go (new) - VoiceRetention writes the original audio
    and prunes oldest-beyond-cap (mirrors pruneSessionImages); mutex-guarded for the concurrent
    channel worker pool.
  • internal/services/channels/telegram.go - retains the downloaded bytes before transcription
    (best-effort), so files are kept even when transcription fails or yields no text.
  • config/config.go - new retain_recordings + recordings_dir fields, defaults,
    ResolveRecordingsDir() (default ~/.infer/voice), and a Validate() guard (>= 0).
  • cmd/channels.go - builds the retainer only when speech-to-text is enabled and the cap is > 0.
  • Docs: docs/speech-to-text.md + an optional "Voice Messages" section in
    examples/telegram-channel/README.md.
  • Tests: voice_retention_test.go, config/recordings_test.go, updated telegram_test.go.

Acceptance criteria (#668)

  • Retained under a configurable directory (default ~/.infer/voice/)
  • Bounded by a configurable cap (retain_recordings; 0 = keep none)
  • Oldest pruned automatically once the cap is exceeded
  • Seeded by infer init + documented in docs/speech-to-text.md
  • Unit-tested (retention + pruning)

Verification

task fmt (clean) - task test (passes) - task lint (0 issues) -
go test -race ./internal/services/channels/... (passes).

Closes #668

…eanup

Inbound Telegram voice/audio was transcribed and then deleted immediately. Add opt-in local retention: keep the last N original recordings under a configurable directory (default ~/.infer/voice), pruning the oldest once the cap is exceeded. Default off (retain_recordings: 0 preserves prior behavior).
@edenreich
edenreich requested a review from a team as a code owner June 27, 2026 22:57
@edenreich edenreich added this to 2026 Jun 27, 2026
@edenreich edenreich moved this to Done in 2026 Jun 27, 2026
@edenreich edenreich moved this from Done to QA in 2026 Jun 27, 2026
@edenreich
edenreich merged commit 8fd29ce into main Jun 28, 2026
1 check passed
@edenreich
edenreich deleted the feat/retain-voice-recordings branch June 28, 2026 00:18
edenreich added a commit that referenced this pull request Jun 28, 2026
…673)

## Problem

`TestSessionID_Age_Recent` generates a session ID, sleeps 10ms, then
asserts `SessionID.Age()` is **between 10ms and 1s**. On loaded `-race`
CI runners more than 1s can elapse before `Age()` is read - it was
observed at **1.008s**, tripping the upper bound and failing the `test`
job (surfaced on an unrelated PR, #671).

## Fix

Widen the upper bound from `1s` to `1m`. It still catches a genuinely
wrong `Age()` (e.g. a bad epoch that would yield hours) while removing
the timing flake. The lower bound (10ms) is unchanged.

Test-only change; no production code touched.
inference-gateway-releaser Bot added a commit that referenced this pull request Jun 28, 2026
## [0.125.0](v0.124.1...v0.125.0) (2026-06-28)

### 🚀 Features

* **reminders:** configurable reminders on a shared hook-point catalog ([#675](#675)) ([179cad1](179cad1)), closes [#270](#270) [#669](#669) [#270](#270) [#525](#525) [#270](#270)
* **channels:** retain inbound voice/audio recordings with bounded cleanup ([#671](#671)) ([8fd29ce](8fd29ce))
* **hooks:** run configured shell commands at agent hook points ([#676](#676)) ([990f2c0](990f2c0)), closes [#270](#270) [#675](#675) [#675](#675) [#270](#270) [#675](#675) [#675](#675) [#669](#669) [#270](#270)

### 🐛 Bug Fixes

* **agent:** keep the internal completion check out of channel replies ([#672](#672)) ([96b166c](96b166c))
* **docs:** replace em dashes with hyphens for consistency in SKILL.md and configuration-reference.md ([1c9196d](1c9196d))

### ♻️ Code Refactoring

* dead-code cleanup, Go 1.26 modernization, width-aware truncation, race testing ([#667](#667)) ([7a97f3b](7a97f3b))
* interfaces, fix context propagation, and reduce delays ([#666](#666)) ([1a93ff8](1a93ff8))

### 📚 Documentation

* **skills:** add charm v2 skills (bubbletea, lipgloss, bubbles) ([#664](#664)) ([c7242c7](c7242c7)), closes [#657](#657) [#663](#663)
* **skills:** add Go skills adapted from spf13/go-skills ([#665](#665)) ([971ac23](971ac23))
* **skills:** add go-concurrency skill ([#663](#663)) ([c77ac33](c77ac33)), closes [#657](#657)

### ✅ Tests

* relax TestSessionID_Age_Recent upper bound to tolerate slow CI ([#673](#673)) ([9cfe203](9cfe203)), closes [#671](#671)
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.125.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jun 28, 2026
@edenreich edenreich moved this from QA to Done in 2026 Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

[FEATURE] Retain inbound voice/audio files locally with cleanup

1 participant