mirror of
https://github.com/volcengine/OpenViking.git
synced 2026-09-29 16:58:31 +08:00
fix(plugin): remove misleading recall top score (#4053)
* fix(plugin): report server recall top score Derive the status snapshot's top score from server-assembled context so /ov no longer reports 0.00 for scored recalls. Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com * test(plugin): remove redundant recall state tests * fix(plugin): remove misleading recall top score --------- Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6 noreply@anthropic.com
qin-ctx
parent
492235de86
commit
e2a604167d
@@ -270,7 +270,7 @@ The plugin renders a one-line status of OpenViking under your Claude Code input
|
||||
Examples:
|
||||
|
||||
```text
|
||||
OV ✓ │ Fable 5 · ctx 42% │ ↩ 6 mem (0.92) · 50ms 6 memories injected; model + context usage
|
||||
OV ✓ │ Fable 5 · ctx 42% │ ↩ 6 mem · 50ms 6 memories injected; model + context usage
|
||||
OV ⚠ slow probe missed the 1 s budget (server may be lagging)
|
||||
OV ✗ offline server unreachable
|
||||
OV ⚡ bypass │ Fable 5 · ctx 42% OPENVIKING_BYPASS_SESSION* matched
|
||||
|
||||
@@ -264,7 +264,7 @@ bypass 命中时所有 hook 直接放行,不联系 OpenViking。
|
||||
示例:
|
||||
|
||||
```text
|
||||
OV ✓ │ Fable 5 · ctx 42% │ ↩ 6 mem (0.92) · 50ms 注入 6 条记忆;模型 + 上下文占比
|
||||
OV ✓ │ Fable 5 · ctx 42% │ ↩ 6 mem · 50ms 注入 6 条记忆;模型 + 上下文占比
|
||||
OV ⚠ slow 探针超过 1s 预算(服务器可能在抽风)
|
||||
OV ✗ offline 服务器不可达
|
||||
OV ⚡ bypass │ Fable 5 · ctx 42% 命中 OPENVIKING_BYPASS_SESSION*
|
||||
|
||||
@@ -42,7 +42,7 @@ The default composition runs left to right, joined by ` │ `. Segments are cond
|
||||
| | `OV ✗ offline` | red | probe errored (refused, DNS fail, network down) |
|
||||
| | `OV ⚡ bypass` | yellow | session matched `OPENVIKING_BYPASS_SESSION` or `*_PATTERNS` |
|
||||
| Model · ctx | `Fable 5 · ctx 42%` | dim / by usage | always, when CC's statusline payload carries `model` / `context_window`. Registering a custom statusLine replaces CC's native context indicator, so this reproduces it: `<70%` dim, `70–89%` yellow, `≥90%` red (native thresholds). Hide with `OPENVIKING_STATUSLINE_CTX=off`. Shows in bypass mode too — it describes the CC conversation, not OV |
|
||||
| Recall | `↩ 6 mem (0.92) · 50ms` | dim | last user prompt actually injected memories. `(0.92)` is the top similarity score among picked items; latency is the recall round-trip |
|
||||
| Recall | `↩ 6 mem · 50ms` | dim | last user prompt actually injected memories; latency is the recall round-trip |
|
||||
| Capture | `✎ 573/20k · 2 arch` | dim | tokens pending toward the next archive (sawtooth — resets on commit), `2 arch` = archives produced this session |
|
||||
| | `✎ committed · 2 arch` | dim | the turn that just finished produced an archive |
|
||||
| | `✎ 2 arch` | dim | nothing pending, but archives already exist this session |
|
||||
@@ -127,7 +127,6 @@ For an assistant adding a segment that consumes existing state. All files live u
|
||||
{
|
||||
"reason": "ok" | "bypass" | "offline" | "no_results" | "filtered_out" | "short_query" | ...,
|
||||
"count": 6, // memories actually injected
|
||||
"top_score": 0.92, // max score among picked items
|
||||
"latency_ms": 180,
|
||||
"cc_session_id": "ff875009-...",
|
||||
"ts": 1778139288759
|
||||
|
||||
@@ -399,7 +399,6 @@ async function main() {
|
||||
hint_items: 0,
|
||||
tokens_used: estimateTokens(endpointBlock),
|
||||
tokens_budget: cfg.recallTokenBudget,
|
||||
top_score: 0,
|
||||
cc_session_id: sessionId,
|
||||
reason: "ok",
|
||||
});
|
||||
@@ -436,14 +435,12 @@ async function main() {
|
||||
}
|
||||
|
||||
const built = await buildInjectionBlock(picked, effectivePeer.peerId);
|
||||
const topScore = picked.reduce((m, it) => Math.max(m, clampScore(it.score)), 0);
|
||||
writeRecallState({
|
||||
count: picked.length,
|
||||
content_items: built?.contentCount ?? 0,
|
||||
hint_items: built?.hintCount ?? 0,
|
||||
tokens_used: built?.budgetUsed ?? 0,
|
||||
tokens_budget: cfg.recallTokenBudget,
|
||||
top_score: topScore,
|
||||
cc_session_id: sessionId,
|
||||
reason: "ok",
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* - Server URL + /health probe
|
||||
* - Resolved identity (account/user)
|
||||
* - Last session-start injection (size, age, audit path)
|
||||
* - Last auto-recall (item count, top score, token budget use)
|
||||
* - Last auto-recall (item count, token budget use)
|
||||
* - Toggle state for the three injection paths
|
||||
* - Auth source — which file/env actually drove url + api_key, mirroring
|
||||
* config.mjs's priority chain (env → ovcli.conf → ov.conf → default)
|
||||
@@ -94,12 +94,11 @@ async function main() {
|
||||
// 3. Last auto-recall
|
||||
const recall = readJsonState("last-recall.json");
|
||||
if (recall) {
|
||||
const top = typeof recall.top_score === "number" ? recall.top_score.toFixed(2) : "?";
|
||||
const used = recall.tokens_used ?? 0;
|
||||
const budget = recall.tokens_budget ?? 0;
|
||||
console.log(
|
||||
`Last auto-recall: ${fmtAge(recall.ts)} — ${recall.count ?? 0} items, ` +
|
||||
`top ${top}, ${used}/${budget} tokens (${recall.reason || "ok"})`,
|
||||
`${used}/${budget} tokens (${recall.reason || "ok"})`,
|
||||
);
|
||||
} else {
|
||||
console.log("Last auto-recall: (none yet)");
|
||||
|
||||
@@ -189,16 +189,9 @@ async function main() {
|
||||
|
||||
// Recall summary: only meaningful when we actually injected memories this
|
||||
// turn. Skip the segment for empty/bypass/no-results reasons to keep the
|
||||
// line tight. The (0.92) trailing parens is the top score among picked
|
||||
// items — quality hint without an extra segment. Token/char count is
|
||||
// omitted: the only number we have is a chars/4 heuristic, which is
|
||||
// misleading enough on CJK text that displaying it does more harm than
|
||||
// good. Count + score + latency convey the relevant signal.
|
||||
// line tight. Count confirms the injection; latency shows its round-trip cost.
|
||||
if (recall && recall.reason === "ok" && recall.count > 0) {
|
||||
const top = typeof recall.top_score === "number" && recall.top_score > 0
|
||||
? ` (${recall.top_score.toFixed(2)})`
|
||||
: "";
|
||||
const seg = `↩ ${recall.count} mem${top}`
|
||||
const seg = `↩ ${recall.count} mem`
|
||||
+ (typeof recall.latency_ms === "number" ? ` · ${recall.latency_ms}ms` : "");
|
||||
parts.push(dim(seg));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user