* fix(qdrant): 复制索引改用服务端返回的游标,重复游标报错并给分页加跳数上限
CopyIndices 用"上一页最后一个点的 id"当游标(repository.go:987)。Qdrant 的
scroll offset 是**包含**语义 —— proto 里写的是 "Start with this ID",实测下一页
正是从该 id 本身开始返回,所以每翻一页都会把上一页的最后一个点再读一次、再写一份
到目标库。服务端本来就把下一页该用的游标放在 ScrollResponse.next_page_offset
("Use this offset for the next query")里,而客户端只在 ScrollAndOffset() 中返回它,
本函数调用的 Scroll() 恰好把它丢掉了;终止条件也只能退化成"这一页比 64 短"。
在真实 Qdrant 1.19.1 上实测:150 个源 chunk 复制出 152 个目标点,chunk-63 与
chunk-126 各被复制两次(每个页边界一个),totalCopied 同步虚高。源库只要超过一页
(>64 个 chunk)就会命中,不需要服务端有任何异常行为。
本次修改:
- 改用 q.client.ScrollAndOffset,游标直接取服务端返回的 next_page_offset;终止
条件改为"服务端没有下一页"(next_page_offset == nil),不再用短页推断读完。
- 记录用过的游标,重复即返回 "copy indices made no progress at cursor ...",
检测点在整页处理之前,重复的那一页不会再多写一份。
- 分页跳数上限 maxCopyPaginationHops(10000 页);触顶打印 Warn 并返回错误,
而不是把这一轮复制当成成功。
- 修复后同一份数据在真实 Qdrant 上测得 150 个目标点、0 重复。
回归用例用假 gRPC 服务端(拦截 unary RPC,对齐 repository_test.go 的
newInterceptedQdrantClient)复刻真实服务端的游标语义:150 个源 chunk 必须各复制
一次(修复前 152 个点、2 个重复);游标恒定不动的源端必须报 no progress
(修复前 5 秒写入 3127040 个点仍未返回);一直推进但永不结束的源端在第 10000 页
被拦下。
* fix(qdrant): drop the CopyIndices page cap
10000 pages of 64 points capped a copy at 640k points and failed the
whole clone beyond that. The scroll walks every point of the source
knowledge base (a single-knowledge clone included), so a cap derived from
the chunk map would cut off small clones out of large bases too.
next_page_offset only moves forward, so the repeated-cursor check already
stops a walk that cannot finish, and the task context bounds the rest.
---------
Co-authored-by: linus-liu-web <11640009+linus-liu-web@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
* fix(skills): skip vendored dep trees in install verification script enumeration
sortedScriptPaths fed every .py/.js/.sh in the bundle into one shell 'for
f in ...' command. A skill that vendors a scientific venv (pandas/scipy/
matplotlib etc.) carries thousands of .py files under .venv/, and the
generated command exceeds the exec single-argument limit (MAX_ARG_STRLEN,
128KiB): /bin/sh fails with 'argument list too long' (exit 255) before
any check runs, so no dependency-heavy skill can ever install.
Vendored trees are installed dependencies, not scripts the model can
name; their health is already covered by the dependency verification
passes. Skip .venv/ and node_modules/ prefixes in sortedScriptPaths,
which fixes the tree check, the per-language parse passes and the
runtime prerequisite pass at once.
Verified by installing a 4862-file / 105MB quant skill (pandas+numpy+
scipy+statsmodels+matplotlib venv, real interpreter binary instead of
symlinks since zips cannot carry them): install failed before the fix,
reaches ready after it.
* fix(skills): skip vendored trees at any depth, not only at the bundle root
Bundles are author-zipped, so tools/.venv/ or sub/package/node_modules/
are as legal as root-level trees and enumerated just the same. The
filter now matches vendored trees under any prefix; nested placements
are covered by a regression test.
---------
Co-authored-by: vicfei <vicfei@users.noreply.github.com>
Sweep A only selects pending/processing/finalizing, so a row that reaches a
terminal state while its attempt is still open is never revisited: its spans
stay "running" and the document timeline shows a permanent 进行中. Found in
production with four root spans stuck for 11 and 27 days.
- housekeeping: add Sweep D (reapTerminalSpans) closing spans still open on
terminal rows, carrying the row own error_message so the timeline still
names the real cause. A self-healing backstop for every failure path that
forgets to close its attempt, including rows stranded by older releases.
- span tracker: OpenAttempt now cancels spans left open by earlier attempts
(ATTEMPT_SUPERSEDED). A reparse used to open its new root alongside the
previous attempt dead root, which is what made historical runs look
like they had been reactivated.
Co-authored-by: asmh1989 <minhua.sun@velavigo.com>
processChunks marked the knowledge failed and returned nil when BatchIndex
failed, so ProcessDocument acked the task and the configured document-task
retries never ran. A short embedding or vector-store outage left the row
permanently failed; unchanged data-source syncs did not reprocess it.
While attempts remain, still clean up the partial chunks and vectors but
keep the row processing and return the error to the queue. The final
attempt (or a caller without a retry loop) records the failure as before.
newS3Client forced path-style for every non-AWS endpoint, so a COS
endpoint such as https://cos.ap-shanghai.myqcloud.com sent requests to
cos.<region>.myqcloud.com/<bucket>/<key>. COS rejects path-style for
buckets created from 2024-01-01, so STORAGE_TYPE=s3 could not reach new
COS buckets, and force_path_style=false had no way to turn it off.
Treat *.myqcloud.com like AWS and use virtual-hosted style. An explicit
force_path_style still wins, and other S3-compatible endpoints keep
path-style.
Fixes#3134
Signed-off-by: Ankit Jha <ankit.jha@tradomate.one>
* fix(frontend): 修复复制模型时模型名称被改写的问题
* fix(model): preserve model name and credentials when copying a config
Copying rewrote the upstream model name and posted redacted parameters, so the duplicate could not authenticate. Clone the stored row, cap the display name, and skip a new download when the local model is already active.
* fix(lint): clear new golangci-lint findings on model copy
Check c.Error results, wrap the long test line, and format the stub. The pull request lint range also includes the new HTTP error test, whose unused request parameter failed revive.
---------
Co-authored-by: wizardchen <wizardchen@tencent.com>
* fix(server): signal shutdown raced Fatalf exit before ResourceCleaner ran
The signal goroutine closed the listener before calling server.Shutdown,
so Serve returned the raw accept error ('use of closed network connection')
instead of ErrServerClosed. The invoke error path then hit logger.Fatalf
(os.Exit(1)) in the same millisecond, killing the process before the
shutdown goroutine reached resourceCleaner.Cleanup. Every registered
cleaner — BrowserSkill daemon, sandbox reapers, IMService, AntsPool,
Langfuse — was skipped on every SIGTERM/SIGINT, leaking the shared bsk
daemon process and its temp home on each restart.
Two changes:
- Drop the manual listener.Close(): Shutdown closes all listeners as its
first step, releasing the port just as fast without racing Serve.
- Give resourceCleaner.Cleanup its own fresh timeout context so a slow
connection drain cannot leave Cleanup with an already-expired context,
which made it skip every entry without running any.
* fix(server): keep signal cleanup inside one grace period
Desktop quit still closed the listener before Shutdown and returned
before ResourceCleaner finished, so Fatalf could skip every hook.
Share ShutdownTimeout between drain and cleanup, run BrowserSkill
first, and do not drop later hooks when the deadline expires.
* fix(server): satisfy errcheck and line-length lint
---------
Co-authored-by: vicfei <vicfei@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
Since Phase 3 the consumption side (disjoint claiming, per-slug locks,
the inflight cap) fully supports concurrent batches, but nothing created
more than one trigger per completed batch: once uploads stopped, a KB
with a standing backlog drained at 1 batch x batch-size per cycle
regardless of ingest_max_inflight, leaving the wiki pool and the model
server idle.
followUpTriggerCount now re-arms min(batches the remaining rows still
need, slots that could be free when the triggers fire). The caller's
own slot releases right after scheduleFollowUp returns, hence the +1.
activeInflightSlots is a read-mostly Lua companion to the reserve
script (purge expired, then ZCARD); -1 means unknown (no Redis / Redis
error) and collapses to a single follow-up, as do maxInflight <= 1 and
Lite mode (liteLocks serialize per KB anyway). Fan-out is deliberately
skipped on a rate-limited exit so a 429 storm is not amplified.
Over-issued triggers are harmless: the ones that cannot get a slot are
acked and coalesced by scheduleCappedRetry's fixed TaskID. The slot
count renders as "unknown" in the log when it was not consulted.
TestHostInstallActivatesVersionAndMarksReady waited for the row to reach
ready and then read the fake tree and installer. runHostInstall records
ready while it still holds the skill lock; pruning old versions, unbinding
the install session and unlocking come after, so the test could observe
tree.pruned as nil or installer.bound still populated, and the race
detector reported the unsynchronised reads.
The fake tree now counts runs between Lock and unlock, and the wait
helpers block until no run holds it. The run unlocks last, so everything
it wrote is visible once the wait returns. waitRemoveDone had the same
gap (the row is deleted before the stale marks are recorded) and uses the
same wait.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
sanitizeFAQEntryPayload called meta.Normalize() and discarded the result.
Normalize returns a normalized copy for hashing and indexing and does not
touch its receiver, so no cleaning happened: blank, whitespace-only and
duplicate similar/negative questions and answers were stored as sent, two
empty similar questions were reported as a duplicate, and answers: [" "]
passed the "at least one answer" check.
Call meta.Sanitize(), the in-place method meant for storage (trim, drop
empties, de-duplicate, keep the original text).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reverts the eleven plugin system PRs merged on 2026-09-26 so they can be
reviewed before landing:
* a829d7cc9 agent tools served by plugins (#3733)
* 4f5d475c3 Jira example plugin (#3730)
* 01222aac8 dynamic form options, OAuth connections and resource limits (#3729)
* cf502ba46 event delivery and webhooks (#3728)
* 996696057 sandboxed plugin pages (#3727)
* da4ef68d9 standalone plugin hosts (#3725)
* 728007ada remote runtime, Python SDK (#3724)
* ff49f9491 Host API and document parsers (#3721)
* 4328ab26a code plugins (#3720)
* ed63e35cc declarative plugins (#3716)
* c91a8d11f plugin system foundation (#3711)
The tree is back to 47773b5bd, migrations included: no environment ran
the plugin migrations (versioned 000115-000119, sqlite 000034-000038).
* feat(plugin): Host API with plugin tokens and a key-value store
* feat(plugin): document parsers from code plugins
* docs(pluginsdk): parsers and the Host API
* feat(pluginsdk): extension protocol v1, Go SDK and conformance suite
* feat(plugin): run code plugins in an embedded plugin host
* feat(plugin): remote adapters for web search and data sources
* fix(plugin): show plugin errors by their message
* feat(frontend): plugin connectors and web search providers in the UI
* docs(pluginsdk): how to write, package, test and install a plugin
* fix(plugin): gofmt two files and read openapi.yaml line-ending agnostic
* fix(plugin): mark a host plugin ready before Activate returns
* feat(plugin): install declarative plugin packages across nodes
* feat(plugin): serve installed plugins' MCP servers in each workspace
* feat(plugin): let installed plugins contribute skills and model vendors
* feat(plugin): register plugin skills into the workspace skill catalog
* feat(frontend): manage installed plugins and their configuration
* test(weaviate): read the class state before the probe barrier
* fix(plugin): keep MCP tool directories reachable behind the plugin wrapper
* test(plugin): wrap a long line
* feat(plugin): add plugin manifest, registry and builtin catalog
* feat(plugin): add config schemas with unified secret handling
* feat(frontend): render config schemas with SchemaForm
* feat(datasource): serve connector credential forms from the backend
* feat(im): describe IM platforms and credentials from the backend
* feat(frontend): render model vendor extra fields from the config schema
* feat(frontend): build the settings modal from an extension registry
* refactor(agent): register builtin tools and their chat views
* feat(plugin): let workspaces enable and disable plugins
* feat(plugin): add the runtime driver interface and gather builtins
* fix(knowledge): reject invalid JSON uploads before async parse
Validate .json payloads at HTTP upload/replace time with the same gate used
by the simple JSON reader, so JSONC or truncated files fail with HTTP 400
instead of after document-process retries. CreateKnowledgeFromFile itself
skips the gate so datasource sync and IM still create a knowledge row that
fails in async parse.
Signed-off-by: xiaojunxiang <xiaojunxiang@kingsoft.com>
* fix(knowledge): localize JSON upload validation messages
The upload queue shows the backend message verbatim and the rest of the
upload handler speaks Chinese. Map ValidateJSONContent's errors (now
sentinels with unchanged text, still shared with the async JSON reader)
to Chinese messages at the upload/replace boundary.
---------
Signed-off-by: xiaojunxiang <xiaojunxiang@kingsoft.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
Co-authored-by: lyingbug <xiayula2014@gmail.com>
* fix(datasource): preserve schedule state on invalid updates
* docs(datasource): document PUT /datasource/:id as a full replace
The update now always persists sync_schedule, so a partial body clears
the schedule. Show a full-object example and state that omitted fields
are reset rather than preserved.
---------
Co-authored-by: wizardchen <wizardchen@tencent.com>
* feat(wiki): add cross-KB wiki search POST /wiki-search
Give external callers a knowledge-search counterpart for wiki pages: one
SQL IN query ranked by title/slug/summary/content, slim hits with
match_snippet, and Viewer retrieve auth including shared KBs.
* fix(wiki): satisfy golangci-lint on cross-KB wiki search
Check c.Error returns, wrap lines over 120 columns, and use wikiDialect
instead of the embedded Dialector selector.
* fix(wiki): address review on cross-KB search helpers
Share KB viewer auth and snippet extraction, keep ID limits in the
service layer, and escape SQLite LIKE wildcards.
* fix(lint): wrap knowledge span fixtures over 120 columns
Go Lint still diffs from the original PR base, so later main tests
in knowledge_spans_test.go were reported as new line-length issues.
* fix(wiki): authorize KB access before checking wiki enablement in cross-KB search
Checking IsWikiEnabled before AuthorizeKBAccess let a caller tell apart a
foreign KB with wiki disabled (400) from one it cannot see (404), leaking
the KB's existence and settings. Run the access check first.
---------
Co-authored-by: root <root@localhost.localdomain>
Co-authored-by: wizardchen <wizardchen@tencent.com>
Co-authored-by: lyingbug <xiayula2014@gmail.com>
The indexer saves embeddings in batches of 40, up to five at a time,
and every BatchSave calls ensureCollection first. On the first write at
a new dimension each of them can find the class missing and try to
create it. Weaviate lets one create win and refuses the rest with 422:
"class name X already exists" when the loser is filtered before the
Raft apply, or "updating schema: TYPE_ADD_CLASS: class already exists"
when it loses inside the apply. ensureCollection returned either as
"failed to create collection", and the errgroup then failed the whole
document although the class was fine. A replica racing this one takes
the same path.
After a 422, look the class up again and carry on if it exists now,
which does not depend on how the refusal is worded. The class is
created with all of its properties in one call, so there is nothing
left to set up. Other failures are returned as before.
This is the Weaviate side of the race #2855 reports for Qdrant.
A stream body that ran out without a finish reason (a proxy cutting the
connection) was closed as a clean stop on the Completions, Responses and
Gemini paths, so a half-written answer was stored as complete. It is now
marked incomplete, as the Anthropic path already did, and both the chat
pipeline and the agent treat an incomplete answer as a stream error.
Retry classification checks typed HTTP/transport errors first and matches
status codes as whole numbers, so "max_tokens 5000" no longer reads as a
500. The retry backoff returns as soon as the turn is cancelled.
Reparse:
- Open the new attempt only after override validation and cleanup pass.
A rejected reparse used to leave the previous run's subtasks treating
themselves as superseded, so the row stayed in finalizing for good.
- Cancel the previous run's queued tasks when it is still in flight.
ProcessDocument, processChunks, post-process, image tasks, wiki ops and
the dead-letter callback now skip work that belongs to a superseded
attempt.
- Summary tasks write only their own columns. A full-row save after the
LLM call could put finalizing over the new run's processing row.
Errors that were acked with the row still in flight:
- A failed post-process enqueue is retried in place and then returned,
so the task retries instead of leaving the row in processing.
- Transient tenant/knowledge reads and the processing write now retry.
- An image whose orphan check fails on its final attempt is still
counted. Empty manual content fails the row.
Counters:
- FinalizeSubtask runs its decrement and promote in one transaction.
Slot releases retry, and the post-process shortfall release keeps
going past a failed release.
Wiki:
- A synthesis model that cannot be built releases the KB's pending
documents on the final attempt instead of retrying forever.
- Panics in map/reduce workers become per-document failures.
- Housekeeping protects a row held by a wiki op for at most 48h.
Lite mode:
- SyncTaskExecutor honours options set on asynq.NewTask (MaxRetry,
Timeout, Deadline, ProcessIn/At), stops on SkipRetry, and runs the
same final-failure callback as the dead-letter middleware.
- The multimodal fan-in counter is kept in process, so post-process
waits for every image.
Also:
- Housekeeping recovers summaries left pending on finished rows. Cancel
and stall recovery close unfinished summaries.
- Housekeeping sweeps no longer overlap.
- Data source URL ingest writes only the metadata column.
- The document list drops cards the batch endpoint no longer returns.