4920 Commits

Author SHA1 Message Date
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
dependabot[bot]
62b7009f5e
chore(deps): bump next from 16.4.1 to 16.4.5 in /frontend (#8455)
Bumps [next](https://github.com/vercel/next.js) from 16.4.1 to 16.4.5.
- [Release notes](https://github.com/vercel/next.js/releases)
- [Commits](https://github.com/vercel/next.js/compare/v16.4.1...v16.4.5)

---
updated-dependencies:
- dependency-name: next
  dependency-version: 16.4.5
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-21 10:59:28 +08:00
Nan Gao
7afb749992
fix(video-generation): validate provider download URLs (#8446)
* fix(video-generation): restrict provider download destinations

* docs(video-generation): clarify shared MiniMax download hosts
2026-11-21 10:52:07 +08:00
yetuge
6499631484
fix(runtime): enforce artifact delivery only for goal runs (#8410)
* fix(runtime): enforce artifact delivery only for goal runs

Since #4494 an ordinary run that left a working file or a local copy under
outputs ended as error although the task was finished. Record the verdict as
enforcement=required only for a run that took part in a goal (participation is
recorded before the evaluation write, so a failed verdict write cannot
downgrade it), and keep the ordinary verdict advisory so the receipt and
workspace changes stay visible without failing the run. Hidden paths were
handled in #8254.

* fix(runtime): keep delivery required when the goal read is unavailable

read_thread_goal swallowed every exception and returned None exactly like an
absent goal, so a transient checkpoint-read failure on an interactive goal
thread downgraded delivery to advisory while the goal stayed active. Retry the
read once, then treat an unreadable goal as unknown and mark participation, so
delivery stays required.

* docs(runtime): include the unknown-goal trigger in the enforcement list
2026-11-21 10:49:37 +08:00
ordinary being
cd518c347b
fix(runtime): keep replayed fallback from failing a successful run (#8324)
* fix(runtime): scope fallback detection when pre-run capture fails

A failed pre-run snapshot capture leaves the message-id boundary empty, but values-mode chunks still replay prior history. A stale deerflow_error_fallback marker can therefore flip a successful current run to error. When capture failed, attribute only the newest values message to this run; incremental modes and journal fallback detection stay unchanged. Parametrize the stale-history regression over capture success and failure.

* fix(runtime): establish fallback boundary on uncaptured values frames

An initial values frame can be entirely replayed history, so latching its newest fallback still misclassifies the run. When the pre-run snapshot was not captured, record the first values frame as the message-ID baseline and accept only later IDs; only then can a fallback be attributed to the current run. Update the regression to emit the initial replay frame, and keep the fresh-fallback control with an empty initial frame.

* test(runtime): cover replay boundaries in both values modes

Emit the initial replayed values frame as a separate frame and assert both values-only and values+updates streams ignore its stale fallback. Keep the fresh-fallback control on the same two mode shapes.

* fix(runtime): keep no-checkpointer runs as current fallback sources

An in-memory run has no replayed history, so a values frame is current even when snapshot capture is unavailable. Only a thread with a checkpointer needs the first-frame replay baseline; preserve fallback detection for checkpointer-less runs.

* fix(runtime): filter replayed fallbacks from updates frames too

ThreadDataMiddleware.before_agent returns full history in an updates frame. When the pre-run snapshot capture failed, the message-ID boundary now covers values and updates frames and collects nested update messages; values and updates-only requests skip replayed fallback markers while fresh updates remain eligible. Add a regression that builds the history update with the real middleware and covers updates-only and values+updates.

* fix(runtime): bound fallback on empty frames and checkpoint streams

Set the replay boundary on the first values or updates frame even when it has no messages, so a new thread's first fallback is not mistaken for history. Treat checkpoints and debug snapshots as replay sources: they seed the message-ID boundary and never latch a fallback. Add regressions for empty boundary frames in values, updates and mixed mode, and for checkpoints/debug history before values.

---------

Co-authored-by: Tong-bit-art <Tong-bit-art@users.noreply.github.com>
2026-11-21 10:37:34 +08:00
paer
ec2c881c6b
fix(tui): handle closed pipes when flushing short --print answers (#8388)
* fix(tui): flush short headless answers before exiting

* test(tui): expose the broken-pipe exit status on regression
2026-11-21 10:34:47 +08:00
Harvey DU
477c8e04ec
fix(feishu): keep a card's markdown image from failing every update (#8423)
* fix(feishu): keep a card's markdown image from failing every update

A card markdown element only renders a markdown image whose target is an
uploaded `image_key`. An answer that carries `![alt](url)` therefore made Feishu
reject the card with 230099 / 11310 ("the card contains images but no imagekey is
passed in"), and because the same card is patched for each streamed snapshot,
every later update failed too: the reply stopped at the text sent before the
image marker (#8407).

Rewrite the marker as a link before the card is built, which keeps the
reference and its target in a form the element renders. Fenced blocks and
inline code spans stay literal, since a card shows them as code and rewriting
what they contain would misreport the answer.

The rewrite only removes a character, so a card that already fit Feishu's
30 KB body limit still does.

* fix(feishu): rewrite the button card's text and stay literal in an open fence

Review follow-ups on the card markdown rewrite.

The clarification button card builds its own JSON and is delivered with
`raw_card_content=True`, so it never passed through `_build_card_content`: an
agent-authored question carrying `![alt](url)` would still be rejected with
230099 / 11310. `build_button_card` now applies the same rewrite to the text it
puts in its markdown element (imported inside the function, since feishu.py
imports that module).

A snapshot streamed before its closing fence arrives has an open block at the
end, and the closed-fence pattern did not see it, so a marker inside that block
was rewritten in the transient snapshot and then shown as a link in what had
been code. What follows an unterminated opener is now left literal.
2026-11-21 10:33:03 +08:00
Hyeonsang Cho
8a6eb9c898
fix(middlewares): keep queued hints when an empty model response is retried (#8424)
* fix(middlewares): keep queued hints when an empty model response is retried

LoopDetection, TokenBudget, ToolProgress and Todo take their queued hint out
of the run's queue in wrap_model_call and put it back only when the call
raises. A completed call with no content returns normally;
LLMErrorHandlingMiddleware, which sits outside them, then turns it into
EmptyModelResponseError and retries by running the inner wraps again. The
queue was already empty, so the retry went out without the hint. Loop and
TokenBudget had already marked the run as warned, so that run never saw the
warning.

Each wrap now puts its hints back on an empty stop response too, using the
same check LLMErrorHandlingMiddleware retries on
(model_response.is_empty_stop_response). Test fakes that returned a MagicMock
or a string as the model's answer now return an AIMessage, since the check
reads anything else as no answer, as LLMErrorHandlingMiddleware does.

* docs(middlewares): note that a model retry runs the inner wraps again

LLM error handling retries both a call that raised and an empty stop response by calling the inner wraps again, so a wrap that takes a queued hint for one call must put it back in both cases.
2026-11-21 10:31:13 +08:00
thzon
6addd93d32
docs: clarify how to open the workspace after deployment (#8442)
* docs: clarify how to open the workspace after deployment

* docs: clarify local workspace entry
2026-11-21 10:26:51 +08:00
PeaceMaker-best
1bd99c5adb
fix(models): retain native DeepSeek cache-hit usage (#8428)
Signed-off-by: PeaceMaker-best <221849497+PeaceMaker-best@users.noreply.github.com>
Co-authored-by: PeaceMaker-best <221849497+PeaceMaker-best@users.noreply.github.com>
2026-11-21 10:24:42 +08:00
Bas Cancrinus
715d50851f
feat(opensandbox): allow OpenSandbox SDK 1.x (#8403)
SDK 0.1.x doesn't send OPEN-SANDBOX-API-KEY on execd calls routed through
the server proxy (use_server_proxy: true); from 1.1.0 on the SDK attaches
the key to those calls in proxy mode and still never in direct mode.

Raise the harness extra to opensandbox>=1.1.0,<2.0.0 (lock: 0.1.15 ->
1.2.1, no other package changes). Every SDK call the provider makes keeps
its signature in 1.x. Update the install hint, the packaging test and the
README note on append, which 1.x doesn't provide either.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 09:35:36 +08:00
Totoro
c4ba921143
feat(mcp): add per-user browser OAuth for remote servers (#8425)
* feat(mcp): add per-user browser OAuth for remote servers

* fix(mcp): let users clear grants after server removal

---------

Co-authored-by: Totoro-qaq <279883115+Totoro-qaq@users.noreply.github.com>
2026-11-21 09:32:32 +08:00
yetuge
271f6e9ad4
fix(agents): make the todo completion reminder match the guard's terminal statuses (#8432)
* fix(agents): make the todo completion reminder match the guard's terminal statuses

The reminder told the model to finish everything and only mark items
completed, while the guard also accepts blocked and waiting. A step that
cannot continue in this run was retried or falsely marked completed to get
past the guard. Offer blocked/waiting and name the same terminal set the exit
check uses.

* test(agents): state that the reminder test checks the instruction, not the response

* fix(agents): include the completion reminder template in the assembly fingerprint

The fixed reminder is model-visible instruction text, but release_policy_parameters
hashed only the system prompt and tool description, so a wording change left
AgentAssemblyDescriptor.fingerprint unchanged. Hash the template rendered with
an empty item list, keeping per-run todo content out.

---------

Co-authored-by: Nan Gao <thunderggnn@gmail.com>
2026-11-21 00:53:33 +08:00
Xinmin Zeng
e3edd05114
test: prune 76 redundant, dead, and source-grep test suites (#8433) 2026-11-20 20:25:42 +08:00
leom1919
92d884b6d7
docs: fix dead link to removed LangGraph middleware concept page (#8434)
langchain-ai.github.io/langgraph/concepts/middleware/ has been removed
(the concepts/ section no longer lists middleware); the content now lives
under docs.langchain.com. Point both references at the unified middleware
overview page.
2026-11-20 18:12:33 +08:00
Houston
8113420c8f
fix(title-middleware): wait for the first complete exchange to generate a title (#8338)
* fix(agents): wait for the first complete exchange to generate a title

* fix(agents): preserve default title timing in the SSE stream

* fix(title-middleware): generate model titles at turn end

* fix(title-middleware): preserve titles across live input and recursion caps

* fix(runtime): recover first-turn titles from delta checkpoints

---------

Co-authored-by: Houston <347629597+HoustonJia@users.noreply.github.com>
Co-authored-by: Nan Gao <thunderggnn@gmail.com>
2026-11-20 13:11:56 +08:00
Xinmin Zeng
5bb4da91ea
ci(tests): isolate offline benchmark suites into path-triggered workflow (#8414) 2026-11-20 10:27:23 +08:00
Hyeonsang Cho
a0c3968f28
fix(channels): publish failed-run replies before releasing the dedupe key (#8383)
* fix(channels): publish failed-run replies before releasing the dedupe key

The generic error handler, both thread-busy replies and the /wait
stale-pin recovery released the inbound dedupe key before publishing
their reply. Publishing awaits the channel's send, so a provider
redelivery could start over on another worker while that reply was
still on its way. Publish first, then release, as the step-limit,
fire-and-forget stale-pin and streaming paths already do.

* fix(channels): release the dedupe key when shutdown cancels a failure reply

The release decision is made from the run's own failure before the reply,
and a reply that is cancelled or raises still releases the key, so shutdown
no longer turns a rejected run into a key kept for the dedupe TTL. A /wait
read timeout still keeps the key. The ordering tests wait for inbound
completion and always stop the manager.
2026-11-20 10:13:20 +08:00
Xinmin Zeng
047805137f
test(backend): prune 3 AST-mutation and bug-revert verified redundant suites (#8413) 2026-11-20 10:08:46 +08:00
yetuge
0ed5743832
fix(gateway): reject unusable artifact state at the input boundary (#8409)
artifacts and tool_artifact_processed are caller-writable reducer channels
whose values the thread-state route persists with Overwrite. A non-list value
was stored before any reducer saw it, and the next artifact-producing run
failed on existing + new; unhashable entries crashed the dedupe. Validate the
declared list-of-strings shape on both boundaries and let merge_artifacts
ignore a non-list side or non-string entry so an already-poisoned checkpoint
heals instead of failing every later run.
2026-11-20 06:51:27 +08:00
golemon
018a8d814d
fix(sandbox): derive bash tool status from process exit codes (#8396)
* fix(sandbox): derive bash tool status from process exit codes

Carry native exit codes in string-compatible command output and stamp bash tool results before content-based normalization. Preserve redaction, truncation, timeout markers, scoped execution, and legacy provider string returns.

Add real subprocess and graph regressions for error-like stdout, JSON data, forged exit markers, redaction, nonzero exits, timeouts, and result copying. Validate sync and async execution with tool progress enabled and disabled.

* docs(sandbox): explain local bash execution status

Document that native bash status follows the exit code while error-like output remains command data. Clarify that redaction and output limits do not change execution status.

* fix(sandbox): include provider exit codes in bash metadata

Carry numeric process exit codes in producer-stamped bash tool results. Extend the progress metadata schema and regression coverage so the additional field preserves progress tracking and graph receipts.

* fix(subagents): prefer provider exit codes for test evidence

Use validated producer exit codes before output markers when harvesting bash execution evidence. Preserve text fallback for legacy results and malformed metadata without weakening test-summary acceptance.

Cover real pytest reporter conflicts, checkpoint round trips, failure and unverified summaries, and legacy metadata. Document the exit-code precedence and compatibility behavior.
2026-11-20 06:49:21 +08:00
Zeren Wang
a96c9c0318
fix(skills): make find-skills installer failures actionable (#8393)
* fix(skills): make find-skills installer failures actionable

* fix(skills): clarify installer guidance and harden tests

* docs(skills): correct installer usage header
2026-11-20 06:27:56 +08:00
Wenchao An
50d04ddf71
feat(coordination): run tasks on managed worker threads (#8387)
* feat(coordination): run tasks on managed worker threads

* fix(coordination): expose task artifact history

* test(boxd): make partial timeout output check deterministic

* fix(coordination): expose task inbox and bound cancellation waits
2026-11-20 06:26:29 +08:00
Bas Cancrinus
b4b489d7f2
feat(helm): optional per-image tags for gateway, frontend and provisioner (#8337)
* feat(helm): optional per-image tags for gateway, frontend and provisioner

All three DeerFlow images take `image.tag`. A backend rebuilt on top of a
release (extra packages such as an optional sandbox SDK, a local fix) needs
its own tag, so the frontend and provisioner then need re-tagged copies of
the release under that tag.

Add `image.gatewayTag`, `image.frontendTag` and `image.provisionerTag`,
empty by default; an empty one falls back to `image.tag`, so existing
values render unchanged.

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

* fix(helm): fail the render on a non-string per-image tag

`--set image.gatewayTag=20261118` passes an integer: printf rendered the
image as `deer-flow-backend:%!s(int64=20261118)`, and `default` silently
replaced an integer 0 with `image.tag`. A shared `deer-flow.imageTag`
helper now fails the render on any non-string override and names
--set-string; README and values.yaml say to quote numeric tags.

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

* fix(helm): check the per-image tag's type, not its kind

Helm 3.18.0 passes an unquoted number from a parent chart's values to the
subchart as a json.Number, whose kind is "string", so kindIs let 7.0 and
0123 through and they rendered as 7 and 83. typeIs rejects them; quoted
tags still render as written. The error now names the Go type.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:28:40 +08:00
kongxin
5991ab936e
fix(runtime): keep an edit replay that pauses for tool approval (#8390)
The edit replay finalizer rolled back every run that did not end in
success, including one waiting for tool approval. The edit was lost, the
resume had nothing to run, and the unanswered interrupt kept blocking new
runs on the thread.

Treat a native pause as the current attempt: skip the rollback and let the
paused attempt replace its source turn in history.
2026-11-19 21:26:58 +08:00
Xinmin Zeng
dab27449b3
perf(tests): eliminate 140s of idle waits and SIGTERM grace timeouts across 7 slow suites (#8374)
* perf(tests): eliminate 140s of idle waits and SIGTERM grace timeouts across 7 slow suites

* test(backend): address review feedback on heartbeat sync, container cleanup, and deadline patch

* test(backend): observe artifact deadline extension at transfer

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-19 20:16:16 +08:00
Xinmin Zeng
3b1578fd91
test(backend): consolidate 57 fragmented single-fix files into 8 module suites (#8372)
* test(backend): consolidate 57 fragmented single-fix files into 8 module suites

* chore(tests): update benchmark README command and remap 603 shard durations

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-19 20:05:04 +08:00
一片一片
585abb979f
fix(gateway): reject unusable delegation state at the input boundary (#8375)
* fix(gateway): reject unusable delegation state at the input boundary

`delegations` is a caller-writable reducer channel. `merge_delegations`
keys on `id`/`run_id`/`dispatch_message_id` and indexes `status`, and the
ledger renderer indexes `description`/`subagent_type` on every model
call, so a non-list value, a non-object entry or a missing field fails
the state merge with an unhandled 500. On the thread-state route the bad
shape is persisted, so every later genuine ledger write keeps failing.

Validate the ledger shape at both caller-writable boundaries and keep
rejecting Overwrite markers and forged verdicts. The reducer also drops
stored values it cannot read, so a checkpoint written before this
validation self-heals instead of failing future writes.

* fix(harness): keep the ledger reducer tolerant of partial entries

The reducer only needs an identity key and a status; the renderer-only
text fields stay a boundary requirement. Dropping entries that lack
description/subagent_type would change reducer semantics for callers
that build minimal entries, so filter only what the reducer reads.

* test(gateway): use valid delegation in provenance check

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-19 11:40:37 +08:00
哈基米
90ca57e97b
fix(mcp): report non-text error results without their payload (#8327)
* fix(mcp): report non-text error results without their payload

When an MCP tool returns isError with no text content, the local conversion
fell back to stringifying the LangChain content blocks. That put the whole
base64 payload into the ToolException message, and the middleware's
500-character cap still left a base64 prefix in the model-visible ToolMessage
and the checkpoint.

Describe the blocks by kind and MIME type instead; text results keep their
existing message unchanged. Applies to stdio tools, which use this conversion;
sse/http tools keep the adapter's conversion (tracked separately).

* fix(mcp): name empty binary error payloads instead of raising

An error result whose embedded file or image had a zero-byte payload hit
create_file_block/create_image_block before the isError branch, so the
model saw ValueError('Must provide one of: url, base64, or file_id')
instead of the server's diagnostic. Skip empty binary payloads on error
results, name their shape in the no-text fallback, and keep normal
results unchanged (audio still raises NotImplementedError).
2026-11-19 11:38:39 +08:00
Bas Cancrinus
c9ecf577c4
fix(helm): drop rollingUpdate when a Deployment strategy is Recreate (#8336)
* fix(helm): drop rollingUpdate when a Deployment strategy is Recreate

The gateway and provisioner default to RollingUpdate with a rollingUpdate
block. Setting only `strategy.type: Recreate` renders both, which the API
server rejects ("may not be specified when strategy type is 'Recreate'").
A direct install can null the block, but a parent chart that depends on
this chart can't: Helm keeps the subchart's default. A single gateway on a
ReadWriteOnce home PVC needs Recreate, since the new Pod can't attach the
volume on another node while the old one holds it.

A `deer-flow.strategy` helper renders the strategy and drops rollingUpdate
for Recreate; both Deployments use it. Defaults render unchanged.

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

* docs(helm): note the Helm 4 server-side apply case when switching to Recreate

A release whose manifest omitted strategy leaves the API-server-defaulted
rollingUpdate unowned; server-side apply then can't remove it and the
switch to Recreate is rejected. Document running that upgrade with
--server-side=false.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 08:10:45 +08:00
Eilen Shin
25a744a99a
fix(harness): reflect progress in loop detection and plan todos (#8248)
* feat(frontend): improve file attachment recovery and artifact presentation

* feat(extensions): add Office artifact previews with search and navigation

* fix: preserve public viewers and HTTP Office previews

* fix: address file preview and upload review findings

* fix: use typed upload errors and linear bookmark allocation

* fix(office-preview): isolate parsing and bound preview resources

* fix(ci): install Office preview fixture dependencies for E2E

* fix(ci): provision matching Playwright browsers before E2E tests

* fix(ci): isolate Python libraries and include Office documentation

* test(frontend): wait for download status to finish rendering

* fix(harness): account for tool results in loop detection

* fix(harness): make tool frequency detection observational

* fix(harness): support blocked and waiting plan todos

* style(harness): wrap overlong system prompt lines

* Improve loop detection and todo message formatting

Refactor middleware logic for handling repeated results and update messages for todo list.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Address plan progress and loop detection review

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-11-19 08:09:43 +08:00
Aling33
6b463d1f1a
fix(sandbox): search user data instead of hiding it as repository noise (#8366)
* fix(sandbox): search user data instead of hiding it as repository noise (#8364)

The ignore list was written to walk source checkouts, but glob, grep and ls ran
it over every root, so /mnt/user-data/uploads hid its own *.log files and a
grep over *.log answered 'No matches found'. grep also skipped any file above
1 MB during a directory walk without saying so, even when the model named the
file itself.

ignore_rules_for() now picks the filter per search root: user-data roots hide
only repository machinery, a glob the caller spelled out wins even inside a
checkout, and a file named as the search root is read at any size. The 1 MB
bound still protects directory walks, and the grep tool documents it.

* fix(sandbox): label user-data roots from the mount table

The public ls/glob/grep tools resolve /mnt/user-data/... to host paths
before they call the local provider, so checking the virtual prefix never
matched a real entry point: an uploaded app.log stayed hidden whenever the
host tree sat inside the checkout the Gateway runs from.

Ask the provider's mount table instead, and keep in-flight .upload-*.part
files hidden in user data as well as in a repository.

* fix(sandbox): keep the repository filter outside user data

Only a root the mount table labels as /mnt/user-data changes behaviour. A
skills mount or an ad-hoc host path keeps hiding *.log as before, so the
existing mounted-root tests stay valid instead of widening content
visibility to every root outside a checkout.

* fix(sandbox): keep an explicit grep budget on a named file

The traversal default stops a directory walk from reading megabytes it was
never asked about. A caller that names one file and passes its own budget
still gets that budget enforced, which the literal-grep suite pins.

---------

Co-authored-by: Aling33 <Aling33@users.noreply.github.com>
2026-11-19 07:55:35 +08:00
KaimLee
ccc1d1ea19
fix(frontend): tolerate project attachment storage failures (#8347)
* fix(frontend): tolerate project attachment storage failures

* fix(frontend): tolerate project attachment storage failures

* test(frontend): cover project attachment storage failures

* test(frontend): keep composer state when storage fails

Added tests to verify behavior when storage operations fail.

* test(frontend): isolate storage spies across attachment tests

Refactored sessionStorage mock implementations for better readability and consistency across tests.

* test(frontend): restore attachment hook spies in cleanup

* test(frontend): cover project attachment storage degradation

* test(frontend): expand project attachment storage coverage

* fix(frontend): preserve pending attachments when storage reads fail

* fix(frontend): keep composer edits local after an unreadable attachment list

---------

Co-authored-by: KaimLee <KaimLee@users.noreply.github.com>
2026-11-19 07:27:04 +08:00
Wenchao An
778dbe456d
feat(coordination): persist task state and ordered inputs (#8346)
* feat(coordination): persist task state and ordered inputs

* fix(persistence): follow numbered migration revision naming
2026-11-19 07:08:56 +08:00
Michiel Voortman
e0cccd6b37
feat(sandbox): add boxd sandbox provider (#8314)
* feat(sandbox): add boxd sandbox provider

Adds deerflow.community.boxd_sandbox:BoxdSandboxProvider. Each user/thread
scope runs in an isolated boxd machine. New machines get the thread's files
and skills before they are handed out, release mirrors outputs back to
thread storage, and released machines wait in the shared warm pool.

The boxd SDK is an optional extra (deerflow-harness[boxd]). Unit tests run
against a fake client; tests/test_boxd_sandbox_live.py runs against real
machines when DEER_FLOW_RUN_LIVE_TESTS=1 and BOXD_API_KEY are set.

* fix(boxd): retain failed cleanup and bound output mirror calls

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-18 21:29:15 +08:00
Hyeonsang Cho
5d69e6e21c
fix(threads): answer 404 when a thread is deleted during a move (#8318)
POST /api/threads/{id}/move takes no thread lock, so a DELETE can remove
the row between set_project and the read-back. The route then built its
response from None and failed with an unhandled 500. Return the route's
existing 404 instead: the thread no longer exists.
2026-11-18 21:22:01 +08:00
yong
8547666a31
feat(search): add DeepSeek web search with configurable thinking (#8299)
* feat(search): add DeepSeek web search with configurable thinking

* fix(search): drain DeepSeek teardown and retain citation spans

Reuse the cancellation-safe context helper so repeated cancellation cannot interrupt HTTP transport cleanup. Preserve validated Unicode citation ranges on retained public sources so the agent can associate claims with their supporting pages. Add regressions for cancellation, timeout, normal completion, invalid ranges, URL screening, and result limits.

* fix(search): preserve DeepSeek citation excerpts through guardrails

* fix(search): share DeepSeek citation excerpts across sources

Group each validated answer range once and associate it with response-local source IDs after URL filtering and result limits. Preserve full-answer PII redaction and existing source-card fields, document the model-facing citation mapping, and repair live-test configuration for both thinking modes. Add HTTP transport, guardrail/budget, attribution, and browser reload regressions.

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-18 21:19:41 +08:00
Hyeonsang Cho
39fa6447e8
fix(auth): strip newlines from the OIDC callback's provider-error log (#8355)
The provider-error branch of GET /api/v1/auth/callback/{provider} logs
the path's provider and the error/error_description query values before
any check, on a public route. A newline in any of them forged a second
line in the text log format, without authentication and even with OIDC
disabled. Pass all three through sanitize_log_param.
2026-11-18 21:16:02 +08:00
Xinmin Zeng
df544f126a
test(backend): prune 32 zero-unique redundant suites and rewrite 9 source-inspection tests (#8362)
* test(backend): prune 32 zero-unique redundant suites and rewrite 9 source-inspection tests

- Remove 32 superseded test files proven lossless across statement/branch coverage (per-test dynamic contexts), hotspot mutation testing (mutmut), and 20 historical bug replays.
- Replace all inspect.getsource and brittle source-string assertions across 9 test files with behavioral runtime assertions.

* test(backend): consolidate hidden-answer and compaction-hash guards and assert protocol defaults

- Fold hidden human-input turn-boundary regressions into tests/test_channels.py while keeping test_channel_hidden_human_input.py removed.
- Fold multimodal source content hashing and unobserved-skip regressions into tests/test_compaction_event_identity.py.
- Assert contract-specific default return values/types (False for bool registrations, empty sequence for middleware contributions, explicit return None for void hooks) in test_extension_api_contracts.py and add stub rejection tests.
2026-11-18 21:13:19 +08:00
NanPan
340822f2c1
fix(checkpoints): preserve channel identity in version comparisons (#8330)
* fix(checkpoints): compare channel versions by identity

* fix(checkpoints): preserve channel identity in retention

* test(checkpoints): cover swapped channel versions in lineage

* test(checkpoints): retain swapped channel-version state

* test(checkpoints): make swapped channel regression deterministic

* style(checkpoints): satisfy Ruff formatting

* fix(checkpoints): preserve version maps in retention paths

* test(checkpoints): keep surviving blobs after sibling pruning

* fix(checkpoints): prune empty-map duration leaves safely
2026-11-18 19:57:37 +08:00
Xinmin Zeng
8d60bef1b4
docs(tests): align contributor test rules with module-suite hygiene and sync 6-shard config (#8361)
- Update AGENTS.md, backend/AGENTS.md, backend/tests/AGENTS.md, and PR template to fold regressions into owning module suites, prune superseded tests, and forbid inspect.getsource assertions.
- Align CONTRIBUTING.md, backend/tests/AGENTS.md, backend/Makefile, and test_make_test_parallel.py with the 6-shard CI configuration.
2026-11-18 19:32:38 +08:00
laoyyu
a50663c2f1
fix(uploads): reject colons in normalize_filename like the skill installer (#8351)
* fix(uploads): reject colons in normalize_filename like the skill installer

normalize_filename() accepted a ':' in the basename, so the three upload
writer paths disagreed for the same name on Windows: the streaming write
(write_upload_file_no_symlink) happily stored the bytes in an invisible
NTFS Alternate Data Stream ("notes.txt:hidden" attaches a stream to
notes.txt; directory listings report the base file with 0 new bytes),
while copy/publish raised WinError 123 outright.

skills.installer.is_unsafe_zip_member already rejects any member path
containing ':' with exactly this rationale (drive letters are caught
earlier as absolute paths; a stray colon addresses an ADS that is
invisible to rglob/os.walk listings). Apply the same rule to upload
filenames so every writer path rejects the name identically.

* docs(uploads): clarify colon rejection and drive paths

---------

Co-authored-by: laoyyu <laoyyu@users.noreply.github.com>
Co-authored-by: Nan Gao <thunderggnn@gmail.com>
2026-11-18 18:55:06 +08:00
Hyeonsang Cho
ec3f3d4d22
fix(threads): strip newlines from message ids in regenerate scan warnings (#8350)
The two scan-limit warnings on the regenerate and edit-replay paths
logged the assistant and user message ids raw. Those ids come from
checkpoint state, and run input keeps a client's message id verbatim,
so a thread owner could start a forged line in the Gateway's text log.
Pass them through sanitize_log_param like the other warnings in the
same functions.
2026-11-18 14:30:44 +08:00
kongxin
5426576fa5
fix(agents): run the calls that fit when a batch crosses a per-tool loop limit (#8267)
* fix(agents): run the calls that fit when a batch crosses a per-tool loop limit

One model response with 50 or more calls to the same tool lost every
call: the per-tool frequency check stopped the run before any of them
ran (#8214).

- A per-tool limit now drops only the calls that would reach it; the
  calls within the limit run. A response in which no call fits still
  stops the run, and the identical-call hard limit still rejects the
  whole batch.
- The capped tool stays blocked for the rest of the execution, whatever
  the frequency window counts. The cap is a record in the private
  loop_cap state channel, so it survives an approval pause, the resume's
  new run_id, a Gateway restart and context compaction. before_agent
  expires a record another run left behind, which gives a later task a
  fresh budget.
- The run is loop_capped from the first dropped call, in the run record
  and in a subagent result. A resumed run is marked again from the
  record.
- The model is told on its next call how many calls were skipped and how
  many were passed on, followed by the wrap-up instructions. The notice
  is read from the record on every model call and cleared once the model
  has answered.
- The Gateway treats loop_cap as a server-owned state channel.
- middleware:loop_detection gains the action reject_excess.

* fix(agents): count after the window eviction and keep the cap record readable

Review follow-up for #8267:

- A call reaches a per-tool limit when the window would hold that many
  calls to its tool after taking the call in and dropping its oldest
  entry, as on main. Counting before the eviction rejected a call that
  only replaced an older call to the same tool, so 49 reads, one other
  call and one more read capped read_file where main admits 49 more.
- The cap record holds only what its reader accepts. A tool whose name
  the reader would reject, or one past the record's size bound, is left
  out instead of making the next read discard every cap in the record.
  The record and its notice are still written, so the drop is explained
  and the execution stays loop_capped.
- A dropped batch is audited once per tool that reached its limit in it,
  with that tool's own count and threshold.
- Tests: a seeded comparison against a plain sliding window, the
  interleaved sequence, unnameable and overflowing records, and the
  per-tool audit rows.

* fix(agents): report a partial loop cap when the run ends, not mid-run

Review follow-up for #8267. runtime.context["stop_reason"] is read in
two ways: the worker and Goal continuation read it when the run is over,
while run-input admission, the todo middleware and end-of-graph input
handling read it mid-run as "the run is ending" and skip their checks.
A partial cap wrote it at the first dropped call, while the admitted
calls of that response still had to run, so those calls skipped the
checks:

- input that arrived during inference no longer cancelled the planned
  calls, so obsolete writes ran after a steer;
- two parallel write_todos calls both ran, each replacing the plan;
- input that arrived as the run finished was dropped.

A response with no call left is still a terminal stop and is reported
at once. A partial cap is reported to the subagent channel at once and
to the run context by after_agent, which runs after the end-of-graph
input handling; another guard's earlier reason is kept. A run that
pauses for approval no longer reports a reason; the run that resumes it
reports loop_capped when it ends.

Tests drive the three cases through real compiled graphs in the lead
chain's middleware order.

* fix(agents): undo a discarded response's loop accounting and report the guard that stopped the run

Third review follow-up for #8267.

- A response whose admitted calls another middleware discards before any
  of them runs (input admission on a steer, approval on calls it cannot
  address) no longer leaves a cap or counts toward a limit. As the next
  model call starts, the frequency window, warnings and cap record go
  back to their state before that response; caps from earlier responses
  stay. Before, a steer whose replacement needed the same tool had that
  write dropped as already capped. The undo runs in wrap_model_call, not
  a before_model hook, so no graph node is added and lead runs do not
  spend an extra super-step per turn of their recursion limit.
- A partial cap reports to both channels only when the run ends, and
  only when no other guard has given the reason it stopped. A subagent
  that a later token-budget stop ended now reports token_capped, as its
  run context does, instead of loop_capped.

Tests drive the steer cases through compiled graphs with real input
admission, including a replacement that uses the capped tool and an
earlier cap that must survive the undo, and the token-budget case sync
and async.

---------

Co-authored-by: AochenShen99 <sac1063467113@hotmail.com>
2026-11-18 14:28:36 +08:00
一片一片
fdb9deab6d
fix(runtime): report a failed scheduled-goal cleanup on the run stream (#8322)
* fix(runtime): report a failed scheduled-goal cleanup on the run stream

The finalizer flips a finished run to `error` when it cannot remove the
occurrence's scheduled goal, but it published no `error` event. The stream
then ended as a success while the record and `/wait` reported the failure:
the web UI raises its run-failure toast and streaming IM channels mark a
turn failed only on that event.

Set the same deferred `terminal_error_frame` the unpersisted delivery
receipt uses, so both finalizer-side terminal errors end the stream the
way the record does.

* fix(runtime): publish a staged error frame only for an error outcome

An interrupt accepted while scheduled-goal cleanup runs keeps the run slot
active. If cleanup then raises, the error is staged, but the cancellation
branch persists `interrupted`; the stale frame made a cancelled run show a
failure toast while the record and `/wait` reported interruption.

Publish `terminal_error_frame` only when the committed outcome is the
error it describes, which also covers a cancellation that wins after the
delivery receipt staged its frame.

The delta cases now set the worker's checkpoint mode, and a new test
cancels the run from inside a failing cleanup.

* fix(runtime): publish a staged error frame only for the committed error

A rollback also commits `RunStatus.error`, so the status check alone still
sent the staged cleanup message while the row and `/wait` said `Rolled
back by user`. Require the frame's message to equal the committed error.

The cancellation test now covers interrupt and rollback over both run
stores and both checkpoint modes; the rollback cases fail without the
message check.
2026-11-18 14:25:53 +08:00