contextguru plugin: set apply.Opts.CanKeepAlive, so extract_llm_sweep can run (about 4% of baseline at ultrahigh)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- go
- Lĩnh vực
- ai-infra-agents, backend
Hướng nghiên cứu
Read the contextguru plugin code that constructs apply.Opts, then compare its fields with proxy/modes.go and the keep-alive checks in components/offload/extract_sweep_ping.go and extract_sweep_warm.go. Set the missing fields using the proxy's rules, and explain any fields Cortex does not need. Done means the sweep can register and reuse answers after a keep-alive ping, with the other relevant options accounted for.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The contextguru plugin does not set apply.Opts.CanKeepAlive. Without it, extract_llm_sweep never registers its question for the keep-alive ping, so it never holds an answer and never drops anything. On the context-guru proxy, the sweep makes almost all of the rewrite saving at ultrahigh (about 4% of baseline). In Cortex it makes $0.
The plugin also leaves other apply.Opts fields unset that the context-guru proxy sets. They are listed below.
Found on Cortex main plus fix/2134-gate-untrusted-savings (499c6ddc), which embeds context-guru v0.7.9.
What we found
The baseline: one laptop on the context-guru proxy
Preset ultrahigh, 2026-11-16 to 2026-11-25, 14,207 requests, context-guru v0.7.7 to v0.7.8, the same litellm gateway:
- cost $1,101.53 against a baseline of $1,152.49: 4.4% saved by rewriting the context.
| Component | Requests it acted on | Saved (USD) |
|---|---|---|
| extract_llm_sweep | 5,834 of 12,100 | 47.91 |
| headttl | 576 | 4.82 |
| extract_llm | 1,372 | 1.39 |
| tooldefer | 154 | 0.98 |
| tailbreakpoint | 858 | 0.42 |
| textclean | 5,315 | 0.37 |
| format | 1,798 | 0.02 |
| extract | 1,050 | 0.01 |
| cache_aware_summarizer | 50 | 0.00 |
| dedup | 53 | 0.00 |
| cachesplit, cmdfilter, toolfilter, toon | 0 | 0.00 |
| expand | 11,256 | -0.30 |
| adjudicate | 11,256 | -0.84 |
| searchfold | 10,854 | -2.84 |
How the sweep earned it (events of the sweep component):
sweep_applied_cold: 160 cold requests applied a held answer. Prompt sizes were 63k to 802k tokens, about 190k on average.reapplied_same_session: 5,883 later requests applied the same drops again. These repeats are most of the $47.91.
The same laptop on Cortex
- Since 2026-11-25, Cortex logged about 40,000
context-guru compacted requestlines. None listsextract_llm_sweep. - The summarizer does fire (114 requests since the #2129 fix), so the pipeline and the dispatcher work.
Why
- The sweep asks its question at the keep-alive ping, in place of the ping (
components/offload/extract_sweep_ping.go). The next cold request applies the held answer. Later requests apply it again. - To be asked at a ping, the request must register a snapshot of the conversation (
ExtractSweep.registerPing). registerPingreturns early whenc.CanKeepAliveis nil: "No host hook means no keep-alive: keep nothing."c.CanKeepAlivecomes fromapply.Opts.CanKeepAlive. The context-guru proxy sets it (proxy/modes.go). The contextguru plugin does not.- The sweep's warm path (
extract_sweep_warm.go) checks the same hook.
Proposal
- Set
apply.Opts.CanKeepAlive. Use the library's rule, as the proxy does:keepalive.CanKeepAlive(policy, ...)for the thread's resolved policy. Do not write a new rule in the plugin. - Set the other fields that the proxy sets and the plugin does not. Check each one, and set it or state why Cortex does not need it:
| Field | What it does | Without it |
|---|---|---|
CompactionPoint, CompactionPointSource |
where the client's own compaction acts (C) | components use the window instead of C |
SelfRates, RatesFor |
the prices a component uses to decide whether its model call pays | extract_llm uses default prices |
FreePing |
the time of a free 1-hour ping, by alias | the cold check cannot see a free ping |
Tracker |
per-thread cached-prefix boundary, without the read-then-write race | the legacy store path |
Mode |
the operating mode | sync |
How to check the fix
- After an idle gap, the keep-alive sends the sweep question in place of a ping.
- A later cold request lists
extract_llm_sweepincomponents=, and the requests after it too. - Over a day of the same traffic, Context rewrite on the fleet dashboard rises from about 0.4% toward the proxy's 4%.
Open questions
- Is the sweep's ping question allowed under Cortex's cost limits per ping? The keeper already caps it (
keepalive_max_usd_per_ping).
Technical notes
- Related: #2130 (threads, fixed by #2129), #2150 (tool deferral: $0.98 in the baseline, so small), #2154 (open-task counts).
- Baseline data: the proxy's dashboard DB, tables
requestsandrequest_components,preset = 'ultrahigh'.
- Ngôn ngữ chính
- Go
- Star
- 31
- Fork
- 49
- Merge trung bình
- 9 giờ 43 phút
- Pull request đã merge (30 ngày)
- 367
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rossoctl/cortex
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
contextguru plugin: set keepalive.Record.Identity; context-guru v0.7.11 removes Record.AgentĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug laptop
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rossoctl/cortex
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
apache/dubbo-admin#1659 ·
Maintainer thường phản hồi trong vòng 8 ngày
-
taskmanager: a failed v1alpha1 backup leaves the partial backup behindCó thể đã có người làm @arshil42 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
modelcontextprotocol/go-sdk#1557 ·
Maintainer thường phản hồi trong vòng 1 ngày