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.
json-repair was closing the partial arguments and the tool then ran, so a
write could persist half a value and report success. A truncated round now
keeps the text and records one not-executed result per call.
Fixes#2713
Signed-off-by: fanjiahe <fanjiahe@mail.ustc.edu.cn>
Co-authored-by: Cursor <cursoragent@cursor.com>
The provider-side fill only adds "" once another round in the request
already carries reasoning. A thinking model that calls a tool with no
reasoning on the very first round of a turn (or on every round so far)
still got the field dropped, and DeepSeek rejected the next request.
The stream says whether the model is thinking: DeepSeek in thinking
mode sends reasoning_content (as "" when it has nothing), and never
sends the key with thinking disabled. Record that on LLMCallResult and
send the tool round back with "" when the field was declared. Providers
that never send the field get nothing added.
Refs #2976
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).
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>
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.
Remove course pages, APIs and the course_study capability. Add anchored note
threads and reviewed learning-block generation, queued and withdrawable chat
messages, quote attachments, side chats, and the calendar/favorites/navigation
updates.
Keep preview's existing backend architecture. Wire the new features through
its Python application and existing chat engine, retain legacy selected-text
requests, persist mid-turn messages in replay, and restore note context when
regenerating. Leave stored user data intact.
Validate frontend contracts, dependency boundaries, types, 1290 node tests,
840 rendered tests, lint, localization and the production build. Exercise
session/notes/API regressions, 53 chat-engine tests and 20 Python/native
integration tests with isolated runtime data.