Skip to content

feat(search): add Item Search - #7815

Open
cocolord wants to merge 62 commits into
volcengine:mainfrom
cocolord:codex/item-search-protocol-v1
Open

cocolord wants to merge 62 commits into
volcengine:mainfrom
cocolord:codex/item-search-protocol-v1

Conversation

@cocolord

@cocolord cocolord commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Add opt-in Item retrieval to find/search. Return declared roots in the existing memories/resources/skills/total envelope with stable UUIDs, each root's own attributes and engine max/sum scores. New Skill packages declare Items automatically; explicit child Items retain union membership in their ancestors.

For VikingDB, OV generates a UUID when it declares a new Item and passes it with the regular directory L0 upsert. The UUID and root attributes are stored on that VikingDB record. Member writes use the existing write path, and VikingDB resolves Item membership from the member's path.

The open-source engine persists each explicit Item root's UUID and attributes in its native Catalog. It groups existing vector records by URI. Directory and file operations use the existing filesystem.

VikingDB keyword Item queries use BM25 grouping without embeddings. Attribute filters retain the original list filter tree. Filter-only Item queries enumerate scalar pages and resolve effective Item identities and own roots with zero scores and UUID ordering. Ordinary find retains filter-only retrieval. Ordinary search requires a query or image.

Item keyword requests forward the existing BM25 parameters and candidate input limit. Ordinary copy and move use the cleanup behavior on main. Resource reimports check Item declarations on directories being deleted or replaced.

The API-key backend now issues Item operations without collection_meta. Account scope selects the partition; the engine validates the actual pre-created schema. Existing optional schema hints retain their Catalog behavior. Enterprise provisioning in MR !4266 only adds the default Item schema and required field passthrough; its existing connection configuration and renderer remain unchanged.

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Validation

  • 1468b76cd passed 294 targeted repository tests and two native directory-transfer probes. An existing STG fixture returned changes in grouped scores when the BM25 parameters were tuned.
  • A disposable STG probe confirmed that deleting only the L0 record removes the stored Item UUID while collection point reads still return the L2 member. The behavior of Item identity during L0 maintenance is under review. The fresh member had yet to become visible in search during the probe.
  • cfec0f9d5 passed 366 targeted Python cases after rebuilding the native engine. Five ordinary HTTP probes matched main both with and without Item declarations. Checks covered grouped max/sum, persistence on reopen, move, and delete. One resource-delete assertion received queued and reproduced on main.
  • dcd5a9182 passed 569 Python and 509 CLI tests. Paired ordinary HTTP probes matched main with the same inputs.
  • Real VikingDB checks verified UUID persistence on L0 and stable UUIDs during resource re-import and Skill updates. Ordinary and grouped reads matched the engine on indexed fixtures. Fresh L2 records were visible by primary key, and search visibility for fresh writes is still open after a 60-second probe.
  • Earlier metadata-independent fix c5f066f: 122/122 targeted Item, Catalog, partition and API-key client regressions; lint and changed-file formatting checks passed.
  • Earlier local source without collection_meta against real STG VikingDB library ov-c19e53630cdc34c7: 18/18 keyword and filter-only cases covering max/sum, parent/child roots, empty scopes, zero scores and UUID ordering.
  • Real old unsharded library: ordinary keyword/scalar/fetch requests with partition parameters return the same results; ordinary import validation and identity resolution also pass.
  • Earlier runtime 2927dc3 had 225/225 combined regressions and the same 103/103 ordinary testcase IDs as its base. These are earlier-version evidence, separate from the final 122-case set.
  • PDF, DOCX, PNG, WAV and MP4 import/retrieval, Skill, --parent, clients, own Item attrs and ordinary find/search return format evidence are recorded by topic and tested version in the report. Batch-write is outside the current acceptance scope.
  • Earlier deployed STG evidence used kernel v0.5.6.dev202611242144 (2927dc3) and commercial Server 1.0.0.1029 (70138c4e4). The c5f066f kernel fix and schema-only bec81abaf Server change had source-level verification at that stage.

Commercial acceptance covers incremental new libraries with the new schema and matching kernel. Existing libraries retain their schema and ordinary-query compatibility. Legacy clients accessing new inheritance-sharded collections are outside this deployment combination. Engine attribute-filter AND-order failures remain separately documented.

Functional acceptance report and raw evidence records checks by import, retrieval, Skill, lifecycle, media, response format and ordinary regression, preserving earlier failures and attachments.

