56 Commits

Author SHA1 Message Date
Leveling
9bed004617 test(parsing): stop racing interpreter startup in the MinerU lifecycle checks (#3089)
* test(parsing): stop racing interpreter startup in the MinerU lifecycle checks

The Windows `import-check` job flakes on `dev`. It failed at 2026-11-30 03:12
and 03:32 on `79a66cb3` and `6b00f010`, passed on the same step 90 minutes
later in another run, and passed on `218dbe31` the evening before. Nothing
between those runs touched `.github/`, `tests/services/parsing/`,
`tests/runtime/` or the MinerU engine, so the workflow and the code under test
were identical in the green and red runs.

Reproduced, and the cause is a timing premise in the tests, not the runner.

The race
--------

`test_deadline_and_cancellation_settle_the_owned_tree[True]` sets
`timeout=0.8` and only cancels once the fixture child has spawned a grandchild
and written `child.pid`:

    def check():
        if cancelled and list(...glob(".../child.pid")):
            raise IndexingCancelled(...)

`local.py` starts its clock before `cli_process()`, which on Windows creates a
Job Object, spawns a suspended interpreter, resumes it and queries its threads.
That work plus two more interpreter startups has to fit inside the same 0.8s.
When it does not, the deadline wins before the marker exists and the assertion
reports `TIMEOUT is not CANCELLED`.

Measured on an idle machine the marker lands in 0.067-0.085s, so the margin
looked comfortable. Delaying only the child's first write, with no CPU
contention at all:

    startup delay | result    | expected  | verdict
         0.0s     | cancelled | cancelled | pass
         0.5s     | cancelled | cancelled | pass
         0.7s     | timeout   | cancelled | FAIL
         0.9s     | timeout   | cancelled | FAIL
         1.2s     | timeout   | cancelled | FAIL

CPU contention alone reproduced the same signature
`assert <LocalParseReason.TIMEOUT> is <LocalParseReason.CANCELLED>` at line 138,
plus `assert 2.087 < 2` and `assert 3.757 < 1.5` on neighbouring cases.

The production ordering is correct and is left alone: `run.check()` is
evaluated before the deadline comparison, so an available cancellation always
wins. What the tests must not do is depend on how fast the runner started a
Python interpreter.

What changed
------------

- `_await_marker()` waits for a fixture marker with a real timeout and a
  message that distinguishes "the CLI never started" from "the runner was
  slow". Bare `(path,) = glob(...)` unpacking turned both into
  `ValueError: not enough values to unpack (expected 1, got 0)`, which is what
  made these CI failures unreadable.
- The cancellation case waits for the recorded child before raising, so the
  interruption is decided by policy rather than by interpreter startup. A 3s
  startup delay now passes where 0.7s used to fail.
- Wall-clock bounds that were only guarding "did not wait for the descendant"
  were widened off the interpreter-startup budget (`elapsed < 2` -> `< 15`,
  `elapsed < 1.5` -> `< 10`, `elapsed < 2.5` -> `< 15`). The idle-threshold and
  deadline assertions that carry the actual meaning are unchanged.
- `_await_settled()` treats `psutil.AccessDenied` as "not settled yet" instead
  of raising mid-test.
- The decoy process in `test_parent_exit_does_not_wait_for_descendant_stdout`
  lives 120s instead of 10s, so a slow run cannot make it die of old age and be
  reported as "cleanup touched an unrelated process".
- `test_detached_venv_launcher_has_no_console` asserts the marker exists before
  reading it, instead of raising `FileNotFoundError` after its 15s wait.

Observability
-------------

The Windows step now runs with `-rA --durations=15`. Without them the job
reported only "Process completed with exit code 1" with no test name, which is
why these failures needed a local reproduction to attribute.

Verification
------------

- `pytest -q -rA --durations=15 tests/services/parsing/test_mineru_process_lifecycle.py tests/runtime/test_launcher.py::test_detached_venv_launcher_has_no_console`
  -> 7 passed, 10 skipped (the skips are POSIX/Darwin-only cases).
- Deliberate-startup-delay harness: 0.0/0.5/0.9/1.5/3.0s all report
  `cancelled` after the change; 0.7s+ reported `timeout` before it.
- `ruff check` and `ruff format --check` clean on both files; workflow YAML
  parses.

No production code is changed.

* test(parsing): synchronise the deadline fixtures with grandchild startup

Addresses review on #3089. Two real defects:

1. The deadline case of test_deadline_and_cancellation_settle_the_owned_tree
   still raced. Only the cancellation branch waited for `child.pid`; the
   deadline branch killed the fixture at 0.8s and then read a marker that was
   never written, so a 1.3s startup delay produced `TIMEOUT` and then a failed
   marker read. Both branches now synchronise through `check()`: it waits for
   the recorded grandchild and only then either raises (cancellation) or returns
   and lets the deadline comparison run. The timeout assertion is preserved.

   test_explicit_client_timeout_also_bounds_parent_runtime had the same shape —
   it read `deadline.txt` after a 1.2s kill. The record is written before the
   child parks, so it exists whenever the child started at all, and the read now
   reports "CLI did not start" instead of an unpacking error.

2. test_parent_exit_does_not_wait_for_descendant_stdout had lost its teeth: the
   new 10s bound exceeded the grandchild's 2s sleep, so an implementation that
   waited for inherited stdout could finish inside the bound and pass. The
   grandchild now lives 60s and the bound is 20s, derived from the fixture, so
   waiting for it fails the test again.

Verified with a 1.3s pre-startup delay (the reviewer's repro): both lifecycle
cases report the expected reason and the tree is settled. 0.0/1.3/2.0/3.0s all
pass. `7 passed, 10 skipped`; ruff clean.

* test: wait for the MinerU deadline record before enforcing the timeout

---------

Co-authored-by: Qiuner <wdst3635@163.com>
2026-11-30 05:55:09 -03:00
Bingxi Zhao (Frank)
823aa1a8b3 Validate launcher, retrieval, migration, and responsive reader behavior 2026-11-06 02:04:53 +08:00
Bingxi Zhao (Frank)
c831786f9a Merge #2306 from iSanae233 2026-11-06 02:04:52 +08:00
Antonio-Faure
db30952722 ci: cancel superseded runs for the same PR or branch 2026-11-02 23:09:54 +01:00
Antonio-Faure
a7703bd3c7 ci: cancel superseded runs for the same PR or branch 2026-11-02 23:04:51 +01:00
iSanae233
2c5f844906 fix(desktop): address build dependency advisories
Override vulnerable ASAR dependencies and extend desktop shell checks to macOS runners.

Co-Authored-By: GPT-6 Astra <noreply@openai.com>
2026-11-01 20:35:44 +08:00
Bingxi Zhao (Frank)
ce4380f3e7 feat(desktop): add Intel Mac and Windows editions with platform builds 2026-10-30 07:20:55 +08:00
Bingxi Zhao (Frank)
a4fa63b6e2 feat(desktop): add Open DeepTutor for macOS under apps/desktop
Move the Electron macOS app into the main repository and ship it with every
DeepTutor release.

- apps/desktop: Electron shell that installs a signed bundled runtime and
  hosts the web UI; versioned with the bundled core.
- White app icon with the black DeepTutor mark, generated by
  scripts/make-icon.swift; redesigned start screen and title bar.
- Shell copy in en/zh/de/fr/pl/uk, starting in English and following the
  interface language and theme from DeepTutor Settings, including live changes.
- Web UI labels itself "Open DeepTutor MacOS v<version>" inside the app
  (user-agent marker) and "Open DeepTutor Web v<version>" in a browser.
- Sealing refuses a missing or mismatched signing key instead of silently
  generating a new one.
- desktop-release.yml builds, smoke-tests and attaches the DMG to each
  GitHub Release; Developer ID signing and notarization run when secrets exist.
- tests.yml runs the shell checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 19:20:15 +08:00
Bingxi Zhao (Frank)
fbab59acbf feat: modularize installation and enforce feature dependency boundaries 2026-10-28 01:02:29 +08:00
Bingxi Zhao (Frank)
e38a1f63a1 fix(video-lesson): isolate rendering without requiring Docker 2026-10-27 03:43:53 +08:00
Bingxi Zhao (Frank)
9237139fb8 fix(video-lesson): isolate render checks and clean up cancelled processes 2026-10-27 01:46:42 +08:00
Bingxi Zhao (Frank)
9470720a00 fix(ci): validate preview on supported Linux runners 2026-10-27 01:39:54 +08:00
Bingxi Zhao (Frank)
6bbcc00c55 Merge dev into preview, preserving preview features
Integrate dev fixes with preview's Python/TypeScript schedulers, chat queue, learning navigation, and live turn persistence.
2026-10-27 01:16:58 +08:00
Bingxi Zhao (Frank)
c812cbffd5 test(parsing): verify MinerU process cleanup on Windows (#1903) 2026-10-19 03:29:21 +08:00
Bingxi Zhao (Frank)
399297e7f0 feat: preserve TypeScript engine migration and workspace updates 2026-10-18 23:09:10 +08:00
Renn F
dbd270cfdb feat(api): add opt-in fastapi-guard request screening
Add an off-by-default `security_guard` setting (system.json, with
DEEPTUTOR_GUARD_* deployment overrides) that mounts fastapi-guard's
pure-ASGI middleware in front of the routers: per-address rate limit,
IP allow/deny lists, ban list and an attack-pattern scan of path, query
and headers. Request bodies, WebSocket handshakes, Redis, CORS and
security headers are left alone.

The guard is added before the access-log and CORS middlewares so CORS
stays outermost and 429/403 responses carry CORS headers. When disabled
the package is never imported. When enabled without the package the
backend fails at startup with an install hint. fastapi-guard ships as
the optional `guard` extra (requirements/guard.txt, DEEPTUTOR_EXTRAS).
2026-10-16 16:24:52 +02:00
NoxsMedia
de483d6554 chore(lightrag): upgrade native SDK to 1.5.7 2026-09-06 15:02:43 +00:00
Bingxi Zhao (Frank)
04040a2c06 release: v1.6.5
Ship a content workspace you choose, one exec tool for every language,
Mastery Path modes that gate its tools, and Settings that grades
readiness instead of listing faults.

Release notes: assets/releases/ver1-6-5.md
2026-09-06 13:46:29 +08:00
evan188199-tech
fdd4048799 fix(ci): restore dev release checks (#1201)
Co-authored-by: XZH <cto@xzh.ai>
2026-09-03 14:48:24 +08:00
Bingxi Zhao (Frank)
93df3d48b7 release: v1.6.4
Ship lighter isolated runtimes, richer Books and Mastery flows,
Reading/session polish, and explicit model API capabilities.

Release notes: assets/releases/ver1-6-4.md
2026-09-03 01:38:54 +08:00
Bingxi Zhao (Frank)
fc39543bc0 feat: integrate frontend backend and canonical routes 2026-09-01 22:24:29 +08:00
Bingxi Zhao (Frank)
02ba56793e chore: checkpoint backend stabilization workspace 2026-09-01 21:28:15 +08:00
Bingxi Zhao (Frank)
23a5e0601d chore(web): enforce v2 frontend release gates 2026-09-01 21:18:47 +08:00
Bingxi Zhao (Frank)
e1ca8f65dc test(web): verify turn UX across four workers 2026-09-01 20:23:05 +08:00
Bingxi Zhao (Frank)
a36e902c38 feat(web): generate typed backend contracts 2026-09-01 17:06:01 +08:00
Bingxi Zhao (Frank)
e56cc8464c test(web): add rendered component test harness 2026-09-01 16:18:33 +08:00
Bingxi Zhao (Frank)
9804015ab1 chore(web): make frontend checks deterministic 2026-09-01 16:01:31 +08:00
Codex
54817e3149 Test optional LightRAG SDK in Python 3.12 CI 2026-08-28 23:18:46 +00:00
Bingxi Zhao (Frank)
38b056fced ci: run eslint on the frontend
The web job ran the node tests but never linted, so #921 merged with two real
React violations in it — a predicate named like a hook, which tripped
rules-of-hooks, and a synchronous setState inside an effect. Both were invisible
to every gate the repo had.

Errors only: `npx eslint .` exits 0 on the 79 warnings the tree still carries
(i18n literals, next/image suggestions), so this starts catching the class of
bug that just slipped through without demanding an unrelated cleanup first.
2026-08-20 01:46:19 +08:00
Bingxi Zhao
0c51fe0c6b test: restore CI baseline contracts (#878)
Restore Ruff formatting, whitespace-tolerant source contracts, and a deterministic CI model catalog.
2026-08-16 22:39:47 +08:00
Bingxi Zhao (Frank)
5b2a0226c2 ci(lint): pin ruff to 0.16.0 and format office SKILL.md code blocks
CI installed ruff unpinned; 0.16.0 promoted markdown code-block formatting out
of preview, so `ruff format --check .` began flagging the Python snippets in the
docx/pdf/pptx/xlsx skill docs — code that had not changed since v1.5.3 (its green
CI predated the ruff bump).

Pin the CI ruff to 0.16.0 (matching local dev) so the gate can't drift on an
unpinned upstream release, and reformat the four SKILL.md code blocks — pure
layout only (split compound statements, normalize inline-comment spacing, blank
line after imports) — so the gate is green again.
2026-07-24 16:29:30 +08:00
Bingxi Zhao (Frank)
46093e5e2b update msg 2026-06-11 20:03:34 +08:00
Bingxi Zhao (Frank)
3d5c3a1eb5 improve chat 2026-05-12 02:20:30 +08:00
Bingxi Zhao (Frank)
85779c846b refactor env settings and installation 2026-05-11 12:59:56 +08:00
Bingxi Zhao (Frank)
0b059858c2 fix lint 2026-05-01 01:45:27 +08:00
Bingxi Zhao (Frank)
824bf778df fix: lint & logging system 2026-05-01 01:39:08 +08:00
Bingxi Zhao (Frank)
b7307e999f fix test 2026-04-20 20:12:33 +08:00
Bingxi Zhao (Frank)
12b615c620 fix: smoke test 2026-04-20 20:08:26 +08:00
Bingxi Zhao (Frank)
9f79945788 fix(ci): create minimal main.yaml for smoke tests
The smoke test job fails because router modules load main.yaml at
import time, but CI has no data/user/settings directory. Add a setup
step that writes a minimal config so pytest collection succeeds.

Made-with: Cursor
2026-04-07 11:18:30 +08:00
Bingxi Zhao (Frank)
2d7024bab2 fix: python version 2026-04-07 11:03:50 +08:00
Bingxi Zhao (Frank)
c15e22a4b3 chore: stable fix, add tutorbot 2026-03-20 20:27:17 +08:00
Bingxi Zhao (Frank)
f3779138ae fix: remove lightrag and unify llm & search config 2026-03-13 23:48:49 +08:00
Scarlet Moore
6224e93092 Feature/llm hardening core slim (#52)
* Core LLM hardening (slim): essential fixes and tests only

* Add Anthropic and Local provider implementations
2026-01-29 14:08:39 +11:00
Bingxi Zhao
eec9981de6 doc: update 2026-01-18 15:47:21 +08:00
Bingxi Zhao
1e9cc6b26d fix: KB init & migrate, code structure 2026-01-18 15:30:28 +08:00
Bingxi Zhao
c1752f0512 fix: rag-provider 2026-01-18 13:52:29 +08:00
Bingxi Zhao
b3f511d45f feat: enhance RAG pipeline with Docling support and improve CI/CD workflows 2026-01-18 12:25:45 +08:00
Bingxi Zhao
5a546b53f6 feat: enhance RAG pipeline with Docling support and improve CI/CD workflows 2026-01-18 12:25:45 +08:00
Bingxi Zhao
fb94bc2ec3 fix lint 2026-01-15 03:34:36 +08:00
Bingxi Zhao
16bc0f4656 ver0.5.0-dev 2026-01-15 02:49:17 +08:00