233 Commits

Author SHA1 Message Date
Shaikh Fardin
8a8cdf785f fix(llm): force temperature 1.0 for gpt-6 and drop reasoning_effort before tools (#2446)
* fix(llm): force temperature 1.0 for gpt-6 and treat reasoning_effort+tools rejection as tool-schema unsupported

* fix(llm): drop reasoning_effort instead of tools when combined request is rejected

---------

Co-authored-by: Shaikh Fardin <152140625+Fardin7798@users.noreply.github.com>
Co-authored-by: OrdoAbChao7 <2369980241@qq.com>
2026-12-01 19:27:05 +08:00
Mohammad Hijjawi
be86dc1a9e fix(question): hold the quiz plan to the requested per-type counts (#3057)
The quiz panel sends per_type_counts (e.g. choice=3, fill_in_blank=2)
and the planner prompt asks for that exact mix, but _parse_plan only
enforced the allowed types and difficulty. A planner that returned five
choice templates produced a five-choice quiz.

Retype the surplus templates to the types that are still short, keeping
topics, order and difficulty.
2026-12-01 13:55:05 +08:00
Oikantik Basu
9e5a4e64c9 fix: preserve thinking-off settings on research outline retries (#3134) 2026-12-01 09:34:04 +08:00
zszz3
9af0606316 test: give the call_tool dispatch stub the reasoning_declared field from #3069 2026-12-01 00:02:45 +08:00
zszz3
aa72ec6bb9 fix: say why call_tool refused, and keep an opened setup mode's tools native
CallToolTool answered every unforwarded call with "load it first". That
was wrong for a tool already in tools[] (an MCP tool, a built-in) and for
malformed arguments, and for the former it sent the model round in a
loop. DeferredToolLoader.proxy_refusal now names the reason (missing
name, call_tool itself, already in the tool list, proxy off, unknown,
not loaded) and proxy_arguments checks the arguments: an object, or a
string holding valid JSON for one; anything else is refused. The
pipeline's _resolve_proxied_tool_calls and CallToolTool both go through
proxy_call_refusal, so the message matches the decision.

Setup tools loaded through load_tools are proxied. Opening setup mode
later left them proxied: not in tools[], no rules (already loaded), and
a note that never mentioned call_tool. An opened mode's tools are now
made native, like mastery's outline tools; a setup turn whose tools are
still proxied gets a hint to reach them through call_tool.

Also: call_tool is mounted only when the loader has built-in/capability
tools to proxy; its manifest order no longer duplicates load_tools'; a
forwarded call without an id is not marked for renaming.

Refs #2972
2026-11-30 23:35:59 +08:00
zszz3
12e9809a6e fix: reach loaded tools through call_tool instead of growing tools[] mid-turn
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.
2026-11-30 23:35:59 +08:00
zszz3
0670c14fcd fix: repeat the setup rules once the tools are loaded, skip them for partners
The setup protocol (confirm with ask_user before apply_setting, never
handle secrets, ...) reached the model only in the load_tools result or
the turn that opened setup mode. Once history snipping or summarisation
dropped that message, the setup tools stayed in tools[] without their
rules. A setup turn (explicit mode or an intent message) whose capability
already has tools loaded now gets the protocol repeated in its turn note,
and the intent wording says the tools are already loaded.

A partner turn refuses every setup write (setup/access.py can_write), so
the setup tools are no longer listed under Extended Tools or pointed at
by the turn note there. Non-admin users keep them: personal preferences
are still theirs to change.

Also correct the comment about when set_deferral_available runs:
is_active is already asked by the exclusive-capability checks before it.

Refs #2972
2026-11-30 23:35:08 +08:00
zszz3
034b2b747b fix: leave the research module alone when it is not installed
The deferred-tool notes imported deeptutor.tools.research_tools on every
turn that had local deferred tools, so a minimal install (setup tools
deferred, no research module) failed the chat turn with
ModuleNotFoundError. Import it only when the research module is enabled,
as the rest of the pipeline already does.

Refs #2972
2026-11-30 23:35:08 +08:00
zszz3
8f6875225b refactor: move setup turn notes into prompt files
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.
2026-11-30 23:35:08 +08:00
zszz3
d5ac66781f fix: keep chat tools[] and system prompt stable within a session 2026-11-30 23:35:08 +08:00
wojiecihuo
fed428e46a Merge pull request #3079 from zszz3/fix/chat-runtime-snapshots
fix: keep turn data out of the chat system prompt and drop the duplicate tool manifest
2026-11-30 23:21:32 +08:00
wojiecihuo
ccaa9fdb97 Merge pull request #3080 from zszz3/fix/pipeline-cache-layout
fix: keep per-call values out of the cached prefix in staged pipelines
2026-11-30 23:21:14 +08:00
wojiecihuo
62c383caf1 Merge pull request #3069 from zszz3/fix/reasoning-empty-tool-round
fix: send an empty reasoning_content on reasoning-less tool rounds
2026-11-30 23:20:56 +08:00
CyanPersica
b061e71d9b fix(loop): do not execute a tool call cut off by the output limit (#2719)
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>
2026-11-30 14:18:06 +08:00
zszz3
0fa26b83ed fix: retract a replayed tool list as replaced by native schemas
When a tools snapshot goes away (a session stored before native requests
dropped the text manifest, or the turn after a schema-rejection fallback),
the generic retraction said the section is now empty, which reads as "no
tools" while the request carries native schemas. The tools snapshot now
gets its own retraction text, in the Python loop and the TypeScript engine.

Refs #2973
2026-11-30 13:58:21 +08:00
zszz3
cc1da61b90 fix: keep a declared empty reasoning_content on loop tool rounds
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
2026-11-30 13:55:25 +08:00
zszz3
9c4b74deda fix: drop the inline copy of the geogebra user template
The fallback used when geogebra_user.md is missing had no "## 图片"
section, so it already differed from the file. The file ships as
package data like geogebra.md, so the agent now reads it directly and
the test checks the image section reaches the user message.

Refs #2974
2026-11-30 13:44:53 +08:00
zszz3
a5c8f53041 test: make the cache layout tests check what they claim
Two assertions could not fail: "report" in the research user message
matched other words, and the question number check passed for any digit
near the template heading. They now look for the rendered mode
(``report``) and for "#n of 3" / "第 n/3 道". The research forced-finish
docstring said tool_choice="none" while the test asserts "auto".

Refs #2974
2026-11-30 13:32:33 +08:00
zszz3
8b4bbf0c7e fix: leave a note when a forced finish round only calls a tool
The forced FINISH round keeps the loop's tools, so the model may still
call one. That call is not run, and the assistant turn added before the
repair note had empty content plus the round's reasoning or thinking
blocks. Anthropic rejects an empty text block, so the turn now carries a
short note ("Tool call not run: this round must finish.") when the round
returned tool calls and no text. Rounds that returned text are unchanged.

Refs #2974
2026-11-30 13:30:16 +08:00
zszz3
b2ab33d09c test: cover a tool call in deep_question's forced finish
The research block already tests the case where the model calls a tool
in the forced FINISH round; deep_question's _force_finish had no such
test. The new test checks that both requests carry the tools, the call
is not dispatched (no tool or tool_calls messages) and the repair note
is appended before the second attempt.

Refs #2974
2026-11-30 13:26:58 +08:00
Marcello Pichini
6b00f0109c fix: combine adjacent minute and second duration units (#2684) 2026-11-30 11:32:40 +08:00
zszz3
8819d95c21 fix: keep the loop's tools in forced final rounds
When a research block or a deep_question explore/quiz loop runs out of
rounds, the forced FINISH request was sent with no tools. Removing the
tools changes the first bytes of the request, so none of the block's
history is served from the provider cache. In a real deep_research run a
block's forced finish paid 28.6k and 279.8k uncached tokens.

The forced rounds now send the loop's tool schemas unchanged; the prompt
already tells the model to stop calling tools. tool_choice="none" is not
used because DeepSeek renders it like no tools (replayed: 1,152 cached
tokens with "none" or no tools, 14,976 with the tools left as they were).
A tool call in a forced round is not dispatched; it fails the attempt and
gets the existing repair note.

Refs #2974
2026-11-30 03:47:50 +08:00
zszz3
9412a7c435 fix: send geogebra instructions as system prompt and the question as user 2026-11-30 03:47:50 +08:00
zszz3
0261ecac1f fix: move per-block research state out of the cached system prompt 2026-11-30 03:47:50 +08:00
zszz3
df02c70dff fix: keep deep_question system prompts stable across questions and turns 2026-11-30 03:47:50 +08:00
zszz3
3e0486cd21 fix: restore the text tool manifest when a provider rejects tool schemas 2026-11-29 16:32:47 +08:00
zszz3
bf77791ee9 test: pin a byte-stable system prompt while turn data changes 2026-11-29 16:32:47 +08:00
zszz3
d9a06eafd7 fix: drop the text tool manifest when native tool schemas are sent 2026-11-29 16:32:47 +08:00
crimson-gzx
b0e78d083d fix(loop): surface provider errors when forced-finish salvage fails (#2825)
Co-authored-by: Josh Guo <crimsongzx@gmail.com>
2026-11-28 18:24:39 +08:00
zzzworm
9c6a96c2d3 fix(video): align scene narration and fit diagrams (#3014)
* fix(video): align scene narration and fit diagrams

- Refine bilingual prompts for scene-by-scene narration and visuals
- Fit and center SVG diagrams with their labels and strokes
- Improve geometry coordinate guidance and preserve layout retries

* fix(video): do not report a fitted scene graphic as overflow

The kit scales a graphic with a transform on its full-size frame, so the
scaled frame box and the SVG canvas can exceed the region while the drawing
fits. Measure HTML overflow without that transform and canvas.

---------

Co-authored-by: zzzworm <15828873+zzzworm86@user.noreply.gitee.com>
Co-authored-by: zszz3 <91608029+zszz3@users.noreply.github.com>
2026-11-28 13:51:06 +08:00
游标卡尺
69acdbd316 fix(math_animator): make the code-repair deadline configurable (#2790)
* fix(math_animator): make the code-repair deadline configurable

The render-fix loop's overall repair timeout was fixed at 180s: run_render
built CodeRetryManager without passing repair_timeout_seconds, so the knob
existed on the manager but was unreachable from settings. A long reasoning
model repairing a book animation was cancelled mid-edit at that ceiling with
no way to raise it (#2767).

Lift the deadline into a runtime setting capabilities.math_animator.repair_timeout
in main.yaml, read once in run_render through a get_math_animator_params getter
that shares the UI's coerce/clamp path. The single read site covers all three
callers (math_animator capability, visualize Manim route, book AnimationGenerator),
and an in-flight render keeps the value it started with. The apply branch only
persists when the key is present, so saving unrelated animation settings does not
shadow the loop's default (#1316 shape). Clarify both repair-timeout errors to name
the stage, the effective seconds, and that this is a local deadline rather than a
provider connection failure.

Backend only; the Settings-form field is left to a follow-up and failure-stage
diagnostics/artifact retention to #2768.

* fix(config): keep repair timeout default out of settings saves

The Settings page PUTs the full GET DTO, so exposing the runtime default caused unrelated saves to persist repair_timeout=180. Omit it until explicitly configured, cover the full round trip, and soften the timeout diagnostic.

---------

Co-authored-by: ZQR1101 <278034003+ZQR1101@users.noreply.github.com>
2026-11-27 14:46:23 +08:00
Bingxi Zhao (Frank)
4c1e000d85 release: v1.7.3
Prepare v1.7.3 notes for reading and book editing, expanded provider and
agent connections, learning records, model streams, and desktop upgrades.

Sync README prose and 11 translations, archive older release notes, and
update the package version. Resolve release lint/type blockers with explicit
parser and capability contracts, compatible Book call forwarding, accurate
auth task types, and quoted SQLite schema identifiers. Cover positional Book
calls and quoted legacy columns; align KB seed tests with visible retrieval
failure reporting. Keep HTTP fixtures independent of host proxies and translate
new Portuguese UI copy.

Release notes: assets/releases/ver1-7-3.md
2026-11-16 02:17:36 +08:00
Bingxi Zhao (Frank)
18e491d346 fix(rag): surface IMA content restrictions and seed retrieval failures 2026-11-15 01:04:25 +08:00
Bingxi Zhao (Frank)
b266d1a14d fix(chat): preserve sent history snapshots for prompt cache reuse 2026-11-15 01:00:14 +08:00
Bingxi Zhao (Frank)
e0872716f0 fix(runtime): announce input waits and reject oversized history plans
Local dev repairs for #2387, #2433, #2496. Regression checks cover reported symptoms and compatibility boundaries.
2026-11-15 00:44:09 +08:00
Bingxi Zhao (Frank)
6c1e3b6e60 Merge PR #2549: fix(llm): map Anthropic context-window, refusal and stop_sequence stop reasons
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).
2026-11-14 23:09:35 +08:00
Bingxi Zhao (Frank)
68106fb79a Merge PR #2670: fix(loop): keep the workspace system note byte-stable across turns (#2621)
Sort the regression-test imports and apply targeted formatting; integrated workspace-note suite passed.
2026-11-14 23:04:53 +08:00
Bingxi Zhao (Frank)
47e4c33c90 Merge PR #2493: fix(runtime): separate indexless streamed tool calls 2026-11-14 23:00:46 +08:00
Bingxi Zhao (Frank)
16cc590b63 Merge PR #2564: feat(chat): per-conversation reasoning-effort selector in the composer (#641) 2026-11-14 23:00:04 +08:00
Bingxi Zhao (Frank)
a76b429dcb Merge PR #2530: fix(agents): a math animator visual review with no verdict says so (#1202) 2026-11-14 22:58:00 +08:00
Bingxi Zhao (Frank)
abb81a9e3e Merge PR #2517: fix(question): retry tool summarizer without stream_options when provider rejects it 2026-11-14 22:58:00 +08:00
Bingxi Zhao (Frank)
b2a28aed1c Merge PR #2677: fix(agents): reject JSON drafts inside unfinished reasoning 2026-11-14 22:52:56 +08:00
Pengyi
113b697f19 fix(agents): reject JSON drafts inside unfinished reasoning
Signed-off-by: Pengyi <pengpengyi92@users.noreply.github.com>
2026-11-14 02:54:22 +08:00
mpichini1
6bf7c631e4 fix: preserve PageIndex sources in report citations 2026-11-13 19:49:05 +01:00
wmym
d4a9f88292 fix(loop): keep the workspace system note byte-stable across turns (#2621)
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.
2026-11-14 00:48:42 +08:00
Alex Castillo
f4566a3769 fix(llm): keep a full input context out of the output-truncation recovery
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>
2026-11-10 11:52:13 -04:00
evan188199-tech
3b1730d758 feat(chat): per-conversation reasoning-effort selector in the composer (#641)
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.
2026-11-09 20:47:08 +08:00
ZQR1101
17d05d6514 fix(agents): a math animator visual review with no verdict says so (#1202) 2026-11-09 10:28:24 +08:00
Alex Castillo
354c01f43e fix(question): retry tool summarizer without stream_options when provider rejects it
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>
2026-11-07 14:54:00 -04:00
KaiChan
fefa6c0437 fix(runtime): isolate indexless streamed tool calls 2026-11-06 19:16:02 +08:00