Comment thread src/catalog/catalog_engine.cpp Fixed
Comment thread src/catalog/catalog_engine.cpp Fixed
@cocolord cocolord changed the title feat(search): add Item Search with native Catalog grouping feat(search): add Item Search Nov 17, 2026
@cocolord
cocolord force-pushed the codex/item-search-protocol-v1 branch 3 times, most recently from 30e580e to 5c63d91 Compare November 23, 2026 02:50
Comment thread src/catalog/catalog_engine.cpp Fixed
cocolord and others added 9 commits November 23, 2026 14:24
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Reuse classified FindResult responses and aggregate score across HTTP, SDK,
MCP and CLI, with optional Item metadata and no query-time content reads.
Keep ingestion on the existing resource lifecycle while preserving Item
identity, immutable attributes, retry initialization and nested Item safety.

Complete native shadow/union grouping and scalar filter scans with consistent
snapshots, full counts and bounded member evidence.

Validation: 779 Python regression cases, 56 native engine contract cases,
19 CLI rendering cases, 15 Skill unit cases and 11 additional CLI cases passed.
Additional CLI cases used the repository CI RUST_MIN_STACK setting.
Track member mutations for the affected accounts and retain collection-wide validation for index replacement. Cover concurrent writes and same-account moves during recall.
Use the account partition for VikingDB search and classify Item results by declaration root URI. Preserve Catalog identities across imports and merged moves, and keep Native recall and aggregation independent of the returned Item limit.
Run member counting, vector recall, candidate projection and Item grouping inside one native CPU query. Preserve per-account snapshot validation, index replacement checks and candidate budgets.

The 174 targeted regressions passed. On the frozen synthetic 100k-member workload, p95 fell from 1553 ms to 1012 ms and peak RSS from 2684 MiB to 1457 MiB.
@cocolord
cocolord force-pushed the codex/item-search-protocol-v1 branch from b1d0ebb to 8017f13 Compare November 23, 2026 06:24
cocolord and others added 11 commits November 23, 2026 21:25
…ory merge

Moving an ordinary directory into an existing Item replaced the target's
declaration with the source's plain node, deleting its item_uuid and
item_attrs while leaving the member files in place. A later mkdir(as_item)
then failed with FailedPrecondition because the root was already an
ordinary directory.

Keep the existing target declaration when the source carries no item_uuids
but the destination does; a declared Item source still replaces the target
under the existing semantics. Both the native CatalogEngine and the
VikingDB catalog reuse the already-fetched destination row, so no extra
read is added and the existing undo snapshots still roll back both sides.

Adds merge/undo regressions for ordinary vs Item sources (native shadow and
union, cloud with injected delete failure) and a real-service
add_resource -> mv -> Item search -> mkdir replay covering a root and a
nested destination Item. Documents that merging an ordinary directory into
an Item preserves the destination declaration (en + zh).

Co-authored-by: TRAE CLI <traecli@bytedance.com>
The query_items op implemented a UUID->root lookup that the Item Search
assembly path never calls: assembly reads entity_uri straight from group
metadata, per the engine contract. It had zero production callers and
conflicted with the pre-launch scheme (no UUID回查). Remove it from the
native engine, the VikingDB catalog, and the disabled-collection stub;
rewrite the affected tests to verify the same behaviors via production
ops (resolve for URI<->UUID mapping, declare_item read-back for attrs).

Co-authored-by: TRAE CLI <traecli@bytedance.com>
Clear account-scoped Catalog before identity cleanup can complete. Propagate cleanup failures so existing deletion tasks can retry, and verify persisted declarations vanish after reopening storage without affecting other accounts.

Use partition for aggregate queries and URI predicates for Catalog visibility checks. Remove unsupported primary-key scalar ordering. Verified against real VikingDB STG; inherited UUID filtering still has a separately reproduced engine AND-order bug.

Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Reuse VikingDB reads during transfers, refresh Skill abstracts in place, and honor file-only resource imports. Limit local Catalog work to Item operations and reuse account snapshots for filter-only searches.
Document Item identity cleanup when moving into the file-only system namespace.
return json_stringify(result);
}

std::string CatalogEngine::execute(const std::string& request_json) {
Keep CPU candidate counting and recall inside the shared C++ grouping call. Normalize typed filters before grouping externally recalled candidates.
return Candidate{std::move(label), canonical(required_string(fields, "uri")), score};
}

std::optional<std::string> CatalogEngine::aggregate_filter(
Keep ordinary BM25 handling in place and decode Item URIs in the storage adapter. Reuse filesystem authorization and Skill cleanup, carry the root identity in the semantic plan, and reserve write labels only for collections with an active Catalog.
@cla-assistant

cla-assistant Bot commented Dec 1, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Check both previous and new member URIs against mandatory query paths. Preserve account-wide invalidation for unbounded queries and reserve retries for writes that can affect grouping.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants