1203 Commits

Author SHA1 Message Date
hetaoBackend
01dcb029e6 test: avoid inode reuse assumptions 2026-08-07 10:56:37 +08:00
hetaoBackend
4ab62ad51e fix: clear upload CodeQL findings 2026-08-07 06:48:55 +08:00
hetaoBackend
f0e7e4fcda fix: preserve raced hardlink upload targets 2026-08-07 06:31:39 +08:00
hetaoBackend
4f5dcd61dc fix: harden upload deletion recovery retries 2026-08-07 06:16:10 +08:00
hetaoBackend
e579c95356 fix: repersist upload deletion phase markers 2026-08-07 05:57:26 +08:00
hetaoBackend
5d4d75ad9b fix: persist upload deletion recovery roots 2026-08-07 05:47:31 +08:00
hetaoBackend
3898cc0a5c fix: make upload deletion recovery crash-consistent 2026-08-07 05:36:31 +08:00
hetaoBackend
de9f9eb941 fix: persist remote deletion finalization guards 2026-08-07 05:15:49 +08:00
hetaoBackend
5650a80b0e fix: bind remote deletion recovery to sandbox incarnations 2026-08-07 04:57:40 +08:00
hetaoBackend
f6ec5d4ce6 fix: make remote deletion recovery provider safe 2026-08-07 04:13:55 +08:00
hetaoBackend
732cd95f83 fix: bind remote upload deletion generations 2026-08-07 03:48:11 +08:00
hetaoBackend
bd964166f5 fix: persist remote upload deletion recovery 2026-08-07 03:25:59 +08:00
hetaoBackend
16979184ac fix: make upload deletion and sandbox creation transactional 2026-08-07 02:58:31 +08:00
hetaoBackend
86fa061772 fix: close sandbox contract and deletion recovery races 2026-08-07 02:30:57 +08:00
hetaoBackend
50e06aa2d4 fix: stabilize sandbox mount transitions 2026-08-07 02:02:19 +08:00
hetaoBackend
977be0d445 fix: recover upload deletes and revalidate remote sandboxes 2026-08-07 01:29:13 +08:00
hetaoBackend
5457406cc0 fix: close upload rollback and rollout races 2026-08-07 00:58:11 +08:00
hetaoBackend
8cddb8663a fix: harden upload mount and deletion contracts 2026-08-07 00:31:17 +08:00
hetaoBackend
9f03fa7563 fix: close upload upgrade compatibility gaps 2026-08-06 23:52:07 +08:00
hetaoBackend
ec7e5e5db1 fix: preserve upload edge-case compatibility 2026-08-06 23:26:24 +08:00
hetaoBackend
297bee0a70 fix: prevent upload lease deadlocks 2026-08-06 23:04:37 +08:00
hetaoBackend
a8f00f30fd fix: close remaining upload lifecycle races 2026-08-06 22:36:37 +08:00
hetaoBackend
96ba5dccd0 fix: coordinate upload aliases at commit 2026-08-06 22:14:24 +08:00
hetaoBackend
783920f75a fix: close upload rollback gaps 2026-08-06 22:01:42 +08:00
hetaoBackend
0082631e23 fix: synchronize every upload ingress 2026-08-06 21:44:08 +08:00
hetaoBackend
cfe2b75588 fix: close upload review gaps 2026-08-06 21:19:43 +08:00
hetaoBackend
d38063b49c fix: enforce local removal mappings 2026-08-06 21:04:22 +08:00
hetaoBackend
e75981a873 docs: clarify upload sandbox boundaries 2026-08-06 20:55:36 +08:00
hetaoBackend
6416c2787a fix: harden upload lifecycle rollback 2026-08-06 20:55:31 +08:00
hetaoBackend
a540ff46a9 docs: document upload generation leases 2026-08-06 20:24:02 +08:00
hetaoBackend
83e908bfe3 fix: mount upload conversions read-only 2026-08-06 20:22:10 +08:00
hetaoBackend
920dc247d2 fix: retain upload leases through adapter sync 2026-08-06 20:19:13 +08:00
hetaoBackend
cadb3a444a fix: retain upload leases through gateway sync 2026-08-06 20:14:23 +08:00
hetaoBackend
797dc97931 fix: bind conversions to upload generations 2026-08-06 20:07:18 +08:00
hetaoBackend
01c5c2099f fix: lease published upload generations 2026-08-06 20:03:06 +08:00
hetaoBackend
d170c7e088 fix: harden remaining inbound upload paths 2026-08-06 10:42:34 +08:00
hetaoBackend
e818efc9e8 fix: preserve missing-upload delete contract 2026-08-06 10:34:43 +08:00
hetaoBackend
8a3cb391f6 docs: define collision-safe upload layout 2026-08-06 10:27:19 +08:00
hetaoBackend
d1f41a9d57 fix: make Feishu attachments collision-safe 2026-08-06 10:24:33 +08:00
hetaoBackend
a0d26e446c fix: make inbound attachments collision-safe 2026-08-06 10:22:27 +08:00
hetaoBackend
0d06a37773 fix: preserve embedded client uploads 2026-08-06 10:18:37 +08:00
hetaoBackend
09d3fc04cd fix: make gateway uploads collision-safe 2026-08-06 10:15:17 +08:00
hetaoBackend
b513921c60 fix: isolate generated upload conversions 2026-08-06 10:11:10 +08:00
hetaoBackend
61ca275131 fix: publish uploads without overwriting 2026-08-06 10:07:38 +08:00
lllyfff
99c926b7bb
fix(mcp): bring-up has no timeout and externalized tool outputs are counted as undelivered artifacts (#4657)
* fix: bound MCP server bring-up timeouts and exclude externalized tool outputs from delivery verification

Two related robustness fixes:

1. MCP server bring-up was unbounded. tool_call_timeout only covered
   session.call_tool(); tool discovery (subprocess spawn + initialize +
   tools/list) and persistent stdio session initialization could hang
   forever, blocking agent construction (and on the Gateway event loop,
   the whole process). Add a per-server session_init_timeout
   (default DEFAULT_MCP_SESSION_INIT_TIMEOUT = 60s, null disables) that
   bounds both discovery and pooled-session initialization. The session
   pool's existing cancellation handling tears down a session stuck
   mid-creation in its own task.

2. ToolOutputBudgetMiddleware externalizes oversized tool outputs into
   outputs/.tool-results/ (configurable tool_output.storage_subdir). The
   workspace-change scanner and run delivery verification counted those
   files as produced artifacts, so any run that externalized a tool output
   without also presenting a real artifact failed with
   "Artifact delivery incomplete". Exclude TOOL_RESULTS_DIRNAME via a
   shared constant (mirroring BROWSER_FRAMES_DIRNAME) and thread the
   configured storage_subdir through snapshot capture so both
   workspace-changes events and delivery verification stay clean.

* review: enforce single-segment tool_output.storage_subdir; document discovery-timeout cleanup

Address review feedback:

1. A custom tool_output.storage_subdir with a path separator (e.g.
   cache/tool-results) silently no-oped the workspace-scanner exclusion:
   os.walk yields one-segment dirnames, so a nested value never matched and
   its files were counted as produced artifacts again. ToolOutputConfig now
   validates storage_subdir as a single directory name (rejects separators,
   .., absolute, empty) with tests, so the exclusion is always sound.

2. The discovery-timeout path now documents why cancellation is safe, mirroring
   the session-init note: discovery runs inside the adapter's nested async
   context managers, and stdio_client's finally terminates the process tree
   (SIGTERM->SIGKILL on POSIX, process-tree on Windows), so a timed-out npx
   subprocess and its children are reaped rather than accumulating.

* review: log session-init timeouts and align API response model default with runtime config

Address second-round review feedback:

1. A session-init timeout raised TimeoutError without any log, unlike the
   discovery timeout which logs a WARNING. Wrap the bounded get_session in a
   try/except that logs the timeout (server name + seconds) and re-raises, so
   operators can diagnose tool-call failures caused by hung MCP sessions.

2. McpServerConfigResponse.session_init_timeout defaulted to None while
   McpServerConfig defaults to 60s: a server created via PUT /api/mcp/config
   without the field was persisted with null (no timeout) while the same
   server created in the config file got 60s. Align the response-model default
   to DEFAULT_MCP_SESSION_INIT_TIMEOUT so API-created and file-created servers
   behave the same; an explicit null still opts out.

* review: narrow the discovery-timeout handler to the bounded wait_for path

The except TimeoutError clause covered both the bounded wait_for branch and
the bare discovery branch. With session_init_timeout opted out (None), a
TimeoutError raised by discovery itself would hit the %.1f format with None:
logging raises TypeError internally, the WARNING is silently dropped, and a
--- Logging error --- traceback goes to stderr.

Narrow the handler to wrap only the wait_for call, where the branch condition
guarantees the timeout value is not None. A discovery-internal TimeoutError on
the opted-out path now falls through to the generic failure handler and is
reported as 'tool discovery failed' with exc_info. Covered by a regression
test that asserts the skip is reported without any broken format.
2026-08-05 08:56:18 +08:00
ajayr
d732b90dc3
feat(channels): add Buzz (Nostr) channel connector (#4649)
* feat(channels): add Buzz (Nostr) channel connector

Adds a Buzz (https://github.com/block/buzz) channel so DeerFlow can join a
Nostr-relay workspace as a member: it answers @mentions in channels, replies
to DMs, and streams answers by editing one message in place.

  * app/channels/buzz_nostr.py — pure NIP-01 helpers: canonical event ids,
    BIP-340 signing/verification, chat/edit/auth builders, relay frames.
  * app/channels/buzz.py — BuzzChannel: one NIP-42-authenticated websocket,
    channel discovery (kind 39000) with one subscription per channel, live
    membership tracking (44100/44101), per-channel replay watermarks, and
    replies posted once then edited in place (kind 40003).
  * app/channels/buzz_run_policy.py — same-thread serialization, mirroring
    the Feishu precedent.

Inbound is gated in order: signature verification, self-drop, /connect
bind-and-return, pubkey allowlist, then mention / DM / mention-free /
thread-follow. Off by default; needs the new optional `buzz` extra
(coincurve, lazily imported), which detect_uv_extras resolves from
channels.buzz.enabled the same way it already handles channels.discord.

Two relay behaviours drove the design and are worth knowing when reviewing:
a global {"kinds":[9]} subscription receives nothing from buzz-relay and a
multi-value "#h" filter receives nothing either, so one REQ per channel is
required; and a single global `since` cursor skips quiet channels, so
watermarks are per channel.

Signed-off-by: Ajay R <ajayr@formbuddy.com>

* fix(channels): only publish assistant messages from the IM stream

`_accumulate_stream_text` decided what streamed `messages-tuple` payloads
become displayable text by rejecting ONLY payloads whose `type` contained
"tool", so it published everything else. DeerFlow writes hidden model
context into the messages channel as ordinary messages -- memory recall and
the rewritten user turn as hidden HumanMessages (DynamicContextMiddleware),
the `<durable_context_data>` block as another (DurableContextMiddleware) --
and LangGraph fans those state writes out on the messages stream, so they
reached every streaming IM channel as the assistant's reply.

Proved live on a Buzz relay: the connector published a `<memory>` fact block
and, in another run, a verbatim echo of the user's own inbound message.
Affects Feishu, Telegram, WeCom and Buzz; worst on Buzz, where each update
is an immutable public Nostr event that a corrective edit cannot unpublish.

Invert the filter to an allowlist of assistant message types. Two new pure
helpers keep it testable:

- `_stream_payload_type` resolves the type from both shapes the function
  already handles: the `model_dump()` shape the gateway emits, and
  LangChain's `to_json()` constructor shape whose own `type` is the literal
  "constructor" and whose class name is the tail of the `id` path.
- `_is_assistant_stream_type` matches "ai"/"assistant" by PREFIX, not
  substring -- ordinary words contain "ai" ("chain", "domain"), and a
  substring test would admit a foreign type name by accident.

The bare-`str` branch is removed: an untyped payload cannot be attributed to
the assistant, nothing in DeerFlow produces one (serialize_messages_tuple
always emits `[message_dict, metadata]`), and a runtime that emitted raw text
deltas would emit hidden context the same way. Per-message-id buffering and
merging are unchanged.

Tests pin both directions, including multi-chunk merging across one message
id, so the allowlist cannot silently kill streaming, plus an end-to-end
`_handle_streaming_chat` test asserting the live payload never reaches an
outbound message.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Ajay R <ajayr@formbuddy.com>

* chore(helm): bump config_version to 33 in chart values and README

config.example.yaml moved to 33 for the buzz channel block; the chart's
embedded config example and its README copy track it (config_version only
drives the outdated-config warning, per scripts/check_config_version.sh).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Ajay R <ajayr@formbuddy.com>

---------

Signed-off-by: Ajay R <ajayr@formbuddy.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-05 08:29:22 +08:00
Felix Wang
61c153ff09
feat(tui): add transparent terminal background (#4631)
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-08-05 08:15:28 +08:00
Baldwinzc
2e9ee329ce
fix(middleware): sanitize bare string blocks in list-form user content (#4668)
InputSanitizationMiddleware's text extraction only collected dict blocks
with type == "text", so a HumanMessage whose content list carried a bare
str item (a shape message_content_to_text treats as text and some IM/SDK
clients send) yielded no text at all — the request passed through
unwrapped and unescaped, letting forged framework tags (<system-reminder>
etc.) reach the model untouched.  The sibling rfind-fallback path in
_process_request already neutralized bare strings individually, and both
ToolResultSanitizationMiddleware and ToolOutputBudgetMiddleware treat
bare strings as text; the extraction helper was the odd one out.

Collect bare string blocks alongside text-block dicts (skipping empty
items, matching message_content_to_text), merging them into the single
sanitized text block on rebuild while interleaved non-text blocks keep
their positions.
2026-08-05 08:06:01 +08:00
dependabot[bot]
9d6633c1e3
build(deps): bump aiohttp from 3.14.1 to 3.14.3 in /backend (#4682)
Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.14.1 to 3.14.3.
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](https://github.com/aio-libs/aiohttp/compare/v3.14.1...v3.14.3)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-version: 3.14.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-05 07:46:46 +08:00
Xinmin Zeng
74692fec12
fix(tools): resolve presented files with runtime user (#4677) 2026-08-05 07:43:54 +08:00