2970 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
3aff322f23 docs: plan upload review remediation 2026-08-06 19:57:55 +08:00
hetaoBackend
9052c1633c docs: design upload review remediation 2026-08-06 19:16:36 +08:00
hetaoBackend
1eed820213 docs: record audited upload adapters 2026-08-06 10:42:34 +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
hetaoBackend
3229b7bed4 docs: plan collision-safe upload fix 2026-08-06 10:02:49 +08:00
hetaoBackend
6fe3ace6cc docs: design collision-safe uploads 2026-08-06 09:47:53 +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