Repository navigation
fix: resolve generated media through workspace for IM delivery - #2377
henryZhouLikeStudy wants to merge 3 commits into
Conversation
|
CI workflows are currently |
|
补充一个同一轮内的重复媒体问题,已包含在 head 脱敏后的云环境证据:
根因是当前 IM 媒体去重只记录 修复方式:
验证:
这与 #1876 描述的跨 turn 历史重放去重是两个边界;本补丁解决同一轮内多个交付工具重复发送同一文件的问题。日志和回归测试均已脱敏。 |
|
已在自有云环境完成 部署前确认:
部署与验证:
生产哈希: 回滚备份已保留在自托管环境,不包含服务器地址、账号、聊天内容或凭据。 |
|
请把这个变更重新提交到 Please open this change against |
|
Superseded by #2683, which rebases this fix onto \develop\ as requested (preserves workspace guards and current-turn filtering, adds localized errors and IM attachment deduplication). This PR is now closed in favor of the new one. |
Summary
Fixes image/video ToolResults from the built-in media-generation tools when they are delivered through IM channels such as Weixin/iLink.
generate_imagereturns both a workspace-relativepathand a host-sidelocalPath. The projection previously treated the relativepathas a URL, causingInvalidUrlClientErrorand a user-visible fallback such as:This change resolves relative and host-absolute workspace paths through
BackendWorkspace, sends the bytes as base64ImageContent, preserves existing base64/file:///HTTP(S)/data URL support, and rejects unsupported URL schemes.When media cannot be read, the projection now logs the server-side diagnostic and emits a localized error instead of exposing the internal path. The locale is propagated through both normal and HITL-resumed streams.
Scope
tool_media.py: workspace path resolution and safe URL handlingstream_project.py: pass the resolved user locale to media projectionen.json/zh.json: localized media delivery failure messageCHANGELOG.mdNo changes are required in
octop-gatewayoroctop-harness.Validation
Regression tests
uv run --frozen pytest tests/unit/gateway/test_tool_media.py tests/unit/gateway/test_stream_project_tools.py tests/unit/gateway/test_message_build.py tests/unit/i18n -q151 passeduv run --frozen pytest tests/unit/gateway -q541 passed, 2 skippeduv run --frozen ruff check src testsuv run --frozen ruff format --check src tests1240 files already formatteduv run --frozen mypy src/octopSuccess: no issues found in 597 source filesThe full non-live suite completed with
4846 passed, 226 skipped. Its 12 failures are pre-existing Bash/WSL tests that cannot launchC:\Windows\System32\bash.exeon this native Windows host; none touch media projection or its dependencies. Linux/Windows CI remains authoritative.Cloud staging
The patched modules compiled against the production
octop-harness 1.0.4/octop-gateway 1.0.3environment. A deterministic staging check exercised:generate_imageenvelope with a relative workspace path and stalelocalPath;ImageContentwith no URL;无法发送媒体文件,请稍后重试。without exposing the path.Live iLink verification
The hotfix was deployed to the self-hosted production Octop instance after backing up the four changed files.
The live test constructed a real
generate_imageToolResult envelope, resolved the image from the workspace, and sent the resultingImageContentthrough the configured Weixin/iLink bot. The outbound operation returned successful delivery, theImageContenthad no URL, and noInvalidUrlClientErroror media-load failure occurred.The production health endpoint reports
ok=true,db=true, and all five agents running.Compatibility and safety
localPathis not sent to users.file://, HTTP(S), and data-URL inputs retain their previous behavior.Checklist
CHANGELOG.mdupdatedCloses #2351