192 Commits

Author SHA1 Message Date
greenhand-fjm
a943eb0b1e fix(runtime): add gateway cache breakpoints to the tool loops (#3115)
The research, question and page-index loops (run_labeled_step) and the context explorer call the SDK client directly, so an anthropic/ model on OpenRouter got no cache_control breakpoint and cached nothing on any round. Move the chat loop's check into runtime/agentic/prompt_caching.py and apply it in all three places. Refs #3087.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01J2vr2J41oqPYhmpP8CzSJA
2026-12-01 21:38:18 +08:00
Qiu
fda9efa57d refactor(turns): share durable turn status classifications (#3122)
* Share durable turn status groups across application and stores

* Verify durable status groups against SQLite active lookup
2026-12-01 21:36:55 +08:00
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
crimson-gzx
f56225f9b1 fix(llm): send session-scoped prompt_cache_key on Responses API requests (#2827)
Co-authored-by: Josh Guo <crimsongzx@gmail.com>
2026-12-01 14:13:16 +08:00
iQuantum
b5fb281a3e fix: default Anthropic to a Claude model Anthropic still serves (#2888)
AnthropicProvider and the agentic client's Anthropic adapter fell back to claude-sonnet-4-20250514, which Anthropic retired on 2026-06-15, so an Anthropic binding with no model failed with not_found_error. Both now use one DEFAULT_ANTHROPIC_MODEL constant, claude-sonnet-5-5.
2026-12-01 11:20:50 +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
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
224a08029d feat: let deferred tools return their usage rules from load_tools 2026-11-30 23:34:37 +08:00
cro3w
d77ad8f6c4 fix(reading): isolate document ingestion from the API process (#2988)
* fix(reading): isolate document ingestion from the API process

(cherry picked from commit f0fd1f785eb1070f689816b0977bf4c60125f95a)

* chore(api): refresh router index for the reading routes

---------

Co-authored-by: zszz3 <zszz3@users.noreply.github.com>
2026-11-30 15:15:59 +08:00
lipeh1
803c4a4a35 fix: preserve empty reasoning in quiz tool continuations (#2800)
* fix: preserve empty reasoning in quiz tool continuations

* test: cover empty reasoning in assistant tool messages

---------

Co-authored-by: lipeih <lipeihan@eazytec.com>
2026-11-28 18:22:57 +08:00
wojiecihuo
779e9da342 fix: keep the mastery prompt prefix stable across mode switches (#2991)
* 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
2026-11-28 12:20:01 +08:00
wojiecihuo
651a616b02 fix(visualize): raise the budget to 32k, cap it to the model, and retry without thinking (#3019)
* fix(book): retry an interactive page with thinking off when it runs out of room

deepseek-flash thinks by default and can spend the whole 16000-token
visualize budget on reasoning, so a book interactive block came back with
no code. When the page is empty or cut off before </html>, ask once more
with thinking turned off (thinking_off_effort_for) before failing. If that
still runs out of room, the error names the budget sent to the model and
the settings that change it.

The shipped default stays at 16000: the budget is shared by every visualize
caller, and 32768 breaks models with a lower output cap (#3018).

Refs #3011

* fix(llm): raise the visualize budget to 32k and cap each request to the model

A thinking model can spend 16k tokens before it writes any code, so the
visualize default is now 32768. Sent unchanged that would be rejected by
models whose output stops lower (gpt-4o and gpt-4o-mini at 16384) and could
overflow a small local context window, so every request now carries
min(budget, the model's known output limit, half the configured context
window). The cap lives in get_token_limit_kwargs, so it applies to every
caller; BaseAgent and the agentic loop pass the configured window.
2026-11-27 22:26:59 +08:00
LIziak112
a5e3e0a808 fix: make the repository pre-commit checks portable on Windows (#2966)
Independent maintainer review approved for 257c5e62. Windows Python 3.12 pre-commit 15/15, targeted Windows and WSL Linux regressions passed; latest HEAD CI has no failures.
2026-11-26 18:36:45 +08:00
Bingxi Zhao (Frank)
7e61863d4c fix(update): honor configured launcher readiness timeouts
Fixes #2330
2026-11-15 01:42:47 +08:00
Bingxi Zhao (Frank)
3166cda206 fix(llm): bound effective progress and recover known responses
Fixes #2538
2026-11-15 01:42:46 +08:00
Bingxi Zhao (Frank)
9233a71cb4 fix(update): bound restart readiness and document legacy recovery 2026-11-15 01:04:25 +08:00
Bingxi Zhao (Frank)
e885120cf6 fix(runtime): preserve live turns owned by another local process
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.
2026-11-15 00:50:30 +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)
39239ac1a8 Merge PR #2624: fix: sanitize raw agentic chat replay messages 2026-11-14 22:58:48 +08:00
Bingxi Zhao (Frank)
ebd0f11083 Merge PR #2605: fix(mastery): let a new reply supersede an ungraded clarification 2026-11-14 22:58:03 +08:00
Bingxi Zhao (Frank)
675f44690d Merge PR #2630: fix: time out stalled labeled-step provider streams 2026-11-14 22:52:55 +08:00
Bingxi Zhao (Frank)
afdde4feb6 Merge PR #2667: fix(runtime): make Python provider stream termination persistent 2026-11-14 22:51:15 +08:00
Bingxi Zhao (Frank)
42d29e38fa Merge PR #2504: fix(runtime): recognize framework Python orphan backends on macOS 2026-11-14 22:49:40 +08:00
stefanielizeth73-art
5ecf3d6b84 fix: make Python provider stream termination persistent 2026-11-13 22:54:43 +08:00
Steven Huang
46a1eb1b91 fix: bound stalled labeled-step provider calls 2026-11-11 23:19:30 +08:00
Adithya
9d8742e994 fix: sanitize raw agentic chat replay messages 2026-11-11 14:07:44 +05:30
AleFlyX
1e86d251bd fix(dispatch): reserve _working_brief, an injected flag the list missed
`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.
2026-11-11 08:49:06 +08:00
AleFlyX
636f522b43 fix(dispatch): withhold the arguments the runtime owns
`_`-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.
2026-11-11 08:28:10 +08:00
Tazeem Mahashin
08fac21468 fix(runtime): pin backend imports to the launcher installation 2026-11-06 13:26:44 -05:00
Tazeem Mahashin
3f1610632b fix(runtime): recognize framework Python orphan backends on macOS 2026-11-06 12:15:10 -05:00
KaiChan
fefa6c0437 fix(runtime): isolate indexless streamed tool calls 2026-11-06 19:16:02 +08:00
Bingxi Zhao (Frank)
60fb3bdfdd release: v1.7.2
Document selected-text speech, model discovery, NVIDIA NIM embeddings,
mastery reliability, Windows improvements, and complete desktop downloads.

Sync all eleven README translations and archive the v1.7.0 release notes.
Add platform-specific typing annotations for Windows APIs without changing
runtime behavior. See assets/releases/ver1-7-2.md for changes and upgrades.

Validation: pre-commit and Ruff passed; 12,782 Python tests passed
(51 skipped), 1,349 Node 22 tests passed, and the docs build passed.
2026-11-06 16:41:21 +08:00
evan188199-tech
857bc6f6ad fix(workspace): conservatively clear dead migration markers (#2390) 2026-11-06 02:27:50 +08:00
Bingxi Zhao (Frank)
79e726efb3 Merge #2435 from mathewgeejo 2026-11-06 02:04:52 +08:00
Bingxi Zhao (Frank)
ebcebd4723 Unify migration locks and plugin environments, and cover compatibility boundaries 2026-11-06 02:04:52 +08:00
Yi-111-a
d5adc0c2a9 fix: add PYTHONSAFEPATH=1 to prevent stale source tree shadowing in detached launcher and update worker (#2447) 2026-11-06 02:04:52 +08:00
Bingxi Zhao (Frank)
b837217cb5 Merge #2357 from Antonio-Faure 2026-11-06 01:56:24 +08:00
Bingxi Zhao (Frank)
7948deb5f5 Merge #2349 from rudycelekli 2026-11-06 01:56:24 +08:00
Bingxi Zhao (Frank)
89d6c960b1 Merge #2337 from yertYang 2026-11-06 01:56:24 +08:00
mathewgeejo
b9756c6126 fix: keep detached Windows venv launchers hidden
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>
2026-11-04 23:51:45 +05:30
Antonio-Faure
c7f203d594 fix(update): record a restart that never becomes ready 2026-11-02 09:12:32 +01:00
Antonio-Faure
f39b5d1c1f fix(update): keep installed modules on the target version 2026-11-02 08:44:04 +01:00
Rudy Celekli
d516269b43 fix(runtime): apply the tool-call id fallback in run_labeled_step
run_labeled_step returned tool calls via the accumulator's raw ordered()
view, which keeps id="" when a provider streams a tool call without an id
delta. The sibling consumers use collected(), which applies the positional
id and arguments fallbacks. Switch to collected() so a tool call made by an
id-less gateway is still correlatable and passes the non-empty-id schema.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-02 01:14:01 -05:00
yert
4e113d0e4f fix(llm): preserve custom headers in Codex OAuth requests 2026-11-02 04:07:25 +00:00
yert
edb205369a fix: preserve Redis event JSON arrays and tolerate legacy artifacts 2026-11-02 02:51:36 +00:00
Bingxi Zhao (Frank)
def8bdc8c6 Merge commit '1876207b5c248eb4ee4375e34779ed332a11d284' into codex/validate-reviewed-integration 2026-10-31 18:52:30 +08:00
Bingxi Zhao
7db39b4b03 Merge pull request #2142 from 1akashkalita/fix/animation-visual-review-option
Expose opt-in visual review for generated animations
2026-10-31 18:31:15 +08:00
Bingxi Zhao (Frank)
4d7090447e Integrate Turkish across complete locale chain, runtime messages and desktop shell 2026-10-31 18:14:34 +08:00
Bingxi Zhao (Frank)
0e84ab77fa Integrate reviewed changes and complete Portuguese translations 2026-10-31 18:04:54 +08:00