Repository navigation
fix(runtime): bound gateway waits and preserve failure reasons - #1094
mergify[bot] merged 4 commits into
Conversation
XuPeng-SH
left a comment
There was a problem hiding this comment.
The changes stay within the existing runtime owners, and the separation between invocation, discovery and cancellation-settlement budgets is appropriate. Two P2 issues remain: invalid timeout metadata is validated after live discovery, and the new cancellation regression does not actually enforce its 120-second bound. Both can be corrected within the current design.
Validation: 77/78 selected tests passed initially; the unchanged capacity fixture passed in an isolated no-proxy control. Targeted Clippy passed. An additional lifecycle probe reproduced the admission-order defect, and a same-version Tokio probe demonstrated the paused-time assertion gap. Execution evidence is from e3cc297; the latest main merge leaves the complete PR delta byte-identical.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep source re-review of 137cff0 against base 8514005. No new actionable findings.
Both prior P2 findings are fixed in the actual source: timeout metadata is parsed before live discovery or snapshot preparation, with zero-outbound-request regression coverage; the extended-call cancellation test now bounds the final await after advancing 121 virtual seconds, so losing the settlement guard would fail rather than silently auto-advance to the one-hour call budget.
Traced invocation budgets through HTTP dispatch and effectful capability-source calls, separate discovery/semantic-read budgets, per-request copy-on-write isolation, correlated cancellation settlement and non-retryable uncertainty, Edge rollback/generation fencing and retryable close handling, and approval-delivery failure remaining a denial. No new SQL/schema/transaction path or parallel lifecycle/storage owner was introduced. Longer calls can occupy existing endpoint permits longer (default 128 per endpoint, unchanged 8 MiB response cap); no load-performance claim is made.
Change accounting, excluding pure moves (none): implementation +109/-52, net +57; tests/fixtures +377/-5, net +372; documentation +28/-0, net +28; total +514/-57, net +457. Seven regressions added and one existing registration-failure test updated. Added complexity supports concrete long-operation, recovery and diagnostic behavior without removing useful existing paths.
Validation: local cargo fmt and git diff --check passed. No Rust tests completed locally: offline dependencies were unavailable; a subsequent locked build reached runtime compilation and was stopped, with remaining compiler work terminated. Exact-head Test Suite and Static Checks succeeded; runtime CI records 6032 passes and 192 skips, including both corrected regressions. At submission recheck, latest visible checks contain no failure or running check; three scope checks remain skipped and the Mergify queue check is neutral. The live harness had an earlier failed attempt; latest visible harness check is successful, without establishing the earlier failure's source cause.
Publication limitation: authoritative main branch-protection required contexts could not be fully verified because the integration returned 403 Resource not accessible by integration. This is a source-quality approval, not certification that all required CI was independently verified. Submitted at the user's explicit direction after disclosing that limitation. No protection change, CI rerun, branch update or direct merge was performed.
Merge Queue Status
This pull request spent 14 seconds in the queue, including 1 second running CI. Required conditions to merge
|
Summary
Authenticated remote tool calls can outlast the fixed Agent Binding MCP response deadline, while transient Edge registration failures and root approval-delivery failures currently produce misleading diagnostics. This change fixes those boundaries in the existing runtime owners.
capability_descriptors.mcp.metadata.tool_call_timeout_msfor tool-invocation RPCs. Keep the 120-second default and integer 1–3,600,000 ms range. Parse the declaration once at descriptor admission, before live MCP/skill discovery or snapshot setup, then apply the admitted budget to the shared runtime bundle.Related issue
Closes #1092.
Related: #1016. This PR does not close the broader receiving-provider cancellation/settlement work. The separately observed live introspection argument-contract failure is tracked in #1096; this PR does not claim to fix it.
Change type
User and compatibility impact
Existing gateways that omit the optional timeout retain 120 seconds. The authenticated gateway declares the response budget; model-selected tool arguments cannot override it. Invalid explicit declarations return 400 /
agent_binding_capability_ref_invalidbefore either discovery request starts, for both live and snapshot preparation. Side-effect-free discovery keeps its existing budget. Cancellation retains at most 120 seconds to observe the original correlated response; without settlement evidence the outcome remains unknown.Existing Edge reconnect handling can recover from registration storage unavailability without treating valid credentials as permanently rejected. Approval diagnostics now include the actionable policy cause without granting additional permission. No database schema, SDK, deployment defaults, or build recipes change.
Architecture and complexity delta
RuntimeMcpBundle/AgentBindingMcpRuntime, the shared Agent Binding lifecycle assembly,handle_edge_connection, and the existing permission gate. Timeout parsing stays in the MCP owner; the lifecycle validates once before discovery and passes the admitted duration to bundle setup.AuthErrorbranches and the fixed invocation deadline; replaced post-discovery timeout validation with admission-time parsing. No storage or lifecycle state was added.Capability assessment
The existing capability assessment still applies: MCP tool execution and provider admission remain Beta; User Runner execution and permissions/sandbox remain Partial. These changes clarify bounded waits, retryable setup failures and denied-approval diagnostics within already supported profiles. They do not certify remote cancellation settlement (#1016), universal sandbox containment, autonomous repository-build stability, or a new maturity level. The transport-budget contract is documented in
docs/design/capability-provider-runtime.md.Verification
Current head:
137cff045c0bcfd5e3ee1ae8c522594900e01513, including upstream main8514005c730a98f9b80141e1882f7b46c8f68227.invalid_mcp_timeout_is_rejected_before_live_or_snapshot_discoveryandextended_gateway_call_keeps_cancellation_settlement_bounded(runtime job). The first asserts the same 400/code for both preparation paths with no outbound discovery; the second requires completion within a one-second virtual window after advancing 121 seconds. No local mutation-test execution is claimed.introspection_reflection_source_boundaryfailed theintrospectargument predicates fordepth=diagnosticandhorizon=recent; both diagnostic tool calls, their order, successful outcomes and final scope judgment passed. Readiness, model registration and preflight passed. Safe public artifacts withhold the original arguments, so the root cause is not established. The observation/schema-selection paths and case are unchanged by this PR. Evidence and investigation are tracked in #1096, without claiming a model-only cause or a fix.abc1f6ddfpassed its live harness 18/18; latest-main control8514005calso passed. These controls do not establish this head as live-harness green or explain its failure.make format-checkandgit diff --checkPASS; static review completed. No local Rust tests, Clippy, test recompilation, live-model scenarios or deployment were started, as requested by the user.TMPDIR=/private/tmpPASS (134 tests, 5 existing skips). The local MCP Rust build was stopped before test execution; permission/Edge tests and Clippy were not run locally.Final checklist