Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/e2e-harness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,23 @@ jobs:
uv lock --check
uv run --locked prek run -a

- name: Run the real OceanBase contract without skips
- name: Run OceanBase contracts and Jev integration without skips
run: |
mkdir -p .powercontext/recall-effort-ci
uv run --locked pytest \
tests/builtin/persistence/test_oceanbase_profile.py::test_live_oceanbase_profile_smoke \
'tests/builtin/persistence/test_recall_effort_statistics.py::test_recall_effort_schema_upgrade_and_atomic_daily_scope_accounting[oceanbase]' \
tests/builtin/persistence/test_oceanbase_profile.py::test_live_oceanbase_profile_rejects_old_schema_collation \
tests/e2e/test_jev_memory_reranking.py \
--junitxml=.powercontext/recall-effort-ci/oceanbase.xml -q -rs
uv run --locked python - <<'PY'
from pathlib import Path
from xml.etree import ElementTree

suites = ElementTree.parse(Path(".powercontext/recall-effort-ci/oceanbase.xml")).getroot()
cases = list(suites.iter("testcase"))
if len(cases) != 3 or any(case.find("skipped") is not None for case in cases):
raise SystemExit("All three live OceanBase contracts must execute; skipped tests are not acceptance.")
if len(cases) != 9 or any(case.find("skipped") is not None for case in cases):
raise SystemExit("All nine database contracts must execute; skipped tests are not acceptance.")
PY

- name: Run the real OceanBase recovery upgrade without skips
Expand Down
12 changes: 12 additions & 0 deletions docs/en/docs/operate/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,18 @@ The built-in reranker is an LLM listwise reranker, not a dedicated cross-encoder
generation model and its provider settings. Set `POWERCONTEXT_SERVER_INFERENCE_RERANK_MODEL` to give that LLM operation
an independent model, base URL, headers, settings, timeout, and request limit.

Python deployments can inject the optional `JevMemoryReranker` with a
`JevRerankConfig` and a caller-owned HTTPX client into
`open_builtin_runtime(memory_reranker=...)`. It requires a dedicated API key,
System One endpoint, and pinned model such as `jev-1.13.0`. Its total deadline
and concurrency/request-size bounds are explicit. Provider failures propagate as
inference errors under RFC 0080, including timeouts, unavailable providers, invalid
scores, missing usage receipts, and model-version drift. Injected rerankers also
disable recall expansion unless the existing `RECALL_GATE_ALLOW_WITH_RERANK`
setting enables it. The Server environment switch above selects the existing LLM
reranker. See `evaluation/memory/locomo/README.md` in the repository for Jev
configuration, the three-arm comparison, and execution coverage.

The same configured generation model gates explicit Experience generation, managed Skill generation, and semantic
Skill fork/evolution. Exact external Skill import and complete package upload do not use a model: PowerContext validates
and stores the canonical package bytes, then creates a pending Candidate with the same package digest. Without a
Expand Down
9 changes: 9 additions & 0 deletions docs/zh/docs/operate/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,15 @@ search request 最终 `limit` 的结果。它不会修改已存储 Memory 或索
settings。设置 `POWERCONTEXT_SERVER_INFERENCE_RERANK_MODEL` 后,该 LLM operation 可以使用独立的 model、base URL、
headers、settings、timeout 和 request limit。

Python 部署可以把可选的 `JevMemoryReranker` 通过
`open_builtin_runtime(memory_reranker=...)` 注入 Runtime,使用 `JevRerankConfig`
配置独立 API key、System One endpoint 和固定模型版本,例如 `jev-1.13.0`,并由调用方管理
HTTPX client。适配器限制整个操作的时限、并发数和请求大小;超时、Provider 不可用、无效分数、
缺少用量回执和模型版本不符均按 RFC 0080 显式返回 inference error。
注入的 reranker 默认也会关闭召回扩展,只有现有 `RECALL_GATE_ALLOW_WITH_RERANK`
配置显式允许时才扩展。上面的 Server 环境变量开关仍选择现有 LLM reranker。
Jev 配置、三组对照评估与实际验证范围见仓库中的 `evaluation/memory/locomo/README.md`。

