AIStudio2API icon indicating copy to clipboard operation
AIStudio2API copied to clipboard

[Bug] PooledService.Embed overwrites caller-specified request.AccountID with empty recoveryAccountID on attempt 0

Open photobrand opened this issue 1 week ago • 1 comments

发生了什么 / What happened

Summary

In internal/aistudio/build_embed.go:197-209, PooledService.Embed initializes recoveryAccountID := "" and unconditionally assigns selection.AccountID = recoveryAccountID inside the loop:

	selection := AccountSelection{ModelID: modelID, Method: "embedContent"}
	...
	recoveryAccountID := ""
	for attempt := 0; attempt < maxAttempts; attempt++ {
		...
		selection.AccountID = recoveryAccountID
		recoveryAccountID = ""
		lease, _, err := resolveAccountLease(ctx, s.pool, selection)

Any caller passing an explicit EmbeddingRequest.AccountID has it silently ignored and replaced by an arbitrary pool account.

Suggested Fix

Preserve pinnedAccountID := strings.TrimSpace(request.AccountID) and pass selection.AccountID = cmp.Or(recoveryAccountID, pinnedAccountID) (and avoid falling back to other accounts when pinnedAccountID != "").

版本 / Version

v0.3.14

photobrand avatar Nov 22 '26 15:11 photobrand

每人最多同时打开 3 个 Issue,这个 Issue 已自动关闭。请等已有的 Issue 处理完再提,或把内容补充到已有的 Issue 里。

Each user can have at most 3 open issues at a time, so this one was closed automatically. Please wait until your existing issues are resolved, or add this to one of them.

github-actions[bot] avatar Nov 22 '26 15:11 github-actions[bot]