1423 Commits

Author SHA1 Message Date
Yuchuan He
e70a6be7e3 fix(llm): recover Responses after a stream read disconnect (#3073) 2026-12-01 21:55:56 +08:00
Tazeem
ae30853303 fix(codebuddy): release SDK login flows after interrupted waits (#2760) 2026-12-01 21:54:26 +08:00
Qiu
fda9efa57d refactor(turns): share durable turn status classifications (#3122)
* Share durable turn status groups across application and stores

* Verify durable status groups against SQLite active lookup
2026-12-01 21:36:55 +08:00
Yuchuan He
38af3bc518 fix(llm): preserve Responses system instructions across summaries (#2711) 2026-12-01 21:36:30 +08:00
Yuchuan He
a35231eb92 fix(llm): retain Azure streamed response replay state (#2712) 2026-12-01 21:36:03 +08:00
Sanae
b14267bacf fix(llm): preserve Responses wire aliases during tool replay (#2734)
Serialize SDK responses using API field aliases and omit unset optional
fields before persisting native replay state. Repair legacy async_ fields
on a copy at replay time without altering stored history or argument JSON.

Cover streaming and non-streaming SDK continuations, alias precedence,
and legacy SQLite replay.

Co-Authored-By: GPT-6.1 Sol High
2026-12-01 21:35:29 +08:00
Jaeheon Kim
049a59123d fix(i18n): accept Korean as a backend interface language (#2785)
* fix(i18n): accept Korean as a backend interface language

The web picker offers Korean (added in #2359), but the backend UiLanguage
contract, its normalizers and the settings spec never learned "ko". Choosing
Korean and applying settings therefore fails with HTTP 422 on
PUT /api/settings/ui, and the saved language falls back to English on the
next load.

Register "ko" in the same seams Japanese used in #2213: UiLanguage and
_normalize_language() in interface_settings.py, the launch-settings
normalizer, and _LANGUAGE_CHOICES in settings_spec.py, then regenerate the
frontend API contracts. Add Korean to the existing router and launch-settings
tests, and add a registry test that fails whenever a web APP_LANGUAGES code
is missing from the backend contract.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* style: apply ruff format

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 20:00:02 +08:00
Shaikh Fardin
8a8cdf785f fix(llm): force temperature 1.0 for gpt-6 and drop reasoning_effort before tools (#2446)
* fix(llm): force temperature 1.0 for gpt-6 and treat reasoning_effort+tools rejection as tool-schema unsupported

* fix(llm): drop reasoning_effort instead of tools when combined request is rejected

---------

Co-authored-by: Shaikh Fardin <152140625+Fardin7798@users.noreply.github.com>
Co-authored-by: OrdoAbChao7 <2369980241@qq.com>
2026-12-01 19:27:05 +08:00
Marcello Pichini
318619e713 fix(mastery): keep apostrophes in study ask-hints (#2851)
The sanitizer deleted every quote character to unwrap a quoted reply,
so "What's ...?" was shown as "Whats ...?". Only unwrap a matching
outer pair, as the chat and reading hints already do.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 17:51:54 +08:00
bluefateludi
c20e42fd99 fix(llm): record nested prompt cache write counts (#3108) 2026-12-01 17:26:47 +08:00
Carl
242b24beeb fix: keep chats usable after oversized tool calls (#3144)
Closes #2909.

Omit the fewest eligible historical tool-argument payloads so oversized completed exchanges remain replayable, without touching signed/native provider rounds or durable history.
2026-12-01 17:03:29 +08:00
Leoy
8b2448e293 fix(knowledge): fit uploaded names and folder segments into the 255-byte limit (#3140)
Byte-fit KB upload filenames and folder segments to NAME_MAX, and share fit_filename_bytes with attachment/reading stores.
2026-12-01 17:00:42 +08:00
Axton Ji
04eb2ac82e fix: batch indexing journal writes for per-document status updates (#3137)
IndexingRun.document() re-reads the journal and atomically rewrites the
whole .indexing-run.json on every call. The LlamaIndex loader marks each
accepted source "embedding" in a synchronous loop on the event loop, and
publication marks every loaded Document (one per page) "completed" the
same way, so recording n statuses costs O(n^2) bytes of I/O with no
await in between. On a 4,320-document reindex this held the loop for
over 100 s, /health/ready stopped answering, and the desktop supervisor
killed the core.

Add IndexingRun.documents(sources, status, **details), which applies one
status to many sources under a single ownership check and a single
journal write, and use it from the loader, the LlamaIndex publication
step and the RAG service's indexed-file callback. document() now
delegates to it, so single updates behave as before.

Fixes #3046

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 16:56:02 +08:00
iron ox
97e9ef8d44 fix(llm): omit optional replay status for custom Responses gateways (#2487)
Omit optional status on message/reasoning/function_call items when building
Responses requests for the custom binding, so gateways that reject
unknown_parameter inside an HTTP 200 stream no longer fail durable turns.
Keep the bounded HTTP-error retry for other cases.

Co-authored-by: zhouyao01 <zhouyao01@mucang.cn>
2026-12-01 14:55:05 +08:00
Alex Castillo González
12e3a8ae0d fix(llm): accept list-of-blocks content from OpenAI-compatible providers (#2795)
Mistral reasoning models return `content` as a list of typed blocks
(thinking + text). `_parse_chunks` joined those lists directly and raised
TypeError, and `_parse` / the streaming content callback passed the raw
list through. Normalise with the existing `_extract_text_content` helper.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-01 14:17:51 +08:00
crimson-gzx
f56225f9b1 fix(llm): send session-scoped prompt_cache_key on Responses API requests (#2827)
Co-authored-by: Josh Guo <crimsongzx@gmail.com>
2026-12-01 14:13:16 +08:00
Andrew Chen
da9f65b6b3 fix(voice): speak \top and \intercal superscripts as transpose (#2828) 2026-12-01 14:08:38 +08:00
Yuchuan He
25cc33e475 fix: serialize notebook manager initialization (#2744) 2026-12-01 13:55:22 +08:00
Tazeem
72ae8d4703 fix(config): use selected provider protocol after moving a model (#2759) 2026-12-01 13:55:14 +08:00
Yuchuan He
73bfa3f9e0 fix(turns): prevent duplicate replies when Stop races persistence (#3074) 2026-12-01 13:54:56 +08:00
wojiecihuo
5eae58dbc9 Merge pull request #3081 from zszz3/refactor/prompt-slimming
refactor: state each prompt rule once across playbooks, tool schemas and language packs
2026-12-01 13:13:28 +08:00
游标卡尺
8b18b7a020 feat(providers): add LiteLLM as a local OpenAI-compatible provider (#2832)
* feat(providers): add LiteLLM as a local OpenAI-compatible provider

* test(web): keep LiteLLM on the generic provider-branding fallback

---------

Co-authored-by: ZQR1101 <278034003+ZQR1101@users.noreply.github.com>
2026-12-01 13:00:40 +08:00
iQuantum
984260b3f5 fix(imagegen): prefill image models the providers still serve (#2904)
* fix(imagegen): prefill image models the providers still serve

The OpenAI image provider prefilled gpt-image-1, which OpenAI retired on 2026-10-23, and OpenRouter prefilled google/gemini-2.5-flash-image-preview, which OpenRouter no longer lists, so a user who kept the prefill got a failing first request. They now prefill gpt-image-2 and google/gemini-3.1-flash-image.

* fix(imagegen): prefill gpt-image-2.6-flare instead of gpt-image-2

OpenAI shuts gpt-image-2 down on 2027-02-10 and names gpt-image-2.6-flare or -sunburst as the replacement; its image guide recommends the 2.6 models for new integrations. Flare is the general, fast-iteration model and uses the same Images API, so the OpenAI prefill moves to it now instead of to another retiring model.
2026-12-01 11:24:22 +08:00
iQuantum
b5fb281a3e fix: default Anthropic to a Claude model Anthropic still serves (#2888)
AnthropicProvider and the agentic client's Anthropic adapter fell back to claude-sonnet-4-20250514, which Anthropic retired on 2026-06-15, so an Anthropic binding with no model failed with not_found_error. Both now use one DEFAULT_ANTHROPIC_MODEL constant, claude-sonnet-5-5.
2026-12-01 11:20:50 +08:00
zszz3
eaf23617b0 fix(prompt): reread shared fragments on cache reset and reject braces
PromptManager.clear_cache() and reload_prompts() dropped cached packs but
the fragment lru_cache kept serving the old fragments/*.yaml, so a
reloaded pack still carried the previous rule text. Both now clear it.
Fragments are checked for "{" and "}" when loaded (the expanded text can
pass through str.format()), with a test over every fragment in en and
zh. The notes capability gets a test that its en and zh instructions
include the shared maths rule.

Refs #2975
2026-12-01 11:17:29 +08:00
zszz3
d411a8542f fix(prompt): fail loudly on a broken {{shared:...}} marker
PromptManager expanded shared fragments inside the try block that guards
reading a prompt file, so an unknown fragment name was caught as a load
failure and the manager quietly served another language's pack (or {}).
A marker that does not match the lowercase name pattern, such as
{{shared:Math}}, was left in the prompt as literal text. Expansion now
runs after the read; unknown names raise KeyError and leftover markers
raise ValueError. A repo scan checks that every marker in a prompt pack
names a fragment present in both en and zh.

Refs #2975
2026-12-01 11:17:29 +08:00
zszz3
744d24a6bc refactor: state the LaTeX maths rule once as a shared prompt fragment
Chat, mastery, question FINISH and notes each carried their own copy of
the dollar-delimiter rule. They now reference {{shared:math_latex}}
(deeptutor/services/prompt/fragments), expanded by PromptManager at load
time; the notes capability expands the marker in its system.md, and
code-built prompts use shared_fragment(). The English notes prompt gains
the rule (and the mermaid line) its Chinese twin already had. The chat
loop no longer repeats the 'concise Markdown' line that runtime_policy
states.

Refs #2975
2026-12-01 11:05:06 +08:00
Rahul selvaraj
5ea8fa1ebc fix(mcp): let operators declare Fake-IP ranges for self-service servers (#2857)
* fix(mcp): let operators declare Fake-IP ranges for self-service servers

A local proxy in Fake-IP mode (Loon, Clash, Surge) answers DNS for public
hostnames with synthetic private addresses, e.g. fd27:712::/32 from Loon,
and routes the connection by hostname. Strict validation then rejects
public MCP Store entries such as GitMCP as private-network targets.

Add DEEPTUTOR_MCP_FAKE_IP_RANGES (comma separated CIDRs, opt-in, read from
the process environment). In strict mode an address a hostname resolves to
inside a declared range is no longer rejected as private. IP-literal URLs,
loopback and the link-local/metadata ranges stay blocked regardless, and
any other private answer for the same host still fails validation.

Closes #2789

Assisted-by: Claude <noreply@anthropic.com>

* fix(mcp): warn on Fake-IP opt-in and document single-user SSRF trade-offs

Address review feedback from JinhangHE126 on #2857:
Document clearly that DEEPTUTOR_MCP_FAKE_IP_RANGES relaxes hostname-based SSRF protection for hostnames resolving into declared ranges (as the proxy resolves targets and connects).
Emit a startup security warning when DEEPTUTOR_MCP_FAKE_IP_RANGES is set, noting that the setting is intended strictly for single-user/desktop installations.

Assisted-by: Gemini (Google Vertex AI)
2026-12-01 10:32:50 +08:00
Oikantik Basu
9e5a4e64c9 fix: preserve thinking-off settings on research outline retries (#3134) 2026-12-01 09:34:04 +08:00
zhang.kom
a4d1cf7499 fix: allow inferred embedding dimensions in LlamaIndex preflight (#3138) 2026-12-01 09:33:49 +08:00
wojiecihuo
76dc7e2e26 Merge pull request #3035 from zszz3/fix/chat-call-tool
fix: reach loaded tools through call_tool instead of growing tools[] mid-turn
2026-12-01 00:30:14 +08:00
Alex Castillo González
bc9a289b3f fix(llm): report token usage from the Codex OAuth provider (#2797)
OpenAICodexProvider._request_codex called consume_sse without an
on_provider_event hook and built LLMResponse without usage, so Codex turns
were counted as 0 tokens/cost. Collect the terminal usage event and attach it
to the response, as the openai_compat Responses path already does.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-01 00:26:23 +08:00
Marcello Pichini
863327af2a fix(hints): keep leading -, * and # that belong to the hint (#2852)
The composer-hint sanitizers used lstrip("-•*# ") to drop list markers,
which also ate the sign of "-3 squared...?", the star of "*args" and
the hash of "#include". Strip a marker only when whitespace follows it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 00:25:50 +08:00
Rudy Mizrahi Celekli
4ef7820b60 fix(calendar): preserve repeated-hour instants in ICS exports (#2782) 2026-12-01 00:25:38 +08:00
zszz3
12e9809a6e fix: reach loaded tools through call_tool instead of growing tools[] mid-turn
load_tools appended the loaded schema to the end of tools[]. tools[] is the
first thing in the provider's prompt-cache key, so the next request of the
same turn re-processed the system prompt and the whole history.

When the turn mounts the new call_tool builtin, load_tools now returns the
loaded tools' definitions in its result and leaves tools[] alone; the loop
forwards each call_tool call to the named tool before dispatch, so the tool
runs with its own argument checks, injected kwargs and trace, while the
history keeps the model's own call. Tools loaded this way stay proxied for
the session (loaded_tools.json gains proxied_tools). Runtime loads that must
land in tools[] pass native=True; the TypeScript engine keeps the old
behaviour.
2026-11-30 23:35:59 +08:00
Leveling
41fdf08b92 fix(rag): size the docstore count cache to the catalogue, not one KB (#2777)
A KB-list / get_info sweep probes every version-N directory of every KB,
because the UI renders readiness per version. The docstore count cache is
keyed per version directory, so its capacity has to cover the whole
catalogue, not a single KB's worth.

At the old fixed 128 slots a real installation (13 KBs, 310 version
directories -- #2772) exceeded the working set on every sweep: each probe
evicted exactly what it had just read, the hit rate stayed at a permanent
0%, and every UI navigation re-parsed every multi-MB docstore.json. On a
memory-constrained host that showed up as a pinned event loop and hundreds
of GB of disk reads.

Raise the capacity to 4096. Each entry is a path plus an int, so this costs
about a megabyte even well above the working set.

Reproduced against v1.7.3 with a fixture matching the report (13 KBs, 310
versions, 52 MiB of docstore.json), replaying inspect_kb_versions() per KB:

  before: 310 / 310 / 310 / 310 / 310 docstore parses per sweep, 0.0% hit rate
  after:  310 /   0 /   0 /   0 /   0 docstore parses per sweep, 100% warm

A rewritten docstore still invalidates correctly (doc_count 400 -> 1), and
unchanged versions stay cached. The new regression test builds 2 KBs x 100
versions, which is above the old cap, and fails on the unfixed code
(400 parses instead of 200).

Closes #2772
2026-11-30 23:21:42 +08:00
wojiecihuo
fed428e46a Merge pull request #3079 from zszz3/fix/chat-runtime-snapshots
fix: keep turn data out of the chat system prompt and drop the duplicate tool manifest
2026-11-30 23:21:32 +08:00
wojiecihuo
ccaa9fdb97 Merge pull request #3080 from zszz3/fix/pipeline-cache-layout
fix: keep per-call values out of the cached prefix in staged pipelines
2026-11-30 23:21:14 +08:00
wojiecihuo
62c383caf1 Merge pull request #3069 from zszz3/fix/reasoning-empty-tool-round
fix: send an empty reasoning_content on reasoning-less tool rounds
2026-11-30 23:20:56 +08:00
AleFlyX
fea1be2c97 Merge PR #3092: fix(rag): reuse completed BM25 sidecars on rebuild retry
Verified that the retry published the index with one BM25 write across both attempts. The simulated merge into dev passed 40 targeted tests.
2026-11-30 19:08:21 +08:00
lipeh1
681b23766f feat(rag): support local rerankers for LightRAG queries (#3009)
* feat(rag): support local rerankers for LightRAG queries

Allow administrators to select a cross-encoder alongside the native LightRAG role models. Run scoring in a reusable worker and partition cached answers by reranker so model changes take effect on existing indexes.

Refs #2701

* fix(api): refresh the router index for LightRAG settings

* fix(rag): run LightRAG reranking in the shared reranker worker

anyio's process pool re-runs the server's __main__ file by path. When the
backend runs as `python -m deeptutor_cli.main serve` (the desktop app),
that file's relative imports fail, so every rerank call failed with
'Error during worker process initialization' and LightRAG silently kept
the original chunk order. Reuse the python -m reranker worker that the
LlamaIndex pipeline already uses.

---------

Co-authored-by: lipeih <lipeihan@eazytec.com>
Co-authored-by: zszz3 <zszz3@users.noreply.github.com>
2026-11-30 18:46:49 +08:00
Frant1cc
912e8fba2d fix(pptx): resolve font fallback in PDF previews and exports (#3043)
* fix(pptx): resolve font fallback in PDF previews and exports

* test: match host path semantics in the PPTX preview fixture

---------

Co-authored-by: Qiuner <wdst3635@163.com>
2026-11-30 05:17:20 -03:00
Michael Chen
436ec67e2d fix(llm): resolve Moonshot K3 context windows (#3013) 2026-11-30 15:48:57 +08:00
Mohammad Hijjawi
50976926cc fix(voice): decode Mistral TTS audio_data instead of returning the JSON body (#2793) 2026-11-30 15:48:30 +08:00
Gaurav Dubey
8b4191b7d1 fix(rag): keep figure captions out of the chunk metadata budget (#2870)
* fix(rag): keep figure captions out of the chunk metadata budget

Figure documents carried the caption, asset ids, bbox, source locator and
absolute path in metadata that LlamaIndex counts against every chunk. A long
caption (common for CJK textbook figures) pushed the metadata past the
default 512-token chunk size, so SentenceSplitter raised "Metadata length
(...) is longer than chunk size (512)" and the whole indexing run failed.

Keep those keys on the node for citations and pixel delivery, but exclude
them from the embed and LLM metadata text. The caption is already part of
the document text, so retrieval content is unchanged.

Closes #2865

* test(rag): split sentences without NLTK in the caption budget test

The new regression test ran SentenceSplitter with its default punkt
tokenizer, which loads NLTK data. CI runners refuse that data, so the
test failed with LookupError on all Python versions. Pass a regex
sentence splitter instead. The test still fails without the loader fix.
2026-11-30 04:18:49 -03:00
Udaya Vijay Anand
593bffac0e perf(session): copy stored model turns without JSON round-trip (#2803) 2026-11-30 15:10:57 +08:00
游标卡尺
9d014a27e2 fix(session): stop existence checks from re-serializing stored model turns (#2807)
Long mastery sessions froze the event loop: every existence-only probe
(history_groups, context-builder guards) ran normalize_model_turn, which
deep-copies the whole request record via a JSON round-trip. A 121-message
session re-serialized megabytes per probe, holding the GIL long enough for
health checks to time out and the worker to be declared lost.

Extract the structural acceptance checks into _is_complete_model_turn and
add has_model_turn for existence-only sites. normalize_model_turn delegates
to the same predicate, then cleans and copies as before, so replay keeps its
full isolation. Stored records are normalize's own JSON-safe outputs, so the
predicate accepts exactly what normalize accepts on stored rows; a parity
corpus pins the shared rejections.

Fixes #2788

Co-authored-by: ZQR1101 <278034003+ZQR1101@users.noreply.github.com>
2026-11-30 15:10:40 +08:00
AleFlyX
813827448b fix: 重试知识库重建时复用已完成的 BM25 索引
变更
- 重试时校验 BM25 与当前文档存储是否匹配,缺失、截断或过期时补建。
- 覆盖旧快照、截断文件和中断后清理失败的回归场景。

验证
- 76 项 LlamaIndex 和 BM25 定向测试通过。
- 缩短超时的复现中,修复后只写一次 BM25,重试成功发布。
- Ruff 检查、格式检查和 git diff --check 通过。

Related to #2837
2026-11-30 14:57:12 +08:00
muhamedaldias
084d311302 fix(rag): skip CancelledError results in SmartRetriever.retrieve (#2981)
Co-authored-by: muhamedaldias <296670347+muhamedaldias@users.noreply.github.com>
2026-11-30 14:18:33 +08:00
qiuqianyi66
51265a568c fix(api): omit supported_reasoning_efforts instead of emitting null (#2845)
The admin serializer only sets the field when the catalog declares
`codex_supported_reasoning_levels`, but both non-admin serializers copied the
raw `.get(...)` result, which is `null` for every model that declares nothing.
The web composer guards with `supported_reasoning_efforts !== undefined` before
calling `.map`, so any ordinary account granted such a model crashed on
`/chat` — admins were unaffected, which is why a fresh home never reproduced
it (#2732, #2833).

Share one `declared_reasoning_levels` helper across the admin serializer,
`redacted_model_access`, `allowed_llm_options`, and the personal sign-in rows:
each now either emits a normalized list or omits the key.
2026-11-30 14:18:24 +08:00