* fix(embedding): do not serialize requests when batch delay is zero
The spacing lock was held around every embedding HTTP call, so concurrent indexing stayed serial even when batch_delay was 0.
Fixes#1779
* fix(embedding): treat LAN Lemonade endpoints as keyless local servers
OpenAI-compatible profiles pointed at a private Lemonade port were still required to have an API key, so LlamaIndex knowledge bases failed to initialize.
Fixes#1782
* fix(reading): keep headings that follow fenced code examples
The reader treated any line starting with the fence character as a toggle, so an example fence swallowed every later heading.
Fixes#1641
* fix(learning): hide surfaces a learner account cannot use
The auth status already returned the learning policy, but the sidebar ignored it, and model options answered 403 for those accounts.
Fixes#1222
* fix: three bug fixes - embedding local keyless, qwen3-instruct enable_thinking, embedding concurrency lock
- fix#1782: embedding resolver now applies sk-no-key-required fallback for local providers (vllm/ollama/lemonade) matching the LLM resolver behavior; also detects local base URLs before returning 'custom' hint so keyless local endpoints (e.g. Lemonade Server on localhost) are classified as local
- fix#1796: exclude -Instruct model variants from qwen3 enable_thinking pattern matching; Qwen3-Instruct/Qwen3-VL-Instruct models reject enable_thinking parameter (provider error 20015)
- fix#1779: global spacing lock no longer held across HTTP embed calls when batch_delay=0, restoring concurrent embedding; lock now only guards the minimum-interval wait and timestamp update; removed redundant post-batch delay; applied same fix to embed_contents
* fix(reading): respect fence indentation and verify learner navigation
* fix(embedding): share start pacing without serializing requests
* fix(embedding): preserve local endpoint protocols across inference
---------
Co-authored-by: Rockynowzzz <198366628+Rockynowzzz@users.noreply.github.com>
Co-authored-by: dajiaohuang <dajiaohuang@users.noreply.github.com>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
* fix(embedding): do not serialize requests when batch delay is zero
The spacing lock was held around every embedding HTTP call, so concurrent indexing stayed serial even when batch_delay was 0.
Fixes#1779
* fix(embedding): treat LAN Lemonade endpoints as keyless local servers
OpenAI-compatible profiles pointed at a private Lemonade port were still required to have an API key, so LlamaIndex knowledge bases failed to initialize.
Fixes#1782
* fix(reading): keep headings that follow fenced code examples
The reader treated any line starting with the fence character as a toggle, so an example fence swallowed every later heading.
Fixes#1641
* fix(learning): hide surfaces a learner account cannot use
The auth status already returned the learning policy, but the sidebar ignored it, and model options answered 403 for those accounts.
Fixes#1222
* fix(github-source): refresh unchanged sync state (#1490)
* test: freeze naive FIXED_NOW for cross-platform TZ stability (#1733)
* test: pin TZ in runtime_context date assertions for cross-timezone stability
* test: freeze naive FIXED_NOW for cross-platform TZ stability
Rework of 568c522f0 per review: datetime.now() returns a naive datetime,
so .astimezone() only attaches the host zone without shifting the calendar
date. The aware frozen clock made astimezone() convert across zones and
west-of-UTC hosts rendered the previous day. Making FIXED_NOW naive fixes
every timezone on every OS (including Windows) with no TZ env or tzset()
global-state churn; the tz-pinning fixture is reverted as unnecessary.
---------
Co-authored-by: XZH <cto@xzh.ai>
* test(partners): lock outbound dispatch timeout semantics (#1763)
_dispatch_outbound's 'except asyncio.TimeoutError: continue' is the 1s
idle-poll timeout on an empty outbound queue, not a message skip: a
cancelled Queue.get() pops nothing and a consume finishing despite the
timeout has its result returned by wait_for. Channel send timeouts are
Exception subclasses retried inside _send_with_retry (backoff 1s/2s/4s,
send_max_retries attempts) and logged on give-up. Document this on the
handler and lock it with focused tests (idle poll then deliver, send
timeout retried in-dispatch, retries exhausted after max attempts).
Co-authored-by: XZH <cto@xzh.ai>
* test: add tex_downloader/tex_chunker toolchain tests (#1748)
Co-authored-by: XZH <cto@xzh.ai>
* test(question): pin mimic websocket error-path and stdout interceptor failure contracts (#1741)
* test(question): pin mimic websocket error-path and stdout interceptor failure contracts
Failure-injection characterization tests for the two DT-22 HIGH findings on
websocket_mimic_generate: the outer error broadcast swallow and the
StdoutInterceptor terminal-write swallow (ex-TeeWrite). Pins that send/write
failures stay isolated, process stdout is always restored, and the websocket
still closes. 现状豁免 recorded in docstrings: the swallows are silent by
design today; surfacing them is a code change outside this test-only card.
* style(tests): reformat question router mimic websocket test for ruff format
---------
Co-authored-by: XZH <cto@xzh.ai>
* test(api): cover learning-records account isolation and read boundaries (#1739)
* test(api): cover learning-records account isolation and read boundaries
Regression protection for GET /api/mastery-paths/reading/records
(#1109/#1130): cross-account invisibility through the real
require_learning_surface auth stack, the 200-entry most-recent-first
activity tail, the empty-account branch, 401 on missing/invalid tokens,
405 on writes, and 400 on conflicting workspace scopes.
* test(api): fix ruff import order and formatting in learning-records tests
---------
Co-authored-by: XZH <cto@xzh.ai>
* test(reading): cover the bilingual EPUB pairing pipeline edge cases (#1738)
* test(reading): cover the bilingual EPUB pairing pipeline edge cases
* style(reading): apply ruff format to bilingual EPUB unit tests
---------
Co-authored-by: XZH <cto@xzh.ai>
* test(storage): lock file library disk-deletion failure paths (#1719)
Merge the six DT-22 regression cases (previously on a separate
test_file_library_deletion.py branch) into the existing per-module
test file, right after the delete_file / hard_delete_file sections:
- successful delete prunes now-empty parents, keeps non-empty ones
and the library root itself
- missing on-disk target is a silent no-op; hard delete still clears
the DB row when the disk file vanished out-of-band
- unlink failure is only logged (list-vs-disk inconsistency window)
- an exception while pruning parents is swallowed: file still
removed, empty dirs left behind, caller unaffected (current
behaviour pinned)
Coverage of deeptutor.services.storage.file_library: 84% -> 87%
(196-197 and 203-206 now covered). No product code changes.
Co-authored-by: XZH <cto@xzh.ai>
* test(book): cover engine stage transitions (#1718)
* test(book): cover engine stage transitions
Pin the three guarantees a long book generation depends on:
stage order with per-stage artefact persistence, single-stage failure
retry without duplicating output (exploration degrade + page-level
compile retry), and pause/resume recovery that never re-pays finished
pages. All agents and the compiler are faked — no LLM, no long tasks.
* docs: add PR evidence for book engine stage transition tests
---------
Co-authored-by: XZH <cto@xzh.ai>
* test(plugins): pin entry-point loader contract across load, isolation, duplicate and gating paths (#1740)
* test(plugins): pin entry-point loader contract across load, isolation, duplicate and gating paths
* style(plugins): format test_entrypoint_loader to satisfy ruff format
---------
Co-authored-by: XZH <cto@xzh.ai>
* test(co-writer): lock router contract for CRUD, 4xx payloads, export failures (#1768)
Coverage gap: deeptutor/api/routers/co_writer.py had 246 missing lines
(40.0%). Add tests/api/routers/test_co_writer_contract.py (40 cases):
document CRUD request/response shapes, illegal-payload 4xx handling,
export/import failure branches, edit/automark agent passthrough, and
history/tool-calls endpoints. All storage and agent work is stubbed to
tmp_path; no product code changed.
Evidence: evidence/co-writer-tests-20261003/ (40 passed on
origin/main ef2d9e5c3; no failing cases, contract currently holds).
Co-authored-by: XZH <cto@xzh.ai>
* test(session): cover pocketbase_store failure branches and pagination edges (#1773)
* test(session): cover pocketbase_store failure branches and pagination edges
* docs: add PR evidence for pocketbase_store fallback coverage
---------
Co-authored-by: XZH <cto@xzh.ai>
* test(launcher): cover lifecycle termination, port cleanup and marker corruption paths (#1769)
* test(launcher): cover lifecycle termination, port cleanup and marker corruption paths
* style(tests): sort imports in test_launcher_lifecycle to satisfy ruff I001
---------
Co-authored-by: XZH <cto@xzh.ai>
* style: apply ruff format to spine_synthesizer tests (#1750)
* test(book): cover SpineSynthesizer materialise, revise loop and fallback paths
20 offline cases over the spine_synthesizer seams the LLM-call test does
not reach: payload-to-chapter/graph materialisation, the draft-critique-
revise loop with on_round events, unusable-output fallbacks, and the
deterministic invariants (count, order, clamping). Module coverage
14.0% -> 94%. All LLM traffic is replayed via BaseAgent.stream_llm; each
test seeds its own agents.yaml home so no runtime install is required.
* style: apply ruff format to spine_synthesizer tests
* docs: add PR evidence for spine_synthesizer coverage
---------
Co-authored-by: XZH <cto@xzh.ai>
* chore(tests): keep regression coverage without internal audit artifacts
* fix(llm): avoid tokenizing image payloads in request fingerprints (#1712)
* perf(llm): deduplicate repeated inline user images per request (#1714)
* perf(llm): deduplicate repeated inline user images per request
* fix(llm): preserve image fallback and stable replay references
* fix(learning): prevent compounding SRS lapses during multi-turn qualitative repairs (#1781) (#1794)
* fix(mastery-path): allow editing legacy objective counts (#1790)
* fix(crawler): ignore absurd robots.txt crawl-delay values (#1787)
A hostile robots.txt could park every request to a host (and the shared
per-host pace lock) on one unbounded sleep; delays beyond 60s are now
treated as "no directive" and the default interval applies instead
(RFC 9309 lets crawlers cap unreasonable values).
* fix: decode escaped emoji in ask_user cards as real characters (#1780)
decode_escaped_unicode_for_display repairs double-encoded \uXXXX runs
(#973) with the unicode_escape codec, which turns a surrogate-pair escape
for an emoji into two lone surrogates instead of one emoji. The
result cannot be encoded as UTF-8, so an ask_user card or mastery question
whose escaped text contains an emoji fails when the event is persisted to
SQLite or sent over the WebSocket.
Decode each run as a JSON string instead, matching the web decoder's
JSON.parse, and leave runs with an unpaired surrogate escaped.
* fix(services): surface fsync failures in atomic writers as rate-limited warnings (#1751)
Co-authored-by: XZH <cto@xzh.ai>
* fix(partners): stop telegram typing loop for denied senders and dropped media-group stragglers (#1746)
* test(partners): telegram message parsing, chunking and typing contract suite
Red-first coverage for deeptutor/partners/channels/telegram.py (coverage
gap: 418 missing / 30.2%). 28 green tests pin current behavior; 2 red
tests encode real defects for a fix card:
1. media-group straggler arriving while _flush_media_group dispatches is
buffered but never flushed (message dropped, buffer leaks)
2. typing indicator for an ACL-denied sender runs forever
No product code changed. Evidence in evidence/telegram-tests-20261003/.
* fix(partners): stop telegram typing loop for denied senders and dropped media-group stragglers
- start the typing indicator only for senders passing is_allowed: a
denied sender never receives a reply, so the 4-second send_chat_action
loop used to run until channel restart
- release the media-group task slot before dispatching the buffered
album, so a straggler item arriving mid-dispatch schedules its own
follow-up flush instead of being silently dropped (and leaking its
buffer); the finally guard only drops the task's own registration
* test(partners): telegram suite lint polish; drop internal evidence dir
- fix ruff F541 (redundant f-string) and apply ruff format
- reword red-test docstrings: both defects are fixed on this branch
- remove evidence/telegram-tests-20261003/ (internal tracking artifacts,
kept on the v1 branch) so the tree matches upstream conventions
---------
Co-authored-by: XZH <cto@xzh.ai>
* fix(api): warn when a deferred tool's definition fails to load (#1731)
* fix(api): warn when a deferred tool's definition fails to load
build_tool_options swallowed get_definition() errors on deferred (MCP)
tools with a bare continue, so a broken tool silently vanished from
the options surface with no trace of why it was unavailable. The skip
now logs a warning naming the provider and adapter class plus the
failure reason; enumeration of the remaining tools is unchanged.
* style(api): ruff-format deferred tool definition warning changes
---------
Co-authored-by: XZH <cto@xzh.ai>
* fix(rag): classify invalid persisted index errors and include re-index steps (#1702)
* fix(rag): classify invalid persisted index errors and include re-index steps
Searching a knowledge base whose persisted vector store contains invalid
vectors (issue #440) was misclassified: the ValueError raised at index
load wraps a provider-facing "Details: ..." tail, so search_error_result
matched the embedding-provider branch first and returned
invalid_embedding_provider_response without needs_reindex, blaming the
provider instead of the damaged index.
Check the persisted-index diagnosis first, include the recorded failure
reason (which store file, which vector) in the user-facing answer, and
spell out recovery: run the knowledge base's 'Re-index' action; re-uploading
documents reuses the damaged store and cannot repair it.
* test(codebuddy): make credential fixture expiry relative to now
test_load_credentials_parses_session wrote a hard-coded expiresAt of
1791055241000 (2026-10-03 15:40:41 UTC) and asserted is_expired() is
False. Once that instant passed the assertion flipped, so the test now
fails on every Python version for every branch.
Derive expiresAt / refreshExpiresAt from time.time() so the fixture
always describes a live session, and assert against the value written.
---------
Co-authored-by: XZH <cto@xzh.ai>
* fix(knowledge): surface swallowed KB status, progress and folder-sync failures (#1706)
* fix(knowledge): make update_kb_status write failures observable
The ready-transition metadata refresh swallowed every exception
(`except Exception: pass`), and a kb_config.json persist failure
surfaced only as an opaque raise inside fire-and-forget callers, so
a lost status update left the persisted KB state stale with no
diagnostic.
- Log a warning naming the KB when the best-effort ready-transition
metadata refresh fails, instead of silently passing.
- Log an error with the KB name and status when persisting the
config fails, then re-raise so callers still receive the exception
(the write is authoritative, not best-effort).
Tests: a persist failure is logged and re-raised; a metadata refresh
failure is logged and does not propagate.
* fix(knowledge): make progress WS failures visible instead of silent
The websocket_progress endpoint swallowed five failure points with
`except Exception: pass`: timestamp parsing (x2), error-frame delivery,
socket close, and user-context reset. A corrupt progress snapshot or a
broken teardown path therefore vanished without a trace.
- Share a _progress_age_seconds helper for both freshness checks: narrow
the catch to (TypeError, ValueError), keep the inactive/stale fallback,
and log unparseable timestamps at warning level.
- Reuse the already-parsed snapshot age in the replay decision, so one
corrupt timestamp warns once per connection instead of once per
freshness check.
- Trace failed error-frame delivery and failed close at debug level
(usually an already-disconnected client, not a fault).
- Log a failed reset_current_user at warning level: leaking the user
context is a real fault, not a disconnect.
Tests: malformed timestamp degrades with a warning; cleanup failures are
logged and never propagate; normal disconnects stay silent.
* fix(knowledge): stop swallowing a failed reindex error-progress write
The reindex failure path wrapped its ProgressTracker ERROR update in
`except Exception: pass`, so when that write itself failed the rebuild's
failure alert disappeared and the KB progress view silently stayed stale.
Log a warning instead; the task-level error status remains authoritative.
* fix(knowledge): log folder sync state recording failures
update_folder_sync_state() swallowed per-file mtime recording errors
with 'except Exception: pass', so a file whose state could not be
recorded silently degraded the persisted sync state while last_sync
still advanced. Log the failure at WARNING and keep the un-recorded
fallback so the next scan re-syncs the file.
* test(codebuddy): make credential fixture expiry relative to now
test_load_credentials_parses_session wrote a hard-coded expiresAt of
1791055241000 (2026-10-03 15:40:41 UTC) and asserted is_expired() is
False. Once that instant passed the assertion flipped, so the test now
fails on every Python version for every branch.
Derive expiresAt / refreshExpiresAt from time.time() so the fixture
always describes a live session, and assert against the value written.
---------
Co-authored-by: XZH <cto@xzh.ai>
* fix(co-writer): keep a placeholder row and warn when DOCX table row parsing fails (#1700)
* fix(co-writer): warn and keep placeholder row when DOCX table row parsing fails
_table_to_markdown swallowed per-row cell errors with 'except Exception:
continue', silently dropping rows (e.g. malformed merged cells) from the
converted markdown. Log a warning with the table/row ordinal and keep a
placeholder row so the loss is visible in the output itself.
Use an English placeholder '(unparseable row)' so non-Chinese documents
are not polluted, and keep test imports sorted for CI.
* test(codebuddy): make credential fixture expiry relative to now
test_load_credentials_parses_session wrote a hard-coded expiresAt of
1791055241000 (2026-10-03 15:40:41 UTC) and asserted is_expired() is
False. Once that instant passed the assertion flipped, so the test now
fails on every Python version for every branch.
Derive expiresAt / refreshExpiresAt from time.time() so the fixture
always describes a live session, and assert against the value written.
---------
Co-authored-by: XZH <cto@xzh.ai>
* fix(runtime): surface launcher termination and port-kill signal failures (#1715)
_terminate and _kill_port_listeners wrapped every tree signal in
bare except-pass blocks, so a child or port listener the signals could
not reach survived shutdown with no log line to trace: zombie children
and occupied ports after restart, with nothing to investigate.
Signal delivery now goes through _signal_target, which logs each
failure at WARNING with its cause; the SIGTERM -> wait -> SIGKILL
ladder and its timeouts are unchanged. A target that is already gone
is not a failure: ESRCH from os.kill/os.killpg is treated as
terminated, and on Windows _send_tree_signal now checks taskkill's
exit code, staying quiet for its "process not found" (128) while
raising for real failures such as access denied, so the Windows path
is observable too.
Co-authored-by: XZH <cto@xzh.ai>
* fix(rag): log swallowed embedding/image progress and LightRAG meta failures (#1703)
* fix(embedding): log progress callback failures instead of swallowing them
embed/embed_contents wrapped progress_callback in 'except Exception: pass'.
A failing progress sink vanished without a trace while indexing continued,
making KB index progress untrustworthy (stalled reads with no diagnostics).
Keep the callback best-effort (embedding runs must not fail on UI feedback)
but log a warning with batch context and the underlying exception.
* fix: log image progress callback failures instead of swallowing them
_describe_one wrapped image_progress_callback in 'except Exception: pass',
so a broken progress sink silently dropped indexing progress updates with
no trace. Log a warning with completed/total context and keep the batch
running; add a focused test covering visible failure logging and
uninterrupted loading.
* fix(lightrag): warn when workspace meta.json exists but is unusable
workspace_for() swallowed OSError/ValueError when reading meta.json and
silently fell back to the path-hash workspace name, which can open an
empty store with no log trail. Missing files stay silent; unreadable or
corrupt meta now logs a warning with the path and exception type while
keeping the same fallback behavior.
* test(codebuddy): make credential fixture expiry relative to now
test_load_credentials_parses_session wrote a hard-coded expiresAt of
1791055241000 (2026-10-03 15:40:41 UTC) and asserted is_expired() is
False. Once that instant passed the assertion flipped, so the test now
fails on every Python version for every branch.
Derive expiresAt / refreshExpiresAt from time.time() so the fixture
always describes a live session, and assert against the value written.
---------
Co-authored-by: XZH <cto@xzh.ai>
* docs(tools): add tools surface guide (#1716)
Co-authored-by: XZH <cto@xzh.ai>
* docs(events): add event and progress chain guide (#1717)
Co-authored-by: XZH <cto@xzh.ai>
* feat(visualize): add Mermaid mindmap visualizer (#1295)
Co-authored-by: XZH <cto@xzh.ai>
* perf(mastery): seed fresh status before the first model call (#1713)
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
* fix(visualize): validate mindmap roots and complete translations
* test(rag): exercise current image client and portable read failures
* docs(events): distinguish handler isolation from durable replay
* test(settings): cover CLI-app model persistence end to end (#1630) (#1745)
* test(settings): apply PR #1634 draft test verbatim
Applies the exact test change from PR #1634 (codex/test/subagent-settings-draft,
fc8ef2f36) on top of dev to verify it passes without any fix commit.
* test(settings): cover CLI-app model persistence end to end (#1630)
Mounts the real SubagentSettingsEditor inside SettingsProvider with the
settings toolbar and a network-level mock backend. Verifies the three
paths from issue #1630: live model edits flush through PUT
/api/subagents/settings before POST /api/settings/apply and survive a
remount; a draft parked server-side applies even when its editor is not
mounted; a restored draft applies from the editor's page and survives a
reload.
---------
Co-authored-by: XZH <cto@xzh.ai>
* test(quiz): add QuizViewer smoke and grading interaction coverage (#1775)
Co-authored-by: XZH <cto@xzh.ai>
* test(web): smoke ChatWorkspace empty home, streaming turn, failure banner (#1767)
* test(web): smoke ChatWorkspace empty home, streaming turn, failure banner
ChatWorkspace.tsx had 0% unit coverage (DT-21 top-15 gap #2). Mount the
real surface with the ChatStateAdapter mocked at its boundary and stub
the heavy leaf components, then assert:
- empty draft renders the greeting home and bootstraps newSession()
- a first send reaches sendMessage with the composed turn config
- streamed deltas drive message-list/composer streaming flags until done
- submission failure shows the composer-adjacent error banner with a
working Resend, and the needs-review variant drops the Resend
- an unloadable URL session settles into the retryable failure state
File coverage: 0% -> 50.3% lines (476/947), 47.4% statements.
* docs(evidence): add PR draft for ChatWorkspace smoke tests
---------
Co-authored-by: XZH <cto@xzh.ai>
* test(web): cover VisualizationViewer render branches (mermaid/svg/chartjs/html/plugin/manim) (#1749)
Add web/tests/visualize/VisualizationViewer.spec.tsx with 22 vitest cases
covering the three core states (loading, render success, render-failure
fallback) plus the remaining render dispatch branches: svg sanitize/split,
chartjs parse/destroy, html iframe bridge, plugin iframe, geogebra,
unknown renderer, manim delegation, toolbar/fullscreen/code panel.
VisualizationViewer.tsx coverage: statements 1.69% -> 74.57%, branches
0% -> 50.86%, functions 0% -> 71.69%, lines 1.49% -> 61.56%.
Full suite 114 files / 493 tests green; typecheck + eslint clean.
No product code changed. Evidence: evidence/test-visualization-viewer-20261003/
Co-authored-by: XZH <cto@xzh.ai>
* test(web): smoke coverage for StandaloneComposer send gating (#1744)
Pins the composer's own state pool: empty-input guard, full submission
payload with one-shot state consumption, the isStreaming lock and its
awaitingUserReply escape hatch. ChatComposer is stubbed so the tests
exercise StandaloneComposer's decisions, not the presentation.
Covers the 0%-coverage Top-20 entry from evidence/coverage-2026-10-02.
Co-authored-by: XZH <cto@xzh.ai>
* test(web): cover the settings store and memory-graph helpers (#1710)
* test(web): cover settings store persistence and normalization
* test(web): cover memory-graph pure functions
* test(codebuddy): make credential fixture expiry relative to now
test_load_credentials_parses_session wrote a hard-coded expiresAt of
1791055241000 (2026-10-03 15:40:41 UTC) and asserted is_expired() is
False. Once that instant passed the assertion flipped, so the test now
fails on every Python version for every branch.
Derive expiresAt / refreshExpiresAt from time.time() so the fixture
always describes a live session, and assert against the value written.
---------
Co-authored-by: XZH <cto@xzh.ai>
* test(api): add contract tests for upload guards, quiz judge, reading progress, notebook and memory routers (#1709)
* test(api): lock knowledge-base upload and delete guard contracts
* test(api): unit-cover the quiz-judge WebSocket router
* test(reading): pin the reading progress API durability contract
* test(notebook): pin the question notebook API source, dedup and concurrency contract
* test(memory): cover the memory workbench router contract
* test(codebuddy): make credential fixture expiry relative to now
test_load_credentials_parses_session wrote a hard-coded expiresAt of
1791055241000 (2026-10-03 15:40:41 UTC) and asserted is_expired() is
False. Once that instant passed the assertion flipped, so the test now
fails on every Python version for every branch.
Derive expiresAt / refreshExpiresAt from time.time() so the fixture
always describes a live session, and assert against the value written.
---------
Co-authored-by: XZH <cto@xzh.ai>
* fix(courses): surface course deletion failure instead of silent redirect (#1754)
The confirm handler fired deleteCourse with void and no .catch, so a
failed delete left an unhandled rejection, gave the learner no feedback,
and still navigated away from the course page. Await the call in a
try/catch: stay on the page with a visible alert (and the dialog open
for retry) on failure, push /courses only on success, and disable the
confirm button while pending.
Co-authored-by: XZH <cto@xzh.ai>
* fix(reading): converge the mobile header and dock the selection panel (#1734)
Below 768px the reader header converges to back, title + chapter,
bookmark and more: forward moves into the more menu (also when the
workspace hosts it), the file icon yields its width, and the chapter
indicator truncates inside a bounded share of the row instead of
disappearing. The selection panel becomes a bottom card on phones:
collapsed rows for short content, a capped scrollable body for the
note editor and overflow actions, a drag handle for pull-down-to-
dismiss, and safe-area padding; the desktop popover is unchanged.
Refs #916
Co-authored-by: XZH <cto@xzh.ai>
* fix(reading): respect fence indentation and verify learner navigation
---------
Co-authored-by: Rockynowzzz <198366628+Rockynowzzz@users.noreply.github.com>
Co-authored-by: AoHanBei <dongaohan21@gmail.com>
Co-authored-by: evan188199-tech <evan188199@gmail.com>
Co-authored-by: XZH <cto@xzh.ai>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
Co-authored-by: ZyPulse <sysu2752225139@gmail.com>
Co-authored-by: OrdoAbChao <58732249+OrdoAbChao7@users.noreply.github.com>
Co-authored-by: KennySimpson <70093673+KennyMcSimpson@users.noreply.github.com>
Co-authored-by: Jinguang Gu <simongu@gmail.com>
Co-authored-by: Mohammad Hijjawi <51020382+MohammadHijjawi97@users.noreply.github.com>
* fix(embedding): log progress callback failures instead of swallowing them
embed/embed_contents wrapped progress_callback in 'except Exception: pass'.
A failing progress sink vanished without a trace while indexing continued,
making KB index progress untrustworthy (stalled reads with no diagnostics).
Keep the callback best-effort (embedding runs must not fail on UI feedback)
but log a warning with batch context and the underlying exception.
* fix: log image progress callback failures instead of swallowing them
_describe_one wrapped image_progress_callback in 'except Exception: pass',
so a broken progress sink silently dropped indexing progress updates with
no trace. Log a warning with completed/total context and keep the batch
running; add a focused test covering visible failure logging and
uninterrupted loading.
* fix(lightrag): warn when workspace meta.json exists but is unusable
workspace_for() swallowed OSError/ValueError when reading meta.json and
silently fell back to the path-hash workspace name, which can open an
empty store with no log trail. Missing files stay silent; unreadable or
corrupt meta now logs a warning with the path and exception type while
keeping the same fallback behavior.
* test(codebuddy): make credential fixture expiry relative to now
test_load_credentials_parses_session wrote a hard-coded expiresAt of
1791055241000 (2026-10-03 15:40:41 UTC) and asserted is_expired() is
False. Once that instant passed the assertion flipped, so the test now
fails on every Python version for every branch.
Derive expiresAt / refreshExpiresAt from time.time() so the fixture
always describes a live session, and assert against the value written.
---------
Co-authored-by: XZH <cto@xzh.ai>
Bind mastery drafts before their opening turn and preserve stored session modes.
Track chat duration from submission through terminal completion. Run async reading
extensions on their event loop and allow retries after cancellable timeouts.
Allow first uploads into empty LlamaIndex knowledge bases, preserve Telegram
thread routing, parse embedding Retry-After dates, and enforce robots rules and
host pacing during documentation crawls, including redirects.
Fixes#1461Fixes#1458Fixes#1451Fixes#1448Fixes#1392Fixes#1429
Refs #1435, #1412
Reuses contributions from PRs #1462, #1452 and #1403.
Co-authored-by: sjagadee <srini.jagadeesh@gmail.com>
Co-authored-by: AoHanBei <dongaohan21@gmail.com>
Co-authored-by: Gao-Chenkai <DevChenkai@outlook.com>
Partners stop being a deployment-wide admin resource and become
per-user: three nested rights (manage / use / neither) replace the
blanket admin gate on the router, each member can build and own their
own, and every person's conversations with a partner stay private to
their account. Grants keep working and now offer only admin-managed
partners. Channel runtime state moves from one directory per channel to
one per partner — copied, not moved, and only when its owner is
unambiguous — so two partners can finally run the same channel.
Around that: a knowledge base can track GitHub repositories and re-sync
their Markdown (#903); Antigravity CLI joins My Agents now that Gemini
CLI is retired (#828); personal WeChat signs in from a QR code drawn in
the browser instead of the server log (#951); a chat account can be
linked to a DeepTutor account with /link; containers re-apply the extras
they declare instead of losing them at compose down (#762); and
`deeptutor doctor` answers whether a workspace is ready to run (#959).
Reliability, largely from community PRs: embeddings survive a
rate-limited provider through key rotation, a retry budget and a global
throttle (#962); MinerU parsing and code execution work on Windows
(#844, #964); indexing fails bounded instead of hanging (#946); MinerU
page-layout blocks stop being indexed as content (#949); voice uploads
carry a MIME the transcription API accepts (#945); and reasoning effort
can be overridden per conversation (#641).
Release plumbing: notes in assets/releases/ver1-5-17.md, v1.5.13
archived, __version__ 1.5.17, README Releases row and all eleven
translations synced.
Two defects found by the release gate and fixed here:
- Six partner routes — the four channel-onboarding endpoints and both
WeChat QR endpoints — kept the _auth-only mount they had inherited
from the blanket admin gate, so any signed-in account could start a
QR login for someone else's partner and write a bot token into its
channel config. All six now declare _MANAGEABLE, and a sweep test
asserts no {partner_id} route is left ungated.
- A configured api_key became `str | list[str]` when key rotation
landed, but ten call sites pass it somewhere that takes one key; a
list would have rendered into an Authorization header verbatim.
keypool.primary_api_key reduces at each boundary.
Gates: pre-commit (all 15 hooks), ruff check + format, pytest
5276 passed, web 605 node tests, docs build.
* T028(Codex交付,ZC核验代提交): KeyPool多key轮换层(provider×model×key池·429冷却·单key兼容) · api_key/api_token字段兼容数组 · 三处接入(embedding/mineru/llm) · 图片描述gather+Semaphore并发化 · 303单测全过(含官方既有测试回归)
* FIX-EMB-429: 火山embedding 429根治(上游PR候选) · ①429重试按Retry-After等30s(滑窗等过) ②resolver从profile读batch_size/batch_delay(火山RPM极低必须限速) · 实测batch5/delay2s下语文reindex突破processing · 三key池x2冷却机制已验
* HARDEN-429: embedding限流重试1→8次+全冷却等待65s再取 · 单key池滑动窗口瞬时429不再报废数小时reindex整跑(08-22三烧教训) · 月度额度429仍8轮后raise不空转
* FIX-UNBOUND: 限流重试槽位for耗尽静默穿落到data引用 · 槽位1+max(MAX_RETRIES,10)兜住8轮限流 · t035镜像UnboundLocalError根因(逻辑走查复现)
* THROTTLE-GLOBAL: embedding跨实例全局节流锁 · 类级锁串行化'间隔+发帖'(多文档并行reindex各自client叠加超RPM=08-22历史库六烧终根因) · batch_delay升级为全局最小间隔 · 手动单发200而进程内全429的分歧由此闭合
* FIX-LOCK: 节流锁asyncio→threading · LlamaIndex _run_in_new_loop每线程新event loop,asyncio.Lock绑创建loop跨loop不互斥(根因三层剥洋葱终层) · 静态方法装饰修正 · 容器内3线程串行化实测2.01s通过
* PR-PREP: 中性化 fork 痕迹注释(中文→英文 provider 通用表述) · 上游v1.5.16已有_as_api_key数组支持,删我方重复实现保留上游版 · 测试148+86全过 · 密钥扫描分支历史+工作树双清(A类指纹0命中,B类28处=上游自带fixture)
* LINT: ruff format 6文件对齐CI(上游基线0债,全是我方引入) + import顺序修正
* FIX-CI: 图片处理块整体采纳上游v1.5.16版(_describe_image新签名+批量embed_contents) · 删越域的fork逐图并发测试(记档将来独立PR) · 592测全过
* FIX-CI: _build_openai_client合并壳与实现(上游sanitize保留+key池数组兼容) · placeholder_key改用primary_key(list哈希修复) · 889测全过
* fix(keypool): never refuse the only key
`KeyPool` is built even for a single-key config, and `next()` raised
`RuntimeError("All API keys are cooling down")` once every key was cooling.
For the common one-key setup that meant two 429s took every LLM and embedding
call down for the full 60s window — and it bypassed the rotation layer's own
429 handling entirely, since the RuntimeError surfaces before
`_KeyRotatingCompletions.create` can mark the strike and re-raise the real
provider error. `sdk_max_retries=0` had already handed retry duty to that
layer.
Cooling is a preference hint, not a circuit breaker: when everything is
cooling, return the key that recovers soonest and let the provider's own 429
surface to be retried.
The existing single-key test asserted the raise while calling itself
"keeps single key compatible" — it now pins the behaviour the name promises,
plus the soonest-recovery ordering for the multi-key case.
---------
Co-authored-by: interia <interia@interiadeMac-mini.local>
Co-authored-by: Frank <bingxizhao@novix.science>
ModelScope reads a missing `encoding_format` as `''` and refuses the request:
`encoding_format must be 'float' or 'base64', got ''`. So the probe and every
real embedding call failed for #934, while the same config worked through the
vendor SDK, which defaults the field to "float".
The report's root cause is right and its suggested fix keys off the wrong
thing. Special-casing the qwen3-embedding family reads the constraint as
belonging to the model, but it belongs to the gateway, and the gateways
disagree: SiliconFlow rejects the param when it is *present* (#651, which is
why it is omitted), ModelScope when it is *absent*. The same Qwen3-Embedding
weights are served on both sides of that disagreement, so no default and no
model-family rule can satisfy both.
Recover from the provider's own refusal instead. The happy path is
byte-identical — the param is still omitted, so every working config sends
exactly what it sent before — and a 400 that names both the parameter and the
value we are about to send earns one retry with `encoding_format="float"`.
Requiring the body to name "float" is what separates "you must send this"
from "I do not support this", so a gateway in the second camp is not retried
into the same failure. The retry is bounded by the param then being present.
Also notes at the omit site why a default must not be reintroduced there:
it would trade #934 for #651.
Adds a Gemini embedding adapter that speaks the native :batchEmbedContents endpoint, so Embedding 2's retrieval-role prompt instructions and configurable output dimensionality are available, and threads a retrieval role (query vs document) from both RAG pipelines down to the client.
The role is opt-in per adapter: Jina and the OpenAI-compatible backends keep sending exactly what they sent before, because adding a task hint changes the vectors and would invalidate indexes already built. For the same reason only Embedding 2 defaults to the native endpoint — an existing gemini-embedding-001 profile stays on the OpenAI-compatible path unless its endpoint is set to the native URL explicitly.
Also redacts credential-like query parameters from endpoint values shown in errors and diagnostics.
The aliyun binding sent every model through MultiModalEmbedding.call, so
a text model (text-embedding-v3/v4) hit the multimodal endpoint and
failed with HTTP 400 'url error'. The adapter now picks the surface from
the model id (TextEmbedding for text, MultiModalEmbedding for multimodal)
via a single shared predicate, and the resolver surfaces the true
per-model endpoint so the diagnostic no longer misreports it.
#652 added a guard so the gateway adapter only sends encoding_format when
set, but it was a no-op: EmbeddingRequest.encoding_format defaulted to the
truthy "float", so the guard always fired and the param was still posted —
leaving the #651 HTTP 400 from gateways like SiliconFlow intact.
Fix the root cause: default encoding_format to None. The gateway adapter now
omits it unless a caller explicitly opts in, while the official OpenAI SDK
path keeps pinning "float" (that API expects it). The intentional divergence
is documented at both call sites. Adds a payload test proving the gateway
omits it by default and includes it when set.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v1.3.10 added the `openai_http_client.disable_ssl_verify_enabled` helper
and applied it to the SDK paths (`openai_sdk` embedding,
`openai_compat_provider`, `azure_openai_provider`, tutorbot
`openai_compat_provider`). Five raw-httpx call sites still ignored the
flag:
- `provider_core/openai_codex_provider.py:79` hardcoded `verify=True` on
the first attempt before falling back on `CERTIFICATE_VERIFY_FAILED`.
- `embedding/adapters/openai_compatible.py:193` constructed
`httpx.AsyncClient(timeout=...)` with no `verify` kwarg.
- `embedding/adapters/jina.py:89`, `ollama.py:61`, `cohere.py:115` same.
Each site now consults the helper and passes `verify=not
disable_ssl_verify_enabled()`. The codex provider's
`CERTIFICATE_VERIFY_FAILED` retry path is preserved unchanged.
Tests:
- `tests/services/embedding/test_disable_ssl_verify.py` (5 adapter tests
+ 1 production-guard test) asserts each adapter passes `verify=False`
when the flag is set and `verify=True` otherwise.
- `tests/services/llm/test_codex_disable_ssl_verify.py` covers the
default-true case, flag-flip-to-false case, and the
retry-on-cert-failure fallback.
Embedding endpoint URLs are now transparent end-to-end: Settings shows the
exact URL DeepTutor will POST to, legacy `/v1`-style bases are migrated to
full `/embeddings` / `/api/embed` URLs, the embedding client rejects
known-provider misconfigurations early, and OpenRouter routes through the
same exact-URL HTTP adapter as other providers.
LlamaIndex RAG now refreshes embedding state before initialize/search/add,
validates persisted vectors before retrieval, and reports invalid indexes
with `needs_reindex: true` instead of raw NumPy/`NoneType` errors.
Memory refresh strips `<think>` / `<thinking>` blocks from reasoning-model
output before writing PROFILE.md / SUMMARY.md, and existing memory files
self-repair on read.
Also fixes a Deep Solve runtime regression where `MainSolver` still passed
a stale `attachments` keyword to `SolverAgent.process()`.
Adds release notes (assets/releases/ver1-3-2.md) and updates README.
Made-with: Cursor
Stability release after v1.3.0 covering safer RAG/KB routing, stronger
embedding validation, more reliable Docker/TutorBot restarts, Web UX
fixes, and Windows/encoding hardening. See assets/releases/ver1-3-1.md
for the full notes.
Made-with: Cursor
Generalises #368: adds an explicit per-model `send_dimensions` opt-in
exposed as a Settings UI toggle and an EMBEDDING_SEND_DIMENSIONS env var.
Tri-state semantics:
true -> always send (user knows their provider supports it)
false -> never send (e.g. Qwen text-embedding-v4 via litellm gateway
which returns HTTP 400 when `dimensions` is sent)
unset -> fall back to the text-embedding-3* heuristic from #368
Backend:
- Adapter base accepts `send_dimensions`; OpenAI-compatible adapter
decides via `_should_send_dimensions(model)` (replaces the hardcoded
startswith check from #368).
- ResolvedEmbeddingConfig / EmbeddingConfig carry the flag through.
- EnvStore reads/writes EMBEDDING_SEND_DIMENSIONS, dropping the line
entirely when empty so legacy `.env` files keep the Auto behaviour.
- ModelCatalogService syncs the flag from .env back into the catalog.
Frontend:
- Settings page shows a "Send dimensions" checkbox next to Dimension,
with an instant CSS-only info tooltip (replaces native `title` to
avoid the browser's ~1s delay). Disabling the toggle greys out the
Dimension input.
- New models default to send_dimensions=true.
- en/zh i18n strings added.
Tests (46 new cases, including the unit tests #368 marked added but
did not actually ship):
- adapter `_should_send_dimensions` tri-state + parametrized non-3 family
- httpx-mocked payload assertions for all four combinations
- runtime resolver: catalog wins over env, garbage values -> None
- env_store helpers + render_from_catalog + write skip-empty round-trip
- EmbeddingClient propagates the flag to the adapter config dict
Made-with: Cursor
Fixes#346
When an embedding provider returns null for a chunk's embedding vector,
the None value gets stored in the vector index and causes a TypeError
in LlamaIndex's similarity computation (np.dot with NoneType).
Two-layer fix:
1. _extract_embeddings_from_response: use 'or []' instead of
get(key, default) so explicit None values are caught.
2. CustomEmbedding._get_text_embeddings: validate the batch result
and replace any None vectors with zero vectors.
Co-authored-by: kagura-agent <kagura-agent@users.noreply.github.com>