This repository was archived by the owner on Jun 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
Add low-latency raw memory search #173
Open
strongkeep-debug
wants to merge
10
commits into
XortexAI:main
Choose a base branch
from
strongkeep-debug:codex/163-search-fast-path
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b0ee54d
Add low-latency memory search path
strongkeep-debug 47c31fe
Tighten low-latency retrieval path
strongkeep-debug d07e782
Include code annotations in raw search
strongkeep-debug e4fb402
Harden raw search score handling
strongkeep-debug 5c79aec
Add raw answer missing-score regression
strongkeep-debug 4cfcca3
Search code annotations from code store
strongkeep-debug 124cfae
ci: harden fork PR checks
strongkeep-debug a141611
Revert "ci: harden fork PR checks"
strongkeep-debug 5b04cc7
Fix Sentry probe lint
strongkeep-debug 9aaf5f8
Invalidate profile cache after memory ingest
strongkeep-debug File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| from .health import router as health_router | ||
| from .memory import router as memory_router | ||
| from .memory import search_router as memory_search_router | ||
|
|
||
| __all__ = ["health_router", "memory_router"] | ||
| __all__ = ["health_router", "memory_router", "memory_search_router"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,7 +7,6 @@ | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| from __future__ import annotations | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| from datetime import datetime | ||||||||||||||||||||||||
| from enum import Enum | ||||||||||||||||||||||||
| from typing import Any, Dict, List, Optional | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -159,15 +158,19 @@ class SearchRequest(BaseModel): | |||||||||||||||||||||||
| ..., min_length=1, max_length=256, pattern=r"^[\w.\-@]+$", | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| domains: List[str] = Field( | ||||||||||||||||||||||||
| default=["profile", "temporal", "summary"], | ||||||||||||||||||||||||
| default=["profile", "temporal", "summary", "snippet", "code"], | ||||||||||||||||||||||||
| description="Which memory domains to search", | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| top_k: int = Field(default=10, ge=1, le=100) | ||||||||||||||||||||||||
| answer: bool = Field( | ||||||||||||||||||||||||
| default=False, | ||||||||||||||||||||||||
| description="When true, synthesize an answer from the raw hits without agentic tool selection.", | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @field_validator("domains") | ||||||||||||||||||||||||
| @classmethod | ||||||||||||||||||||||||
| def validate_domains(cls, v: List[str]) -> List[str]: | ||||||||||||||||||||||||
|
Comment on lines
170
to
172
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||
| allowed = {"profile", "temporal", "summary"} | ||||||||||||||||||||||||
| allowed = {"profile", "temporal", "summary", "snippet", "code"} | ||||||||||||||||||||||||
| for d in v: | ||||||||||||||||||||||||
| if d not in allowed: | ||||||||||||||||||||||||
| raise ValueError(f"Invalid domain '{d}'. Allowed: {allowed}") | ||||||||||||||||||||||||
|
|
@@ -177,6 +180,10 @@ def validate_domains(cls, v: List[str]) -> List[str]: | |||||||||||||||||||||||
| class SearchResponse(BaseModel): | ||||||||||||||||||||||||
| results: List[SourceRecord] = Field(default_factory=list) | ||||||||||||||||||||||||
| total: int = 0 | ||||||||||||||||||||||||
| answer: str = "" | ||||||||||||||||||||||||
| model: str = "" | ||||||||||||||||||||||||
| confidence: float = 0.0 | ||||||||||||||||||||||||
| latency: Dict[str, Dict[str, float | int]] = Field(default_factory=dict) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # ── Scrape (extract from shared chat links) ──────────────────────────────── | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_latency_snapshot()returns the shared pipeline singleton's accumulated_latency_samplesdict, which collects data from all users and all modes (raw, answer, and agentic). Every authenticated caller therefore receives alatencyobject that includes thecountand percentiles of other users' requests — including from the/v1/memory/retrieveagentic endpoint that has nothing to do with search. Thecountvalue reveals how many recent requests have been processed system-wide, making this a side-channel that leaks activity patterns across the user base. This data belongs in the existing Prometheus/metricsendpoint, not in a per-call user response.