astrbot_plugin_private_comp.../tests
YokiiroBW 88f753ae8c fix: stop leaking downloaded vision temp files on every non-group path
Vision downloads http(s) image sources into private_inbound_images/<namespace>/
and _cleanup_prepared_image_sources is the only thing that deletes them. All
six cleanup calls on the private path sat inside `if group_mode:`, so only
group image recognition ever cleaned up. The forward-message path reused the
prepare helper without copying the cleanup calls at all, leaking on all four
returns. Files cap at 12 MB each and grow without bound.

The deeper problem is that cleanup was attached to individual return
statements rather than to the lifetime of the file, so even the group path
missed the exception and cancellation routes -- the vision coroutine is
wrapped in asyncio.wait_for, and a timeout raises CancelledError, which
`except Exception` does not catch.

Three defences, one per gap: the group_mode condition is gone (releasing a
temporary file is not a feature toggle); the forward path splits out an inner
function so a try/finally covers both normal and error returns; and preparing
new images first sweeps anything in that namespace older than 30 minutes,
which needs no return statement to be reached and so covers cancellation.

Chose the sweep over wrapping the 260-line function in try/finally: that would
have meant reindenting the whole body for less coverage than the sweep gives.

Companion suite 243 passed, joint E2E 146/146.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 05:36:12 +08:00
..
__init__.py feat: add safe companion data migration 2026-07-24 21:10:46 +08:00
_host_stub.py feat: complete M6.1.3-R2 through M6.1.7 bot personal archive contract 2026-07-27 01:37:40 +08:00
test_agenda_settle_cursor.py fix: settle windows from a durable cursor, align idempotency keys and clocks 2026-07-27 05:09:11 +08:00
test_agenda_system.py feat: isolate bot self storage from user memory 2026-07-25 23:22:41 +08:00
test_agenda_window_labels.py fix: clear the three P0 defects that were bleeding in production 2026-07-27 05:01:56 +08:00
test_audit_batch1.py fix: let emotion decay run during continuous conversation 2026-07-27 05:27:40 +08:00
test_b7_image_temp_files.py fix: stop leaking downloaded vision temp files on every non-group path 2026-07-27 05:36:12 +08:00
test_bot_self_store.py feat: isolate bot self storage from user memory 2026-07-25 23:22:41 +08:00
test_calendar_system.py feat: add temporal companion calendar 2026-07-25 01:35:56 +08:00
test_daily_plan_version.py fix: make the daily plan chain survive startup timing and same-day rewrites 2026-07-27 04:16:06 +08:00
test_m6_bot_personal_bridge.py feat: complete M6.1.3-R2 through M6.1.7 bot personal archive contract 2026-07-27 01:37:40 +08:00
test_m6_local_loop.py feat: complete M6.1.3-R2 through M6.1.7 bot personal archive contract 2026-07-27 01:37:40 +08:00
test_m6_r1_maintenance.py feat: complete M6.1.3-R2 through M6.1.7 bot personal archive contract 2026-07-27 01:37:40 +08:00
test_m6_r2_legacy_compat.py feat: complete M6.1.3-R2 through M6.1.7 bot personal archive contract 2026-07-27 01:37:40 +08:00
test_m6_r4_creative_media.py feat: complete M6.1.3-R2 through M6.1.7 bot personal archive contract 2026-07-27 01:37:40 +08:00
test_m6_r5_profile_injection.py feat: complete M6.1.3-R2 through M6.1.7 bot personal archive contract 2026-07-27 01:37:40 +08:00
test_m6_r6_runtime_view.py feat: complete M6.1.3-R2 through M6.1.7 bot personal archive contract 2026-07-27 01:37:40 +08:00
test_m6_r7_privacy_residue.py fix: clear the three P0 defects that were bleeding in production 2026-07-27 05:01:56 +08:00
test_p0_runtime_fixes.py fix: clear the three P0 defects that were bleeding in production 2026-07-27 05:01:56 +08:00
test_p3_key_and_clock.py fix: settle windows from a durable cursor, align idempotency keys and clocks 2026-07-27 05:09:11 +08:00
test_provider_readiness.py fix: make the daily plan chain survive startup timing and same-day rewrites 2026-07-27 04:16:06 +08:00
test_q7_backend_contracts.py feat: freeze ops backend page contracts 2026-07-26 00:05:56 +08:00
test_temporal_context.py feat: add temporal companion calendar 2026-07-25 01:35:56 +08:00