提交图

3 提交

作者 SHA1 备注 提交日期
424be44d5e feat(p5): attest protected prompt and bridge sinks 2026-07-30 01:12:38 +08:00
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
6eaf1b7634 chore: import companion baseline 2026-07-24 00:25:43 +08:00