4964 Commits

Author SHA1 Message Date
leom1919
a02099ca14
docs: replace links to deleted PRs with commit permalinks (zh changelog, harness reference) (#8497)
* docs: replace links to deleted PRs with commit permalinks (zh changelog, harness reference)

* docs(changelog): repoint deleted PR references to commit permalinks in English changelog

Follow-up to review feedback on #8497: the English CHANGELOG.md still contains the same seven reference definitions pointing to deleted PRs (3823, 3824, 4823, 4825, 4830, 4928, 5047). Apply the same pull/N -> commit/<sha> replacement already done for CHANGELOG_zh.md. Entry text unchanged; all 7 commit permalinks verified to resolve.

---------

Co-authored-by: leom1919 <leom1919@users.noreply.github.com>
2026-11-23 08:52:03 +08:00
Hazenix
4bd3c4c6ac
fix(jina): preserve web_fetch HTTP failure status (#8450)
* fix: 保留 Jina 网页抓取的 HTTP 错误状态

* fix: Jina 响应体超限时保留 HTTP 状态码
2026-11-23 08:50:39 +08:00
Jimmy
d6f1c1d0b7
fix(agents): render current todos when state was edited after write_todos (#8171)
* fix(agents): verify reminder provenance before reusing its id

* fix(agents): drop stale persisted reminder before skipping a matching write

* fix(agents): supersede legacy todo reminders, reconcile cleared plans, render items as data

* fix(agents): reject wrapper-only legacy reminders and announce a cleared plan

* fix(agents): replace a stale reminder with the clear notice when the last write is still visible

* fix(agents): skip the clear notice when the last write already cleared the plan

* fix(agents): frame rendered todos as user input data

* fix(agents): frame completion todo text as user input data

Address the Codex P2 on 6adae998: the transient completion reminder
appended unfinished todo text after </system_reminder> without the
user-input boundary markers, so a natural-language directive inside a
todo item was presented with framework trust. The items are now framed
with the same --- BEGIN/END USER INPUT --- markers as the persisted
reminder; _format_todos already neutralizes forged markers inside
item text.

Tests: backend/tests/test_todo_middleware.py 172 passed, including the
new test_completion_reminder_frames_items_as_user_input (verified to
fail on the pre-fix rendering); ruff check and format clean.

* fix(agents): hash persisted todo reminder templates in release policy

release_policy_parameters() hashed only the completion reminder template,
so a wording change to the persisted edited/truncated/cleared reminder
templates left the assembly policy fingerprint unchanged. Hash the three
rendered templates with an empty item list, mirroring the completion
reminder, and add a regression test pinning the new hash entry.

* Merge upstream main into todo-reminder-edited-state

Catch the branch up with upstream main (7b84fd099) to resolve the
merge conflict with main. Conflict resolution:
- backend/tests/test_todo_middleware.py: union of both sides' imports
  (keep RemoveMessage from this branch, add ChatGeneration/ChatResult
  from main); both are used by the merged file.
All other upstream changes taken as-is, including upstream's removal
of frontend/src/core/voice-input/speech-recognition.ts and its test
in #8286.

* fix(agents): reconcile saved todo reminders on resume

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-23 08:43:00 +08:00
MasterZRC
096210709f
feat(agent-teams): add optional PostgreSQL persistence (#8325)
* feat(agent-teams): add optional PostgreSQL persistence

* fix(agent-teams): propagate shutdown waiter cancellation

* fix(tui): skip periodic refresh during shutdown
2026-11-23 07:36:39 +08:00
Hu Hongwei
d8d159f83a
docs(readme): clarify sandbox modes in the Chinese README (#8491)
* docs(readme): clarify sandbox modes in the Chinese README

* docs(readme): clarify when sandbox Bash is available

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-23 07:31:36 +08:00
哈基米
0ee78e1ea6
fix(todo): address malformed write_todos call ids before results exist (#8354)
* fix(todo): address malformed write_todos call ids before results exist

The base TodoListMiddleware builds one error ToolMessage per parallel
write_todos call from tool_calls[*]["id"], and the tool node does the same
for a single call. A missing or non-string id raised a pydantic
ValidationError and aborted the run before the model could retry; empty and
repeated ids created results the next request cannot address, which
backend/AGENTS.md forbids.

TodoMiddleware.after_model now gives those calls synthetic ids and returns the
same message with those ids (the messages reducer substitutes by message id),
so the base hook and the tool node build valid results that pair with the
call. Only structured tool_calls are relabelled; well-formed ids are left
untouched.

* fix(todo): relabel provider tool-call surfaces and reserve other-tool ids

Addresses review on #8354:

- Relabelling is now occurrence-aware and rewrites the provider's own
  surfaces (additional_kwargs.tool_calls and tool_use content blocks) as well
  as structured tool_calls, so a duplicate id no longer leaves extra blocks
  pointing at the old id in the next request.
- Ids used by a non-write_todos call are reserved before a write_todos id is
  retained, so a todo call sharing an id with another tool is relabelled and
  every emitted result has a unique address.

Tests cover provider surfaces matching the structured ids and a shared
echo/write_todos id; both fail on the previous head.

* fix(todo): preserve tool-call IDs in provider retries

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-23 06:46:39 +08:00
明年我18
917fc4599e
feat(skills): allow injecting storage into activation middleware (#8235)
* feat(skills): allow injecting storage into activation middleware

* feat(skills): share injected storage across skill consumers

* fix(skills): project injected storage into the lead sandbox

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-23 06:45:05 +08:00
Hyeonsang Cho
eb48cde892
fix(persistence): fence thread status writes by owner in the UPDATE (#8486)
* fix(persistence): fence thread status writes by owner in the UPDATE

ThreadMetaRepository.update_status read the row to check ownership and
then updated it by thread_id alone. A row that moved to another owner in
between received the first owner's status. Put the owner condition in
the UPDATE so the check and the write are one statement.

* test(persistence): close the side SQLite connection in the owner-move test

The sqlite3 connection context manager commits but leaves the connection
open, which emits a ResourceWarning on Python 3.13.
2026-11-23 06:25:47 +08:00
laoyyu
1dafd8a3b4
fix(runtime): compose cached delta history in the inner saver's canonical order (#8243)
* fix(runtime): compose cached delta history in the inner saver's canonical order

_channel_writes() re-sorted a checkpoint's pending_writes by task_id
only. The canonical per-checkpoint order is writes_sort_key =
(task_path, task_id, idx): InMemorySaver returns pending_writes through
_ordered_writes, which sorts by task_path first, and its native
get_delta_channel_history walk collects with the same order.

A stable task_id-only sort therefore reorders writes on fan-out
supersteps whenever task_path order differs from task_id order, and the
cached history then disagrees with the authoritative walk: an
order-sensitive reducer rebuilds a different value from cache than from
the inner saver.

get_tuple() already hands us the canonical order for every supported
backend (the SQL savers emit ORDER BY task_id, idx), so simply filter
by channel and drop the re-sort.

* docs(runtime): attribute sqlite ordering correctly and bump cache format to v2

Two follow-ups from review:

- _channel_writes() claimed the SQL savers emit ORDER BY task_id, idx.
  Only postgres does (array_agg(... ORDER BY cw.task_id, cw.idx));
  sqlite's pending_writes_sql has no ORDER BY and load_pending_writes
  sorts in Python by writes_sort_key(task_path, task_id, idx). The
  docstring now attributes each backend's ordering correctly, and notes
  the dropped task_id re-sort broke sqlite the same way it broke
  InMemorySaver.
- CACHE_FORMAT_VERSION 1 -> 2: entries composed under the old
  task_id-sorted order still pass valid_history_entry (shape-only) and
  are keyed identically, so a Redis-backed deployment would keep serving
  mis-ordered histories until TTL expiry. The versioned default prefix
  orphans them on upgrade. Test pin and both mdx pages updated.

* test(runtime): pin the default prefix assertion to CACHE_FORMAT_VERSION

test_key_prefix_override_wins hard-coded startswith("ckpt-hist:v1:") and
broke when the format version moved to 2. Derive the expectation from
CACHE_FORMAT_VERSION so future bumps do not need to touch this test, and
refresh the fake v1 prefix in the thread-purge test for consistency.

* fix(runtime): attribute the postgres pending-writes order to _load_writes

langgraph-checkpoint-postgres 3.1.3 (pinned in backend/uv.lock) aggregates
pending writes with a bare array_agg(...) in SELECT_SQL -- no ORDER BY -- and
the canonical writes_sort_key order comes from _load_writes sorting in
Python, the same mechanism sqlite uses. The docstring claimed postgres orders
with array_agg(... ORDER BY cw.task_id, cw.idx); that ordered aggregate only
exists in the legacy pending-sends migration. Also record that the dropped
task_id re-sort broke postgres the same way it broke sqlite/InMemorySaver.

* fix(runtime): purge legacy Redis checkpoint history on thread cleanup

* docs(checkpoint-cache): clarify no-TTL purge residue

---------

Co-authored-by: laoyyu <laoyyu@users.noreply.github.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-22 21:44:23 +08:00
Danila Katalshov
29c5a1d7d0
fix(history): retain recaptured batches in checkpoint order (#8278)
* fix(history): retain recaptured batches in checkpoint order

* fix(history): derive archive retention from checkpoint state

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-22 21:36:06 +08:00
huyengiang101086-spec
25a59aa5c7
fix(sandbox): build the bash cwd prefix for the shell that runs it (#8323)
* fix(sandbox): build the bash cwd prefix for the shell that runs it

* fix(sandbox): stop when the shell cannot enter the workspace

`Set-Location` reports a missing directory as a non-terminating error, so the
semicolon-separated command still ran — from whatever directory the gateway was
started in. Add `-ErrorAction Stop` so a vanished workspace aborts execution the
way the POSIX `&&` form does, and add a regression test that also proves the
command runs when the workspace exists.

Pin the shell in the remaining POSIX-only prefix assertion so the test no longer
depends on the host shell.

* fix(sandbox): preserve Windows workspace paths at launch

---------

Co-authored-by: huyengiang101086-spec <270684046+huyengiang101086-spec@users.noreply.github.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-22 20:57:56 +08:00
Heo Hao
9bd2bfa859
fix(runtime): keep run-input appends off the run-change clock (#8479)
`mutate_run_inputs` calls `_next_change_seq` and drops the return value. It
is the only one of the sixteen call sites in that module that does not
assign it, and the only column the method writes is `run_inputs_json`, so
the position it takes never reaches a row: after one append the clock moves
1 -> 2 while the run row's `change_seq` stays at 1.

The clock is a single row, so that write is not free: every queued or
steering message -- `RunInputs.submit`, `acknowledge` and `close` all land
here, and `POST /api/runs/{id}/inputs` reaches it once per message -- buys a
position nothing reads while serializing against every other run mutation in
the database, and against every other writer on SQLite. Progress snapshots,
lease heartbeats and deletes already stay off the clock for the same reason
(#5516), and an append that rewrites one JSON column which no changed-run
cursor observes belongs with them.

The append still reads the row before it writes it, so SQLite needs its
write lock up front; the clock bump had been supplying that as a side
effect. `BEGIN IMMEDIATE` takes it directly, matching `delete` and
`delete_by_thread`. Removing the clock without it would trade a wasted write
for lost updates -- eight concurrent appends leave one item behind and
report no error.
2026-11-22 20:50:30 +08:00
Willem Jiang
ee54c96300
fix(github): separate webhook runs from tool authentication (#8485)
* fix(github): separate webhook runs from tool authentication

Signed-off-by: Willem Jiang <willem.jiang@gmail.com>

* docs(github): explain App authorization for MCP

Signed-off-by: Willem Jiang <willem.jiang@gmail.com>

---------

Signed-off-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-22 20:44:33 +08:00
hajicheng
53e6042c29
fix(dingtalk): handle multi-backtick inline code spans (#8469)
* fix(dingtalk): handle multi-backtick inline code spans

* fix(dingtalk): normalize inline code span padding

Signed-off-by: Willem Jiang <willem.jiang@gmail.com>

---------

Signed-off-by: Willem Jiang <willem.jiang@gmail.com>
Co-authored-by: ZcWang <200940025+hajicheng@users.noreply.github.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-22 17:01:31 +08:00
一片一片
e9d481e9f5
feat(extensions): add a workspace page to the run postmortem example (#8468)
* feat(extensions): add a workspace page to the run postmortem example

The plugin now declares a PluginContribution: one page surface served from
packaged assets plus three actions (latest, report, markdown) over the same
service and derivation as the HTTP routes.

The page prefills the current thread, loads the latest run the caller owns,
renders verdict, anomalies, activity and a scrollable timeline, and
downloads the Markdown report. A run the caller does not own answers
{"not_found": true} rather than the action route's generic 422.

The extension manifest id becomes the plugin namespace, the frontend
catalog entry follows it, and the bundled documentation snapshot is
regenerated.

* fix(extensions): keep the postmortem page's thread prefill claim conditional

The only page mount point today renders surfaces without a thread id, so
SurfaceContext.threadId is undefined there; the page keeps supporting the
optional field but the README and the module comment no longer promise a
prefill the host cannot deliver.

Also pin `loaded.plugins == ()` in both "nothing registered" tests so a
future reorder cannot surface the sidebar page for a disabled extension.

* test(runtime): control lease expiry during atomic admission

* fix(extensions): make the postmortem's latest run and timeline honest about bounds

The changed-run feed is ordered by change sequence across every thread in
the evidence grant, so a bounded scan cannot prove a run is the newest.
Only a scan that reached the end of the feed may answer a run; an
incomplete scan now answers complete=false, and the page asks for a run ID
instead of presenting an older run as latest.

The page also reveals timeline events in 400-row chunks with "Show more",
so every event in the response is reachable; the banner no longer tells
users to raise Max events when the display cap was the limit.

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-22 16:37:40 +08:00
Willem Jiang
d322e88f23
fix(smoke-test): sign in with an existing test account (#8481)
* fix(smoke-test): sign in with an existing test account

* fix(smoke-test): read session cookies from stdin
2026-11-22 15:52:23 +08:00
Hyeonsang Cho
a9b5dd80f8
fix(memory): bound DeerMem's in-process document cache (#8480)
FileMemoryStorage kept one deep-copied document per (user, agent) scope it
had ever read, with no cap. A scope that is only read is never evicted, and
GET /api/memory accepts any well-formed agent_name, so one user could grow
the cache by a document per request for the life of the process.

The cache is now least recently used with a cap of 256 scopes. A hit or a
write refreshes its scope, and an evicted scope is read from its files again.
2026-11-22 11:25:32 +08:00
Luck
aa78349751
fix(runtime): page thread history from the before cursor (#8398)
* fix(runtime): page thread history from the before cursor

POST /api/threads/{id}/history passed body.before as config.checkpoint_id
to get_state_history, but LangGraph savers match checkpoint_id exactly in
list(), so a before cursor always returned that single checkpoint. Treat
it as the inclusive start of the walk (anchor, then list(before=anchor)),
which is what the Gateway's degraded raw accessor already does and what
its comment says the graph path does.

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

* docs(gateway): state that the history before cursor is inclusive

LangGraph's own history API treats before as exclusive; spell out that
this endpoint returns the cursor checkpoint first so paging clients do
not double-count the boundary entry.

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

* docs(gateway): clarify history pagination after cursor pruning

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-22 10:23:23 +08:00
Bas Cancrinus
b6b0be211e
fix(opensandbox): report a missing file as FileNotFoundError (#8470)
* fix(opensandbox): report a missing file as FileNotFoundError

OpenSandboxSandbox.read_file turned every failed read into an "Error: ..."
string and logged it at ERROR, including an HTTP 404 FILE_NOT_FOUND for a file
that simply doesn't exist yet. The read-before-write gate reads the target
before every write_file, so each new file an agent writes logged an ERROR, and
the gate had to fail open because "missing" and "unreadable" looked the same.

A not-found answer (a 404 anywhere in the cause chain, the provider's existing
_is_not_found) now raises FileNotFoundError from the SDK error, like
LocalSandbox; the gate and read_file already handle it (write_file creates the
file, read_file reports not_found). It is logged at debug. Other read errors
keep the "Error: ..." string and the ERROR log. A 404 still doesn't evict the
sandbox.

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

* fix(opensandbox): keep a renewal 404 as a dead sandbox, not a missing file

Review follow-up (willem-bd): _file_op re-raises a failed renewal through the
same path as the operation's own error, so a renewal 404 (sandbox expired
server-side) was evicted correctly but then surfaced as FileNotFoundError, and
the read-before-write gate treated a dead sandbox like a file that doesn't
exist yet.

The not-found translation now lives in _file_op behind missing_path and
applies only to the operation's own failure; a renewal failure keeps its
error. read_file and append-mode write_file opt in. Tests pin the renewal-404
read (red on the previous head) and append behaviour.

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

* test(opensandbox): let the remote line-number test's _file_op stub take keyword arguments

_file_op now takes missing_path; the stub in test_remote_read_file_line_numbers.py accepted only the operation, so the
two opensandbox cases failed with an unexpected keyword argument (CI backend-unit-tests (4)).

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:07:21 +08:00
Hyeonsang Cho
7b84fd0998
fix(memory): let OpenViking's write policy decide a refused non-owner write (#8475)
* fix(memory): let OpenViking's write policy decide a refused non-owner write

A write for a DeerFlow user other than owner_user_id was refused with
MemoryManagerError before the write policy was consulted, so under the
default write: log_and_drop the after-agent hook and the pre-compaction
flush failed every turn for that user after the answer was generated.

The owner check still runs before any OpenViking call. Under log_and_drop
the refused write is now logged and dropped; write: raise still raises.

* docs(memory): say the refused OpenViking write is what gets logged
2026-11-22 09:41:03 +08:00
Tsai Yuan
8744c9c9ac
feat(setup): add keyless Rapid-MLX wizard entry (#8476)
* feat(setup): add keyless Rapid-MLX wizard entry

Signed-off-by: nothingyuancando <1579035512@qq.com>

* style(setup): drop unrelated writer formatting changes

Signed-off-by: nothingyuancando <1579035512@qq.com>

---------

Signed-off-by: nothingyuancando <1579035512@qq.com>
2026-11-22 09:38:56 +08:00
NanPan
7314535539
fix(mcp): bound disconnected session cleanup wait (#8378)
* fix(mcp): bound disconnected session cleanup wait

* fix(mcp): use builtin timeout error in cleanup wait

* style(mcp): normalize regression test file ending

* docs(mcp): sync cleanup guidance with upstream

* test(mcp): harden disconnect cleanup regression

* test(mcp): assert owner reaper survives cleanup waiter

* style(mcp): satisfy backend Ruff formatting

* style(mcp): collapse teardown drain call per Ruff

* style(mcp): satisfy Ruff formatting for cleanup regression

* style(mcp): satisfy Ruff formatting for cleanup regression

* style(mcp): wrap teardown drain for Ruff

* style(mcp): satisfy Ruff formatting in disconnect regression

* style(mcp): wrap cleanup owner assertion

* style(mcp): format owner reaper assertion

* style(mcp): respect repository Ruff line length

* style(mcp): apply backend Ruff formatting

* style(mcp): apply Ruff formatting to cleanup regression

* style(mcp): format session cleanup regression test

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-22 09:27:53 +08:00
Jasper
f95d77f961
fix(feishu): preserve markdown examples in multi-backtick code spans (#8460) 2026-11-22 09:26:18 +08:00
Hazenix
9ba9bfad41
fix: reject length-capped compaction summaries (#8437)
* fix: 拒绝超过输出上限的压缩摘要

* fix: 识别原生 Ollama 摘要截断

* fix: 将 Ollama 截断检测限定在会话压缩
2026-11-22 09:24:34 +08:00
ZephyrWang
9809784e95
fix(client): honor named agent tool groups (#8472) 2026-11-22 08:57:38 +08:00
Hu Hongwei
559c2ccc95
docs(deploy): start the static demo without an env file (#8477) 2026-11-22 08:54:35 +08:00
Jason
6f9d6cd7c6
fix(opensandbox): sync enabled skills and per-agent projections (#8451)
* fix(opensandbox): sync enabled skills and per-agent projections

* fix(opensandbox): retain workspaces on skill upload failure

* test(opensandbox): make skill upload checks portable

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-22 08:48:07 +08:00
zjy-boom
e09cd88c2d
fix(dingtalk): split table cells after escaped backslashes (#8429)
Co-authored-by: zjy-boom <174030947+zjy-boom@users.noreply.github.com>
2026-11-22 08:33:49 +08:00
yetuge
3de205c5ce
fix(image-generation): validate provider download URLs before fetching (#8457)
* fix(image-generation): validate provider download URLs before fetching

The OpenAI-compatible image path fetched the provider-supplied data[].url
with requests.get and default redirects, so a compromised provider could point
the skill at a loopback, private or link-local service, or bounce a public URL
through a redirect. Require HTTPS on port 443, a public host, and re-validate
every redirect hop, mirroring the video-generation download guard.

* fix(image-generation): constrain provider redirects and download status

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-22 08:32:19 +08:00
Jasper
1c286b9336
fix: restore persisted todos in thread history (#8459) 2026-11-21 20:47:45 +08:00
Aling33
0ebf8ce7b2
fix(gateway): refuse artifact share imports where the writer is unavailable (#8402)
* fix(gateway): refuse artifact share imports where the writer is unavailable

The descriptor-confined import writer needs O_DIRECTORY, O_NOFOLLOW and
dir_fd, so a non-POSIX Gateway answered POST /api/shares/{token}/fork with a
500 AttributeError after it had already created the destination thread and
rolled it back. Capture already refuses the same artifacts with 422, so the
import path now returns that contract before any workspace state exists.

* fix(gateway): refuse artifact share imports where the writer is unavailable

The descriptor-confined import writer needs O_DIRECTORY, O_NOFOLLOW and
dir_fd, so a non-POSIX Gateway answered POST /api/shares/{token}/fork with a
500 AttributeError after it had already created the destination thread and
rolled it back. Capture already refuses the same artifacts with 422, so the
import path now returns that contract before any workspace state exists.

* fix(gateway): refuse artifact share imports where the writer is unavailable

The descriptor-confined import writer needs O_DIRECTORY, O_NOFOLLOW and
dir_fd, so a non-POSIX Gateway answered POST /api/shares/{token}/fork with a
500 AttributeError after it had already created the destination thread and
rolled it back. Capture already refuses the same artifacts with 422, so the
import path now returns that contract before any workspace state exists, and
the sharing guide states the requirement next to the endpoint.
2026-11-21 20:45:33 +08:00
Wenchao An
5eb78f6530
feat(voice-input): enable dictation with a configured STT service (#8286)
* feat(voice-input): enable dictation with a configured STT service

* fix(voice-input): bound provider responses and warn on old configs

* fix(voice-input): redact config errors and validate transcripts
2026-11-21 20:44:37 +08:00
Hu Hongwei
ee72fe281c
fix(frontend): localize the sidecar send button's accessible name (#8418)
* fix(frontend): localize the sidecar send button's accessible name

* test(frontend): align sidecar E2E with localized send name
2026-11-21 20:42:18 +08:00
Loveca
dccb163836
fix(subagents): start subagent execution timeout at admission (#8356)
* fix(subagents): start execution timeout at admission

Queue wait was charged against timeout_seconds on both the async and
sync paths, and the task tool charged PENDING polls against its main
poll budget. Start the execution clock when a capacity slot is owned,
split the poller's queue and execution allowances, and report the actual
polling window on polling_timed_out.

Fixes #8308

* fix(subagents): ignore closed-loop admission waiter cancel

The isolated loop can close while the synchronous wrapper is still being reclaimed during teardown, so scheduling the waiter's cancellation raises RuntimeError. There is no loop left to wake, and the warning only surfaced in combined test runs.

* fix(subagents): count the admission-to-supervisor gap in the timeout

Record the monotonic start when the capacity slot is granted and let the wrapper wait only for the remaining budget. Synchronous work between admission and the supervisor waking previously started a fresh full timeout, so a one-second limit could be escaped by blocking the loop for 1.2 seconds immediately after admission. Completion after the deadline now counts as a timeout on both async and sync paths.

* fix(task): recheck terminal state before a polling timeout

The poller checked its budget immediately after the final sleep and returned polling_timed_out without reading status again. A subagent that completed during that sleep was reported as stuck and cancelled. Re-read the result only when the budget is exhausted so a terminal state still wins; the merge base had the same edge case.

* fix(subagents): settle timeout races before publishing results

Signed-off-by: Willem Jiang <willem.jiang@gmail.com>

---------

Signed-off-by: Willem Jiang <willem.jiang@gmail.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-21 20:24:40 +08:00
Cosolar
900d1b65eb
fix(gateway): reject an end_at past the UTC range (#8465)
* fix(gateway): reject an end_at past the UTC range

resolve_end_at only mapped ValueError to the coded 422. A valid wall time near datetime.max moves past year 9999 when converted to UTC, so the OverflowError escaped admission and the request failed with a 500. Map it to the same 422 invalid_request, naming end_at.

* fix(gateway): name run_at in UTC overflow errors

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-21 19:41:46 +08:00
dependabot[bot]
702dd69c50
chore(deps): bump opentelemetry-api from 1.45.1 to 1.45.2 in /backend (#8473)
Bumps [opentelemetry-api](https://github.com/open-telemetry/opentelemetry-python) from 1.45.1 to 1.45.2.
- [Release notes](https://github.com/open-telemetry/opentelemetry-python/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-python/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-python/compare/v1.45.1...v1.45.2)

---
updated-dependencies:
- dependency-name: opentelemetry-api
  dependency-version: 1.45.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-21 19:37:50 +08:00
Hyeonsang Cho
2c98fe40d4
fix(channels): keep code blocks rendering across Discord message splits (#8384)
* fix(channels): keep code blocks rendering across Discord message splits

DiscordChannel._split_text cut a long reply at the last line break within
2000 characters without looking at code fences. A block cut in two left
the first message with an unclosed fence and the second with bare code,
so neither rendered as code and the code was read as markdown.

Track the open fence while splitting. A message cut inside a block now
ends with a closing fence and the next one reopens it with the same
opening line, indent included, with room for both reserved in the 2000
characters. Fence parsing follows CommonMark: a shorter or different run
does not close a block, and a backtick info string cannot hold a
backtick. A block opening on a message's last line moves to the next
message, and a fence line too long to repeat is split as plain text.

* fix(channels): read Discord code blocks the way Discord renders them

The split tracked CommonMark fences, but Discord's client closes a block at
the next three backticks, also right after the last code on a line, has no
tilde fences and no nesting. A block closed inline was taken as still open,
so the prose after it was reopened as code in every later message.

The reply is now parsed once with Discord's code-block rule, since which run
closes a block can depend on text past the split. Inside a block the split
takes the latest line end or closing run where both the closed and the
reopened block keep code, and a cut inside a line no longer splits a
backtick run or an escape.

* fix(channels): keep a Discord block's opener whole and read CRLF line breaks

When no line break fits, the split falls back to a hard cut, and that cut
could land in a block's opening run or language tag, or before its first
code: the message ended with "```p" and the next one reopened the block
with "ython" as its first code line. A hard cut that leaves this message
no code of the block now ends the message before the opening run instead,
so the block moves to the next message whole.

Discord's parser turns CRLF and a lone CR into LF before it reads code
blocks, but the splitter required LF after the language tag, so a long
CRLF block reopened with a bare fence. The block patterns now accept
either line ending, the empty-block checks strip CR too, and a cut inside
a line no longer separates CR from LF.
2026-11-21 19:13:17 +08:00
Nan Gao
7810b807f2
fix(skills): validate directory names and package regular files (#8444)
* fix(skills): constrain skill creation and packaging paths

* fix(skills): report creator and packager errors on stderr

* test(skills): expect packager validation errors on stderr

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-21 19:03:16 +08:00
Hyeonsang Cho
d834188dcd
fix(memory): rebuild the DeerMem index from the memory buckets only (#8463)
The full retrieval-index rebuild at Gateway startup globbed
`**/facts/**/*.md` under the storage root. The host's default root is the
runtime home, which also holds every thread's sandbox-writable workspace
(users/{id}/threads/{thread}/user-data/workspace). A fact-shaped file a
sandbox wrote at .../workspace/agents/{agent}/facts/ passed validation and
was indexed into that user's scope: memory_search served it, it never
appeared in the canonical memory, delete_fact left the row, and every
restart indexed it again. Any other workspace file below a facts/
directory logged a parse traceback and counted as a failed fact.

Walk only the fact directories the scoped readers use: the legacy root
bucket (agents/*/facts) and each user bucket (users/*/agents/*/facts).
2026-11-21 19:01:55 +08:00
yetuge
6b1680c8da
test(goal): skip the shared-handoff case on non-POSIX hosts (#8462)
present_shared_artifact answers 'requires POSIX' on a native Windows host, so
the shared-artifact delivery case fails there while the sibling
test_shared_artifact_handoff.py already skips non-POSIX. Guard the helper so
every shared-handoff caller skips on Windows; POSIX runs are unchanged.
2026-11-21 19:00:22 +08:00
哈基米
088189683c
fix(mcp): redact inline base64 payloads from tool error messages (#8412)
* fix(mcp): redact inline base64 payloads from tool error messages (#8326)

* fix(mcp): redact base64url payloads and update the guide

* fix(mcp): bound the data-URI params window

The data: branch rescanned a comma-free run from every start position, so a
crafted multi-MB error string cost quadratic CPU on the redaction path. Bound
the params window to 200 characters (MIME types and parameters sit well below
that) and cover the pathological input with a regression test.

* docs(mcp): explain the bounded data-URI params window
2026-11-21 18:57:48 +08:00
kongxin
9e85b2f367
fix(sharing): keep imported share history out of the importer's memory (#8422)
* fix(sharing): keep imported share history out of the importer's memory

Share import now marks every copied message with a server-owned
deerflow_imported_history key. Memory capture skips marked messages
after each run and in the pre-compaction flush, before any backend sees
them, so the sharer's statements no longer become facts about the
visitor. The Gateway strips the key from client input.

* fix(sharing): mark the copied history of copies imported before marks

Run admission now marks a share copy made before imported messages were
marked, next to the existing history-seed shim. Only messages from the
copy's root checkpoint, which the import wrote, are marked, so the
owner's own turns stay eligible for memory. Busy or paused threads are
left for a later run, and a metadata failure never blocks the run.
The share-import metadata keys are now server-reserved.
2026-11-21 16:46:09 +08:00
Nan Gao
317ced8030
fix(video-generation): follow same-origin MiniMax API redirects (#8458) 2026-11-21 16:43:42 +08:00
一片一片
db55b1322f
feat(extensions): add a run postmortem example over sealed evidence (#8411)
* feat(extensions): add a run postmortem example over sealed evidence

One sealed run's evidence becomes a verdict, an anomaly list, a bounded
timeline and a shareable Markdown document that answers "what happened,
and what should I check next?" — the question the event store can already
answer but nothing renders for an operator.

The example uses only the public extension API: CompletedRunEvidenceReader
through ExtensionRuntimeDeps, the request-scoped visibility reader when the
host offers one, and the snapshot owner as the second caller binding. Reads
follow the host cursor with a repeated-cursor guard and stop at max_events;
partial seals, truncated payloads and short reads surface as anomalies and
caveats rather than silently shrinking the report. postmortem.py is pure,
so the interpretation is unit-testable without a host.

* fix(extensions): separate read bounds from evidence damage in the postmortem

A short read caused by the caller's max_events claimed payload truncation,
which an operator reads as retention damage. Split the report: bounded
reads say so and add a caveat, an unexplained short read is
evidence_incomplete, and only host-truncated payloads are
evidence_truncated.

Also drop the bare "Error " tool-failure prefix (prose like "Error
handling in this tool ..." is not a failure), remove the unused
snapshot() helper, and cover the request-scoped visibility reader branch:
an invisible run is refused before any evidence is read.

* fix(frontend): list the run-postmortem example in the extension catalog

The catalog test compares the frontend catalog with the bundled example
directories, so a new example must appear in the directory, the locale
copy, and the key union. It is a backend-only extension: no namespace,
and its copy comes from the generated bundled documentation.
2026-11-21 16:36:22 +08:00
dependabot[bot]
8f1a6cddf9
chore(deps): bump wcmatch from 10.1 to 11.2 in /backend (#8464)
Bumps [wcmatch](https://github.com/facelessuser/wcmatch) from 10.1 to 11.2.
- [Release notes](https://github.com/facelessuser/wcmatch/releases)
- [Commits](https://github.com/facelessuser/wcmatch/compare/10.1...11.2)

---
updated-dependencies:
- dependency-name: wcmatch
  dependency-version: '11.2'
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-21 16:00:46 +08:00
Nan Gao
57cc925e5b
fix(skills): review package text regardless of filename (#8445)
* fix(skills): review package text regardless of filename

* test(skills): cover binary markers after long text prefixes

* fix(skills): verify inferred operations and preflight model review budgets
2026-11-21 15:37:25 +08:00
ZephyrWang
2abcfa4250
fix(sandbox): honor data directories in explicit search globs (#8408) 2026-11-21 15:37:07 +08:00
Nan Gao
40ef4f6ac1
fix(web_fetch): validate URLs before calling hosted readers (#8447)
* fix(web_fetch): validate URLs before calling hosted readers

* fix(web_fetch): apply the URL check to all hosted readers

* fix(web_fetch): preserve bracketed query parameters
2026-11-21 11:41:57 +08:00
PeaceMaker-best
b41bd8b2ec
fix(models): share rate-limit cooldowns within quota groups (#8427)
* fix(models): share rate-limit cooldowns within quota groups

Signed-off-by: PeaceMaker-best <221849497+PeaceMaker-best@users.noreply.github.com>

* docs(models): clarify request admission polling

Signed-off-by: Willem Jiang <willem.jiang@gmail.com>

---------

Signed-off-by: PeaceMaker-best <221849497+PeaceMaker-best@users.noreply.github.com>
Signed-off-by: Willem Jiang <willem.jiang@gmail.com>
Co-authored-by: PeaceMaker-best <221849497+PeaceMaker-best@users.noreply.github.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-21 11:40:44 +08:00
Xinmin Zeng
9337f5b032
ci(tests): skip backend and frontend jobs that a pull request cannot affect (#8435)
* ci(tests): skip backend and frontend jobs that a pull request cannot affect

Every pull request ran all six backend shards and the frontend unit and lint
jobs, whatever it changed. A shared `changes` job now runs
scripts/ci_changed_scopes.py on the PR merge commit and gates the backend
(unit shards, default-install collection, lint-backend) and frontend
(unit tests, lint-frontend) jobs on the scope the diff touches.

The rules follow what each suite actually reads, measured by running the six
CI shards under strace: backend tests read files across the whole repository,
so the backend scope only skips frontend sources, tests and assets that no
backend test opens; frontend tests read contracts/, examples/, skills/public/
and the backend capability catalog, so those join the frontend scope. Pushes,
changes under .github/ and an unknown diff run every scope.
test_ci_changed_scopes.py runs the real script on a PR-shaped merge commit,
pins the workflow wiring, and fails when either side starts reading a path
outside its scope. lint-check also cancels superseded runs.

* ci(tests): check frontend reads on every PR and fail open on undecodable diffs

The guard that frontend code reads no path outside the frontend scope ran in
the backend shards, so a frontend-only PR that adds such a read skipped it.
The scanner now lives in scripts/ci_changed_scopes.py behind
--check-frontend-reads, and an ungated frontend-scope-reads job in
lint-check.yml runs it on every pull request.

The scanner also reads frontend/Makefile and package.json, which found that
`make test` runs pnpm through scripts/pnpm.py; that launcher joins the
frontend scope.

`git diff -z` prints raw path bytes, so a non-UTF-8 path raised
UnicodeDecodeError and the changes job wrote no outputs, skipping every gated
job. An undecodable diff is now an unknown diff and runs every scope.

* ci(tests): follow URL and pathlib references in scope guards

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-21 11:40:08 +08:00