fix(wechat): scrub image_url from sessions and harden vision handoff.
Memind CI / Test, build, and release guards (pull_request) Failing after 19s

Strip image_url from persisted session payloads, keep image turns scoped to the active request, and align proxy/vision/page-data paths so WeChat image history does not leak into fresh sessions.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-29 14:04:15 +08:00
parent 2f51041822
commit 53c5f6d9c2
9 changed files with 222 additions and 7 deletions
+52
View File
@@ -1534,6 +1534,58 @@ test('submitSessionReplyForUser fails closed when historical image scrub is unsu
});
});
test('submitSessionReplyForUser rotates when assistant history still has image_url', async () => {
await withFakeGoosedSession(async ({ apiTarget, workingDir, replyBodies }) => {
const proxy = createTkmindProxy({
apiTarget,
apiSecret: 'test-secret',
userAuth: {
...createMemoryTestUserAuth(workingDir),
async ownsSession() {
return true;
},
async canUseChat() {
return { ok: true };
},
async getUserById() {
return { id: 'user-1' };
},
async resolveUserPolicies() {
return { unrestricted: true, policies: {} };
},
},
});
await assert.rejects(
proxy.submitSessionReplyForUser(
'user-1',
'session-1',
'request-after-assistant-image',
{
id: 'message-current',
role: 'user',
content: [{ type: 'text', text: '这张图是什么' }],
metadata: { imageUrls: ['https://example.com/new.png'] },
},
{ requireHistoricalImageIsolation: true },
),
/historical_image_session_update_unsupported:image_url_content_present/,
);
assert.equal(replyBodies.length, 0);
}, {
conversation: [
{
id: 'assistant-old-image',
role: 'assistant',
content: [
{ type: 'text', text: '我看到了图片' },
{ type: 'image_url', image_url: { url: 'https://example.com/old.png' } },
],
},
],
});
});
test('visual fallback session removes read_image while preserving the text task path', async () => {
await withFakeGoosedSession(async ({
apiTarget,