同一个 generation model 也控制显式 Experience generation、managed Skill generation,以及语义化的 Skill
fork/evolution。External Skill 精确导入和完整 package 上传不使用模型:PowerContext 会校验并保存 canonical package
bytes,再创建 package digest 完全相同的 pending Candidate。未配置模型时,语义生成会在持久化 Candidate 前返回
Expand Down
136 changes: 136 additions & 0 deletions evaluation/memory/locomo/JEV_EVALUATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Jev Memory reranking evidence

Task: #1937, restored from #1643.

The implementation uses the existing `MemoryReranker` injection boundary over
independent Atomic Memory Artifacts. Policy:
`powercontext.memory.rerank.jev.noul.v1`; protocol fixtures use `jev-1.13.0`.
Jev is opt-in and requires a dedicated key and pinned model. The standard
Runtime and LLM reranker retain their defaults.

## Execution coverage

SQLite acceptance uses a real local database and the actual Runtime assembly,
HTTP authorization, exact-revision read path, and PreparedContext builder.
It covers successful scoring, explicit rate-limit and total-deadline failures,
cross-Scope rejection before provider requests, identity preservation, read-only
Memory state, UTF-8 delivery limits, and suppression of automatic recall expansion.

Provider responses in these tests use HTTPX MockTransport. They establish local
protocol handling and RFC 0080's failure behavior, not Jev's semantic accuracy,
availability, network latency, or billed cost. Persisted-candidate evaluation
tests exercise search, answer generation, and judging through the locked native
OpenAI and Anthropic SDKs with simulated HTTP responses. They reject missing or
partial usage receipts and prevent SDK retries from hiding billable attempts in
both the answer/judge path and the independent LLM reranker.

The same acceptance scenarios support an isolated real OceanBase database through
`POWERCONTEXT_TEST_OCEANBASE_URL`. The fixture creates and removes its own database;
the connection must permit those operations. OceanBase scenarios are skipped when
the setting is absent.
The E2E harness's `Recall effort (OceanBase)` job includes all six Jev SQLite and
OceanBase scenarios in its database contract step, rejects skipped cases, and
uploads the JUnit report. Its provider responses still use MockTransport; the
database integration and hosted Jev quality are separate evidence.

