Repository navigation
feat(artifacts): add family-scoped search - #1862
Merged
Merged
Conversation
frf12
requested review from
AlexStocks,
PsiACE,
Teingi,
Zxf-xufeng,
frostming and
zhanghuidinah
as code owners
October 7, 2026 11:22
Contributor
|
the github ci action failed. |
frf12
force-pushed
the
codex/artifact-search
branch
from
October 7, 2026 17:03
a90286f to
2893339
Compare
guamiao
added a commit
to guamiao/powercontext
that referenced
this pull request
Oct 9, 2026
Integrate the family-scoped search work (oceanbase#1862), which adds an optional consistent_snapshot to AsyncDatabase.transaction. The snapshot setup moves into the split-out _transaction so the cancellation cleanup in transaction() still owns the connection lifecycle unchanged. Resolve the database.py conflict by keeping both: nested lookups gain the upstream snapshot branch, while the outer transaction retains cursor retirement, interruption-atomicity and commit-boundary cleanup. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 task
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Which issue or RFC does this PR close?
Implements RFC #1858 for Topic Memory, Experience, and Skill.
Rationale for this change
Callers need query-based relevance ordering before a result budget truncates useful Artifacts. Family-scoped search lets each Family own its parameters and retrieval policy without adding Family-specific branches to the HTTP route.
What changes are included in this PR?
Add
POST /v1/scopes/{scope_id}/artifacts/{family}/search, the Python client method, and generated operation contracts. Each request searches one Scope and Family, with a final-resultlimitand no pagination.Introduce typed
ArtifactSearcherregistration and a scoped runtime facade. Family-owned request models validate supported controls; trusted execution context travels separately from the request body.Integrate Topic Memory, Experience, and Skill with their existing retrieval implementations. Preserve legacy APIs, prepare behavior, injected callables, and Skill Library deprecated-result behavior.
Provide Family-independent RRF with algorithm-scoped
rank_constantand channel weights. Apply admission before fusion and normalizedmin_scorebefore the final result limit. Preserve ranking and threshold decisions with subnormal weights using precise raw sums and exact-ratio normalization in the exceptional numeric path; ordinary float accumulation remains unchanged.Return complete exact-revision Artifacts. Optional
include_scoresadds normalized retrieval scores and actual signed BM25, MATCH, or L2 channel observations. Preserve Family JSON aliases and lineage.Add bilingual capability and fusion-parameter documentation, website navigation, and regression coverage.
Authorize new and legacy Topic searches after query embedding against a short consistent data snapshot. Standard same-database Builtin/Casbin policies, candidates, complete content, and lineage use one connection. External or custom policies retain their point decisions against frozen business data. Preserve injected provider/repository rules and independent audit stores; flush decision audits after the read transaction closes.
Keep the shared
AccessControlService.with_connectionbehavior from before the Topic snapshot fix, preserving configured Casbin providers and their repositories. Topic search reauthorization remains in the read-specificrequire_scope_readpath.Desktop bindings are regenerated for this contract, preserving the original ten Legacy Memory operations. An additional explicitly qualified SQLite profile retains the old record; fixtures select the unique qualified profile matching the bundled contract. CLI diagnostics qualify the explicit 1.2.1 release/development series with existing path, digest and exact-version checks.
The usage-recorder writer-lock regression now gives its healthy recovery phase an independent test-only write budget and waits for settlement before asserting exactly one request. The locked-phase deadline and connection-restoration assertions are unchanged.
Atomic Memory integration is in #1882 and depends on #1857. This PR remains the independently deliverable three-Family implementation. RFC and detailed design files are not included.
Are there any user-facing changes?
The HTTP and Python search APIs are additive. Each Family documents its defaults, supported controls, deployment requirements, and limit. Unsupported Families or controls produce explicit errors. Scores use finite
[0, 1]values without promising calibration across Families, algorithms, queries, or backends.Existing business-specific interfaces retain their request/response formats and defaults. For both Topic search routes, revocation during query embedding is respected before reading results; writes after the authorized read snapshot cannot enter the response. External policy decisions are not claimed to share the SQL policy snapshot.
This PR introduces no storage migration or new MCP tool.
How was this change tested?
Reviewed commit:
aa7150f4a74f0389fb1064d11ce51b42a93cb9f2.Fresh verification on 2026-10-09 at 07:26 UTC reconfirmed this exact PR head: 27 required checks and 6 workflows successful, with only the optional
installed-packagedispatch job skipped. Applicable common fixes are synchronized into #1882 atc07d5524f41eacab2055a5e52507b257cd2c9997; its current checks also completed successfully.The follow-up findings for Experience/Skill authorization snapshots, Desktop upgrade-profile instructions, and oversized lexical admission floors remain tracked in their existing threads. CI completion does not claim these findings are resolved.
The branch includes upstream
masterataeeb735397f692df186c32b404f4245030db1f22by normal merge for the newly enabled Desktop workflow.Fresh GitHub verification on
aa7150f4a74f0389fb1064d11ce51b42a93cb9f2confirms all 27 required checks and all 6 workflows completed successfully, including Desktop Windows. The separateinstalled-packagedispatch-only job is intentionally skipped; this is CI completion evidence, not a claim that every test parameter or installed-package scenario executed. #1862 has merged as4ac4f898cb3d09a917115ef1e6e15aef27085c65. The previous Windows run37891441706/ job113693039472at347610aceeb6f5510e77a88e377a6393a651a020passed generation/lint/type checks, all 25 UI tests, and UI build, then failedcargo fmt --manifest-path src-tauri/Cargo.toml --check. The formatter requested line wrapping indesktop/src-tauri/examples/server_probe.rs,desktop/src-tauri/tests/memory.rs, anddesktop/src-tauri/tests/session.rs. Later native Windows checks and installed acceptance were not reached.Current-commit formatting correction and independent coordinator verification:
Historical Desktop integration verification at
347610aceeb6f5510e77a88e377a6393a651a020(business behavior is unchanged by the formatting correction):sqlite-legacy-58f7f4f6-v1profile passed all four real built-wheel SQLite Server modes on macOS, including anonymous, Bearer, explicit-CA HTTPS/base path and injected-provider enforcement. Recorded source/contract/wheel identities match the actual report. The old qualification record is preserved. Profile selection does not attest a remote binary.dead_codeallowed by the Clippy command. The earlier empty local formatter log did not establish formatting of the three new fixtures; the Windows failure and subsequent processed-check evidence are recorded above. No source lint suppression was added. The diagnostics regressions remain after all production items, covering the previously failed strict Windows lint rule.Historical recorder recovery verification at
fb46118342640bf12ec6abfb021369dbcc08fff4:git diff --checkpassed. This is a test-only change; production timeout defaults are unchanged.Historical shared-method restoration verification at
a0732e7e8bd5c21e3ae93157927ef7aee9c954c6: GitHub CI completed with 26 of 26 checks successful and all five workflow runs successful.uv run prek run -a: all repository checks passed, including global type checking.git diff --checkpassed.toxmatrix were not rerun for this restoration.Feature and scoring validation at
b7c0e80e2b3864b36c66bf3e7548e11a58d56141:1fcfe876: equal weights1e-320returned1.0and retained both results atmin_score=0.999. The corrected fusion returns approximately0.99193548for both weights1and1e-320, retaining neither result. Text mode requires no model call.make contract-test: 49 passed, 0 failed, 0 skipped, 0 deselected, including Python and JavaScript generation checks.uv run prek run -a: all checks passed, including repository formatting/lint and global type checking; commit hooks also passed.Authorization/read-snapshot backend verification used commit
1fcfe876and original assertions with Python 3.14.7. The Topic read-snapshot implementation remains unchanged by the shared-method restoration:These executions cover 76 unique cases, including all 54 core HTTP scenarios across three actual databases. Deselections choose the backend for each run. SeekDB used
pylibseekdb 1.4.0.post1/ engineseekdb-v1.4.0.0; OceanBase reportedOceanBase_CE-v4.3.5.6. Each OceanBase case used an isolated disposable database.Embedding uses a controlled local implementation. AuthZEN uses MockTransport, so those cases verify the adapter contract and local snapshot handling rather than a live PDP or model service. Those backend executions were performed on the stated base commit and do not establish current-head live-backend acceptance.
AI usage statement
Implemented with Codex subagents using GPT-6.1 Sol at ultra reasoning effort. The coordinating agent reviewed the source, requested regression fixes, and independently ran affected tests, contract checks, and repository commit checks. An additional read-only agent reviewed the authorization and compatibility boundaries.