Skip to content

feat(retrieval): add event time-decay ranking - #5214

Merged
qin-ctx merged 37 commits into
volcengine:mainfrom
cocolord:codex/event-time-decay
Sep 29, 2026
Merged

qin-ctx merged 37 commits into
volcengine:mainfrom
cocolord:codex/event-time-decay

Conversation

@cocolord

@cocolord cocolord commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Add request-level event time decay during vector recall for semantic find/search. Omitted/null protection keeps the original single-search path; "0" enables immediate decay and durations such as "7d" protect scores before decay. Event recall scores use origin_score * time_score, with no hotness or parent-directory weighting.

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

Implementation

  • Integrate main through acfeb99b4, including the global retrieval and hotness removal changes in refactor(retrieval): 改为全局召回并统一候选精排 #5450 and refactor(retrieval): 移除热度加权及其配置 #5454.
  • With decay enabled, split the original scope only by the presence/absence of memory_type=events. Both branches retain its permissions, directories, context type and levels. Missing tags enter the other branch. Extraction writes type tags for new/updated memories; direct content refresh preserves existing metadata. No historical backfill or URI-based type inference is added.
  • The event branch computes decay before merging with the other branch. Local C++ expands its requested window 3x (capped at 100,000), computes the time factor, multiplies vector scores, sorts and truncates before payload fetches. Cloud adapters always send VikingDB score-fusion rules, including when model rerank is enabled. They request only the needed window, without a fixed 100,000-input override. HTTP forwards native parameters. openGauss receives the original parameters unchanged and keeps its ordinary vector scoring; it does not implement time decay.
  • Model rerank requests 2 * limit results from each branch, merges the already-decayed event scores with ordinary scores, and reranks at most 2 * limit combined candidates. Model scores determine final ranking and threshold filtering. There is no additional time decay after model rerank. Failure fallback keeps the already-decayed recall scores.
  • The local 3x expansion applies to the event branch's requested window. For final limit=10, each branch returns at most 20 results; the local event engine considers at most 60 vector candidates internally, and at most 20 merged results reach the model.
  • Remove deferred-fusion flags and the post-model native batch scoring interface. Python translates parameters, merges recall results and orchestrates model rerank; it does not calculate time factors or multiply scores by decay. The adapter owns score-detail requests, removing redundant flag forwarding and a pass-through search helper.
  • REST, MCP, SDKs and CLI forward protection and score details. origin_score and time_score describe recall-stage vector scores and factors; final score may be a model score. English/Chinese documentation explains these stages and budgets.

Validation

  • Current head da071d990: 189 local tests passed across scope/ACL, rerank, local C++ projection and decay, cloud/HTTP clients, score adapters, openGauss parameter pass-through and ordinary scoring, engine loading and ABI packaging. Ruff lint/format for the cleanup and git diff --check passed.
  • Native integration coverage checks protection periods, missing timestamps, bounded 3x recall, sorting before payload fetches, pagination, timestamp persistence and updates. Scope and rerank cases check tag-only splitting, preserved engine scores, 2x model candidates and fallback without repeat decay. Repeated standalone tests have been consolidated into the existing suites.
  • K8s validation at 1e0f129e: built the repository Dockerfile for Linux amd64 with freshly compiled C++ extensions; 252 pytest executions passed (118 core, 122 compatibility, 6 SSE3 and 6 AVX2), with no failures or skips. Authenticated HTTP find/search with a real embedding service verified disabled/null behavior, protection periods, decay scores, tag isolation and invalid-parameter errors. The standard container entrypoint returned 200 for health and readiness. The temporary test Pod was removed.
  • The commits after that K8s run consolidate tests, reuse the common HTTP response parser and remove openGauss decay SQL plus its unused Python candidate-budget helper. openGauss keeps the shared parameter interface without processing decay. C++ is unchanged; K8s has not been rerun for da071d990.
  • Earlier SDK checks before test consolidation: Python forwarding 3 passed; TypeScript client 58 passed; Go suite passed with external linking after the default macOS linker produced a missing-LC_UUID loader error; Rust CLI score rendering 1 passed.

Limits

  • Bounded vector recall is approximate; events outside its candidate window cannot be promoted.
  • Real model rerank, remote VikingDB and remote openGauss were not integration-tested. Model responses and database transport were controlled in regression tests. No shared STG or production deployment was changed.
  • Earlier broader validation found two unrelated MCP failures, test_forget_directory_without_recursive_fails and test_write_append_missing_file_fails, also reproduced on unmodified main 00490c93a. Those cases were not rerun for this cleanup.

Co-authored-by: TRAE CLI <traecli@bytedance.com>
@cocolord
cocolord force-pushed the codex/event-time-decay branch from 07c0cbb to df0aefa Compare September 20, 2026 08:02
cocolord and others added 5 commits September 20, 2026 20:28
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>
@cocolord
cocolord marked this pull request as ready for review September 21, 2026 04:46
cocolord and others added 4 commits September 21, 2026 15:37
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

# Conflicts:
#	tests/storage/test_volcengine_clients.py
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
cocolord and others added 5 commits September 22, 2026 11:45
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

# Conflicts:
#	openviking/server/mcp_endpoint.py
@cocolord

Copy link
Copy Markdown
Collaborator Author

STG validation for f477a901c (sanitized)

  • Version check: An isolated STG instance ran the complete core/native package 0.4.22.dev95 from this PR's Linux CI build, plus the SDK built from this commit. All PR-changed Python files were hash-verified against the running package.
  • Feature checks: 140 assertions passed across direct service requests (114), gateway requests (22), and a real session extraction (4). New and updated memories receive memory_type=<type>; tag replacement retains that type. find and search recall and decay peer events without a peer ID. Untagged legacy events remain eligible without backfill. Local native-vector tests and real cloud calls cover the shared event/remaining recall plan; zero decay weight keeps the original one-query path.
  • Fresh-write caveat: One synthetic empty-tag record inserted directly into the cloud backend missed an early decay-enabled find about 2 seconds after upsert, then passed on the same record. A controlled cloud comparison found both query paths visible at 8 seconds; the local backend found the empty-tag record on both paths immediately, at 2 seconds, and at 8 seconds. VikingDB documents Collection-to-Index lag (typically 3 seconds, up to 20 seconds). No miss was observed after indexing; the exact cause of the initial single-route/split-route difference remains unconfirmed.
  • Regression scope: 376 focused Python tests passed, current PR CI has no failures, and the five previously failing CLI cases passed after aligning the full image version. The control-plane suite's six non-passing cases match the existing baseline. The full data-plane regression suite was not completed on the final image.

The change is ready for review with the fresh-write caveat above visible to reviewers.

@qin-ctx qin-ctx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

类型标签只需由记忆提取的新建和更新流程维护。请收窄当前实现,避免共用向量化流程在直接写入记忆文件时重新推断并覆盖类型。

cocolord and others added 7 commits September 23, 2026 16:41
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>
…gnment

Co-authored-by: TRAE CLI <traecli@bytedance.com>

# Conflicts:
#	openviking/session/memory/memory_updater.py
cocolord and others added 3 commits September 24, 2026 15:19
…gnment

Co-authored-by: TRAE CLI <traecli@bytedance.com>

# Conflicts:
#	openviking/storage/viking_vector_index_backend.py
#	tests/storage/test_viking_vector_scope_filter.py
…gnment

Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
@qin-ctx
qin-ctx merged commit 42d9a7f into volcengine:main Sep 29, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants