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.
SetupCapability.turn_note and the legacy setup system block now read the
header, gap-list heading, intro section and explicit/intent/intro leads from
capabilities/setup/prompts/{en,zh}/notes.yaml (overridable under
setup.notes.<key>); the intro section gains a Chinese version. The Extended
Tools manifest header no longer says every entry is supplied by an external
service, since built-in setup and research tools are listed there too.
* 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>
* fix: keep mastery prompt prefix stable across mode switches
* fix: load the outline tools together when a turn switches to outline
A study turn that switched to outline loaded mastery_build alone through load_tools; the next turn, in outline mode, mounts every outline tool eagerly, so its tools[] carried one schema more than the previous request and missed the whole cached prefix. The mode switch now loads the outline group into the live request at once. Refs #2922
* fix: close loaded tool schemas the same way as mounted ones
Mounted schemas go out with additionalProperties: false; a tool loaded through load_tools did not, so the same tool had two byte forms in tools[]. A tool that moved between mounted and loaded across turns (mastery_build/mastery_revise after an outline->study switch) rewrote the start of the cached prefix. Refs #2922
* fix: keep the outline tools on the deferred loader in outline mode too
Outline mode mounted mastery_build/mastery_revise eagerly and skipped the
loader, while study and review reached them through it. On an install with
no other deferred tool that also dropped load_tools on outline turns, so
tools[] changed in both directions around every switch. Refs #2922
* fix: mount mastery navigation from the first mastery turn
The first mastery turn usually creates the topic; navigation mounted only
once a topic existed, so the second turn's tools[] grew by three schemas and
missed the whole cached prefix. Refs #2922
* fix: send only the current mastery mode's rules, as a runtime snapshot
The system prompt carried all three mode sections so a mode switch would
not rewrite the cached prefix, but that showed the model three conflicting
rule sets and relied on a one-line snapshot to pick one. Keep only a short
frame in the system prompt and send the current mode's own section inside
the mastery_session_mode snapshot, which is appended only when the mode
changes.
Refs #2922
* fix: keep capability tools recorded by another turn in the session's loaded set
A mastery turn records its outline tools (mastery_build, mastery_revise) in
the session's loaded_tools.json so a later study turn keeps the same tools[].
A plain chat turn of the same session builds a provider loader without
capability names; with an unrestricted caller it treated those names as
stale and persisted the set without them, so the next mastery turn mounted
fewer tools and re-paid the cached prefix.
DeferredToolLoader now keeps names it cannot serve (registered tools it does
not own, or names outside its allowlist) as retained: never mounted or
reported, but written back with the session state. Only names whose tool is
gone from the registry are dropped.
Refs #2922
Local dev repairs for #2168, #2631.
Real child-process recovery: 16 tests passed, including queued, running, waiting_input, process exit and PID reuse. Existing coordination/application tests: 65 passed, 10 optional Redis skips.
`mastery_status` receives `_working_brief` from the mastery loop
(capabilities/mastery/loop.py:436) and reads it as a trusted switch for
whether to project the working brief (capabilities/mastery/tools.py:915).
It was not in RESERVED_ARGUMENT_NAMES, so a model could send
`_working_brief: false` and the tool would honour it.
Same class as `_learner_message`: an injected name treated as fact while
the model can write it. Caught on a later audit pass rather than by any
test, which is the argument for the follow-up in #2610.
`_`-prefixed names reach tools as provenance: `_learner_message` is the
learner's own words, `_sandbox_mounts` is where the turn may write,
`_turn_id` is which turn produced the call. A few of them gate credit or
sandbox access.
Nothing enforced that on the way in. A model emits arbitrary JSON and the
dispatch path never rejected a name it did not expect, so a model could
write `_learner_message` itself and have a built-in tool believe it. That
is how `mastery_grade` came to accept a model-authored answer as grounds
to overwrite a committed learner answer (#2595).
Withhold a fixed list of the names the runtime injects, at bind time,
before the augmenter runs. Adapter arguments outside that list are left
alone, so an MCP server publishing `_id` keeps working.
Also record the filtered arguments rather than the raw JSON. `_rebind`
replays the recording straight into the augmenter, so keeping the raw one
let any round containing a rebinding tool — `ask_user` and
`workspace_export` always qualify — re-admit a forged name the first bind
had already dropped.
Use CREATE_NO_WINDOW so the venv redirector interpreter inherits a hidden console. Preserve the separate process group and update the Windows launch regression. Fixes#2421.
Co-Authored-By: Codex <noreply@openai.com>
Keep learner-facing explanations visible across finish checks, persistence, and replay. Remove mastery prose heuristics and prioritize learner objections.
Coordinate service shutdown and descendant cleanup, and preserve video lesson identity and playable results across chat completion and reload.
* fix: log singleton reset failures instead of swallowing them
_reset_runtime_singletons() (deeptutor_cli/init_cmd.py and
deeptutor/runtime/launcher.py) swallowed every exception while dropping
cached PathService/RuntimeSettings/ModelCatalog singletons. A failed
PathService reset leaves the previous home's cached paths in place, so
deeptutor init --home / launcher start silently keep writing into the
old workspace. Log PathService failures at ERROR and cache-clear
failures at WARNING so the misdirection is observable.
* fix(launcher): log handoff failure when mark_failed fails too
_handoff_pending_update wrapped the fallback store.mark_failed in a bare
'except Exception: pass'. When the handoff itself failed and recording
the failure failed again (corrupt state, IO error), the launcher shut
down with no persistent trace of either error. Keep the minimal fix:
emit a fallback log naming the update job, the handoff error and the
recording error before returning False.
* fix(update): log and skip recovery when job state is unreadable
The update worker's recovery path wrapped store.load() in a bare
except-pass: with a corrupt state.json the failed-update bookkeeping and
the app restore were skipped silently, leaving the job stuck and no
trace in worker.log. Load failures now append a durable record (load
error plus the original failure) to the store log and skip the round
without touching the damaged state.
* 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>
_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>
Native LightRAG role models: extraction, keyword, query and vision each
resolve their own model, vision indexing pins a vision-capable model
instead of silently degrading, and a knowledge base records which models
and which embedding built it. A published index refuses queries after its
embedding identity changes rather than searching a foreign vector space,
and a rebuild is confirmed against the configuration it will actually
use — a stale confirmation is rejected instead of quietly rebuilding
something else. A failed publication is withdrawn, not left half-written.
PDF attachments follow the parsing engine configured for the workspace,
report the stage they are in, and a truncated answer says it was
truncated with the counters that prove it. Providers are no longer
filtered out of the embedding picker on an unverifiable capability guess:
configure the model and test it. Visualize's temperature and token budget
are settings rather than literals. Notebook evidence no longer depends on
the chat session that produced it.
See assets/releases/ver1-6-10.md for the full notes, and the README
translations for the propagated prose.
Ship folder-based workspaces and data migration, daily practice, redesigned
provider and model settings, and streaming conversation improvements.
Synchronize README translations and document the archive/permanent-delete
upgrade behavior in assets/releases/ver1-6-9.md.
Reduce initial JavaScript by deduplicating English resources and loading
animation features after hydration. Keep the existing route size budgets.
Update regression fixtures and browser audits for scoped URLs and the new
settings and learning interfaces.
* fix: handle DeepSeek reasoning budget exhaustion
* style: satisfy ruff format, the one thing CI was red on
`ruff format --check` on agent_loop.py, the Responses parser and the test
file that came with them. No behaviour change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
`ChatOrchestrator.handle()` runs the capability in its own task and only
reads the bus, so a consumer that stopped reading never reached that
task. Pressing Stop persisted the turn as cancelled while the capability
kept calling the model and running tools until it finished on its own.
A capability parked on `ask_user` was never cancelled at all: once the
turn dropped its references it was destroyed mid-await, `_run`'s cleanup
failed before `unregister_bus`, and the turn's StreamBus stayed in the
registry for the life of the process.
Cancel and await the capability task in a `finally` around the
consumption loop, the same shape `llm.factory.stream()` already uses, so
both a cancelled consumer and a stream closed early take the capability
down with them. A normal turn is unaffected: its task has finished by
the time the loop ends.