On 2026-10-17 (Asia/Shanghai), the database contract step of
[E2E harness run 38928735027](https://github.com/oceanbase/powercontext/actions/runs/38928735027/job/117079194023)
passed on commit `60b6ffcbaa1598586c7baa992c05f8a6817e82c7`: nine cases executed
without skips, comprising three existing OceanBase contracts and all six Jev
integration scenarios across SQLite and real OceanBase. This execution establishes
database integration, including explicit provider-failure propagation. The same
job's broader recall suite passed 307 tests.

```bash
uv run python -m pytest \
tests/builtin/artifacts/memory/test_jev_reranking.py \
tests/e2e/test_jev_memory_reranking.py \
tests/evaluation/test_jev_rerank_comparison.py
```

## Quality and cost decision

Recommendation: **revise**. The measured service path has explicit failures and
higher successful-observation latency; complete account billing remains unavailable.

The [hosted execution records on PR #2005](https://github.com/oceanbase/powercontext/pull/2005)
retain the reviewed, non-secret endpoint, pinned version, input and adapter hashes,
per-case selections, latency, token receipts, and diagnostic failures. They include
successful serial and concurrent adapter requests and earlier HTTP 402 responses
whose cause remains undetermined. A provider rejection alone does not establish
that an account has no balance.

These are adapter connectivity and protocol checks over public examples. They do
not exercise ingestion, Runtime search, answer generation, or judging. Failed or
cancelled requests have unknown billing. Keep one-off raw records with the PR or CI
artifacts; the reusable bilingual and adversarial inputs remain in
`dataset/rerank_smoke_cases.json`.

On 2026-10-17 (Asia/Shanghai), an additional 12 predeclared bilingual/adversarial
questions ran through native Source capture, extraction/reconciliation, SQLite
hybrid search, reranking, answering, and judging. They used one frozen ingestion
of 12 sessions and the existing local DashScope Qwen/embedding configuration;
the Jev arm used the user-provided `jevmodel.org` endpoint with `jev-1.13.0`.
These measurements describe that service path, without independently verifying
upstream execution or establishing direct TypeSafe API performance.

| Arm | Completed | Judge correct / attempted | Search + rerank + answer p50 | p95 |
| --- | ---: | ---: | ---: | ---: |
| none | 12/12 | 12/12 | 1.20 s | 1.50 s |
| llm | 12/12 | 12/12 | 1.98 s | 2.38 s |
| jev | 7/12 | 7/12 | 8.57 s | 13.24 s |

Five Jev questions failed with actual HTTP 402 `insufficient_credits` responses.
The same arm recorded 16 successful HTTP requests. This does not establish a zero
account balance. Failed questions remain zero in the quality denominator; their
answers were not replaced with diagnostic retries. Latency quantiles cover
successful observations and exclude the evaluation judge. Seven jointly successful
questions have identical ordered candidate digests. Candidate equality is not
claimed for failed questions without a successful trace.

The run fixed candidate limit 10, answer limit 3, complete serialized answer budget
4096 UTF-8 bytes, temperature 0, concurrency 1, one operation attempt, and quality
regression tolerance 0. The separately versioned `strict-abstention` judge accepts
an explicit abstention for gold `Unknown`; all arms correctly abstained on both
unanswerable questions. The same configured Qwen model answers and judges, so these
are model grades, not independent human judgments.

On the same seven successful questions, rerank + answer token receipts total
7579 for LLM and 10463 for Jev, approximately 38% more for Jev. The Qwen answer
phase alone used 4194 versus 4676 tokens. Cross-provider token sums are not monetary
costs. Failed/cancelled requests and actual account prices leave USD costs unknown.
Two LLM observations used validated-empty-selection coarse fallback; Jev used
no fallback. Provider failures still propagate under RFC 0080.

These are small, agent-authored fixtures frozen before answering, not an external
independent benchmark. Candidate counts range from 1 to 9, with both baselines at
the score ceiling. Session-level provenance recall/MRR does not establish
sentence-level entailment. There is no basis for changing the default provider
or claiming a quality, latency, or cost improvement.

The separate preselected 12-question public LoCoMo pilot has no answer evaluation.
Native ingestion reached 7/19 sessions. Two attempts timed out under the existing
30-second model deadline; a further attempt was deliberately stopped after the
completed hosted comparison exposed repeated provider rejections. Partial ingestion
is retained as a checkpoint, not acceptance evidence. Input-dependent identity
validation now gives the model bounded correction feedback before publication;
the published-identity invariant and request/time limits are preserved.

The runnable comparison in [README.md](README.md#reranker-comparison) fixes the
inputs and delivery budget and rejects candidate/model/budget drift. The quality
regression tolerance is `0.0`, recorded before evaluation. A report with missing
cost receipts cannot recommend adoption. Comparison manifests pin both resolved
generation and independent reranker endpoints and record a no-SDK-retries,
required-receipts billing policy. Older runs without that policy cannot establish
complete cost. The bilingual/adversarial smoke cases
are separate from any future calibration and held-out evaluation.

Retain reviewed non-secret manifests and comparison results, complete the public
LoCoMo pilot once the service path is usable, and evaluate a dedicated reranker
baseline if available before closing the issue's empirical acceptance criteria.
The new input hash is
`be736cdb4c9691dfd7e482144d216ecc448fa3fa433990254c57eb4b0586b762`.
One-off local records remain outside tracked source pending user review. Include the shared
ingestion cost when reporting total pipeline cost; the comparator reports the
search-to-answer evaluation portion. Comparison schema v3 separates product
cost/latency from judging so an inexpensive or fast judge cannot justify adoption.
Loading
Loading