Move the context-full finish reason into the shared LLM protocol and add English and Chinese notices; test both localized warnings and provider mappings (186 passed).
The chat loop replays the workspace note as the "workspace" runtime
snapshot, which lives inside the cached prompt prefix. The note embedded
workspace.logical_output_dir — outputs/chat/<session>/<turn>/ — so its
bytes changed on every turn: the snapshot-replace logic cut the old copy
out of the middle of the rebuilt history and appended a fresh one,
invalidating the provider prompt cache on every multi-turn request
(cached-token hit rate <1%; single-turn tool loops were unaffected).
- workspace_system_note(state_turn_path=False) keeps the replayed chat
snapshot byte-identical for the whole session and points at the current
user message for the exact path instead.
- new workspace_turn_note() delivers the per-turn output folder in the
trailing user message — fresh bytes each turn, so cache-safe by
construction.
- phase-built prompts (question/research pipelines) keep embedding the
exact path via the default state_turn_path=True; their behavior is
unchanged.
- model-history reconstruction keeps an exact prefix once snapshots are
stable; new multi-turn replay tests assert byte-level prefix extension
across three consecutive turns, plus the second factor named in the
issue turns out to be a consequence of the turn-scoped snapshot and
needs no separate change.
Verified: tests/agents/chat 273 passed; tests/capabilities 739 passed;
tests/services/workspace+session 709 passed (8 failures pre-exist on the
clean tree and are unrelated); remaining tests/agents failures pre-exist.
Exclusive knowledge capabilities (obsidian, marginnote4, subagent) dropped
the whole chat built-in surface, including web_search (still shown on in
settings) and the always-on web_fetch. Add a coexisting_tools declaration
to KnowledgeCapability (default empty; the product KBs declare the web
pair), honoured in compose_enabled_tools' exclusive branch under each
tool's usual gate (user toggle / always-on / conditional flag) and the
partner builtin_whitelist, mirroring the #650 KB coexistence. The
capability's system prompt now also names what actually mounted via
coexisting_tools_block, so the model no longer disclaims mounted tools.
Fixes#2612
Signed-off-by: evan188199-tech <238371241+evan188199-tech@users.noreply.github.com>
model_context_window_exceeded mapped to "length", which the agent loop
treats as an output cap and answers with continue_truncated, resending the
same full history. Report it as context_length_exceeded instead, and have
the loop end the round with a notice.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Carry the #958 service-layer reasoning_effort override through the whole
turn contract: the core TurnRequest LLMSelection accepts the field
(validated against VALID_REASONING_EFFORTS, old two-ID payloads unchanged),
the generated web contracts are regenerated, and ChatStateAdapter's
asLLMSelection restores a legal override instead of dropping it.
The composer gains a selector beside the model picker, offering only the
levels the selected model supports (live supported_reasoning_efforts or
the provider/model tables) narrowed to the wire vocabulary, hidden when
the model has none. The choice persists on the conversation's
llm_selection, so the next send uses it without a backend restart and
other conversations are unaffected; switching models resets the override.
Precedence stays conversation override -> profile/model default ->
provider default, and the context-budget readout reports the effective
effort beside the model when one was used.
The tool-result summarizer always sent stream_options and, on providers
that reject it, only logged a warning and dropped the summary. Retry once
without stream_options, as agent_loop and labeled_step already do.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
_configured_voice compared the voice locale with _lang(language), which
folds every non-Chinese language to "en". A French lesson therefore
rejected a configured fr-FR voice and accepted an en-US one.
get_model_pricing returned the first dict key found inside the model
name, so gpt-4o-mini-2024-07-18 and openai/gpt-4o-mini matched gpt-4o
and were billed at the full model's rates. Pick the longest matching
key instead.
_parse_quiz_payload swapped the reply for the body of its first ``` fence
before parsing anything. The quiz FINISH schema asks for a bare JSON object
whose `question` is Markdown and whose coding answer is code, so that fence
is usually a code sample inside a string value. The parser decoded the
sample instead, got {}, and the question was lost: after one repair round
that hit the same parser, the learner got "[Generation failed] <topic>"
with N/A as the answer and the explanation.
Take a reply that is one complete JSON object as it is first, the order
parse_json_response already uses for the same case (#825). Wrapped replies
still go through the fence; when a fence inside a field cuts the wrapper's
body short, the first object in the whole reply is used instead.
check_layout ran headless Chrome with text=True and no encoding, so the
server decoded --dump-dom with its ANSI code page. The report quotes the
lesson's own text; on a cp936/cp932 server running outside UTF-8 mode
(as under `deeptutor start`) a lesson with non-ASCII text came back as
mojibake, the JSON no longer parsed, and the check returned None, which
callers treat as "no browser available". The layout QA silently never
ran for those lessons.
Decode the browser's output as UTF-8.
Mimic mode wrote the uploaded paper into a NamedTemporaryFile with
delete=True and handed its name to the parse service while the handle
was still open. The parse service reopens the file by path to hash it
for the parse cache, and on Windows a file held with delete-on-close
cannot be reopened, so every uploaded paper failed with
PermissionError before any engine ran. The error is not a MinerUError,
so it escaped the capability's handler.
Write the paper into a TemporaryDirectory and close it before parsing.
The directory is removed afterwards, as the temporary file was.
Video Lesson narration only ever used edge-tts, whatever TTS provider the
user configured. When the Settings provider is not Edge, speak each
sentence through synthesize_speech (so every catalog provider works:
OpenAI, a local OpenAI-compatible Kokoro/Piper server, MiniMax, ...),
decode it to PCM with ffmpeg for exact per-sentence caption offsets, join
the sentences with a short pause and encode the mp3 the player expects.
Any failure falls back to Edge for that line, then to silent captions.
Needs ffmpeg on PATH; without it the Settings path is skipped.
Narration always used the hard-coded VOICES default (en-US-AvaNeural /
zh-CN-XiaoxiaoNeural), ignoring Settings > Text-to-Speech. When the TTS
provider is Edge and its voice speaks the lesson's language, use it;
otherwise keep the default.