Repository navigation
improve: release captured audio cache leases directly - #139174
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 11:44 AM ET / 15:44 UTC. ClawSweeper reviewWhat this changesThe PR simplifies chat audio cache cleanup by releasing the captured entry directly and extends coverage for shared leases and eviction. Merge readiness✅ Ready for maintainer review This remains a useful optimization absent from current main and the latest release. No blocking correctness findings were identified. Priority: P3 Review scores
Verification
How this fits togetherControl UI audio players reuse fetched audio and waveform data through a bounded browser-memory cache. Each player holds a lease that prevents eviction until that player releases it. flowchart TD
A[Chat or sidebar audio] --> B[Audio player]
B --> C[Cached audio available?]
C -->|No| D[Fetch and decode audio]
D --> E[Enforce cache limits]
C -->|Yes| F[Retain cached entry]
E --> F
F --> B
B -->|Disconnect or source change| G[Release captured entry]
G -->|Last lease released| E
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -18, Tests +21. Total +3 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep insertion as the sole cache-cap and eviction owner, with constant-work, idempotent releases bound to their original entries. Do we have a high-confidence way to reproduce the issue? Not applicable as a functional bug reproduction: this is a performance refactor, and current source directly confirms the redundant scan on release. Is this the best way to solve the issue? Yes. Removing unreachable trimming at the cache owner is simpler than optimizing that scan or adding cleanup logic to individual players, while preserving admission and lease invariants. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 952105ddd981. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* origin/main: (46 commits) fix(gateway): keep chat metadata responsive across auth refresh (openclaw#139192) fix(doctor): keep Workshop relocation lint read-only (openclaw#139193) perf(ui): retain unchanged forwarded avatar publications (openclaw#139181) fix(config): guide exec policy migration repairs (openclaw#139143) test(i18n): refresh representative Watch key (openclaw#139197) fix(agents): preserve recovered scheduled-run outcomes (openclaw#139037) refactor(acp): simplify pending operation accounting (openclaw#139189) fix(plugin-sdk): harden account scope for pairing requests and challenges (openclaw#139142) perf(gateway): avoid redundant PR landing ancestry checks (openclaw#139186) perf(ui): release captured audio cache leases directly (openclaw#139174) fix(skills): validate names in library forms (openclaw#139184) fix(sessions): reduce cold catalog listing delays (openclaw#139146) perf(cron): scan preserved action output once (openclaw#139163) fix(agents): keep fresh tool results readable under context pressure (openclaw#139165) fix(compaction): heartbeat sessions ignore the active transcript byte cap (openclaw#136533) perf(agents): reuse snapshotted web search result rows (openclaw#139162) fix(onboarding): keep Tauri setup recoverable and verify model results (openclaw#139140) fix(memory): rank indexed sessions by source activity (openclaw#139112) perf(terminal): avoid rebuilding sanitized link fallbacks (openclaw#139159) perf(agents): bound retained tool result projection data (openclaw#139157) ...
What Problem This Solves
Releasing each chat audio player traversed the entire waveform Blob cache to check for overflow, even though insertion already enforced both cache limits and release could only lower its retained count.
Why This Change Was Made
The cache now releases the exact captured entry under its existing idempotence guard. Unreachable release-time trimming, a map relookup, and a redundant cache-key argument are removed. Insertion remains the sole owner of the 32-entry/48 MiB limits and only evicts entries with no active leases.
User Impact
Shared audio playback and waveform reuse behave the same with less temporary work when players disconnect or change source. Production is 18 lines smaller; the existing lease test adds 21 net lines.
Evidence
Before/after: actual Control UI audio player, synthetic 12-second WAV, playing after seeking. These images show preserved behavior; the allocation measurement above comes from the separate owner probe.