Skip to content

Fixes #7951: Add bounded local and remote MCP resource admission - #8095

Open
BobSong-dev wants to merge 67 commits into
apache:masterfrom
BobSong-dev:feat/agent-gateway-resource-admission-7951
Open

BobSong-dev wants to merge 67 commits into
apache:masterfrom
BobSong-dev:feat/agent-gateway-resource-admission-7951

Conversation

@BobSong-dev

@BobSong-dev BobSong-dev commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7951

Dependency

This PR is ready for review and still depends on #8002. The request-scoped MCP client and execution prerequisites #7860 and #7921 were merged into master on October 30, 2026, and their merge commits are ancestors of this branch. The branch also contains the current #8002 head, b9a5bdc72. After #8002 is merged, this branch will be synchronized with master so the final patch contains only the resource-admission delta.

Background

Agent Gateway MCP execution currently has no upper bound on concurrent local tool executions or calls to an individual remote MCP server. A burst of tool calls can therefore monopolize gateway threads or outgoing connections, and one slow remote server can affect unrelated callers.

Changes

  • Added strict admission configuration with defaults and hard maxima for global, local, and remote in-flight executions and queue capacities.
  • Added deadline-aware bounded queues for global, local, and per-remote-server admission; overflow returns JSON-RPC -32026 with HTTP 429, and queue deadline expiry returns -32026 with HTTP 504.
  • Ensured admission wraps the actual local and remote executions, queued work canceled before execution does not consume a permit, and terminal state releases each admission scope exactly once.
  • Replaced remote admission only after credential resolution and lifecycle refresh succeed, and safely closes retired controllers and removes their metrics registration.
  • Exposed fixed-scope admission metrics (global, local, and remote) without tool, subject, tenant, or endpoint labels.
  • Added regression coverage for concurrency limits, queue overflow and timeout, cancellation before execution, terminal release, hot configuration replacement, dispatcher integration, and metrics collection.
  • Documented the admission behavior and configuration boundaries.

Verification

Review follow-up at c3487f507

The complete AgentToolRegistryTest.java already imports java.util.Set at line 38 and java.util.concurrent.atomic.AtomicInteger at line 40. Both imports also exist on master; they are unchanged context rather than added lines in this PR's diff.

  • Clean JDK 21 reactor build and selected tests: AgentToolRegistryTest, AgentResourceAdmissionTest, AgentMcpHttpHandlerTest, AgentGatewayPluginConfigurationTest, AgentInvocationAuditBridgeTest, and AiRequestObservationTest — 157 tests, 0 failures, 0 errors, 0 skipped.
  • The command included clean test and rebuilt test sources, rather than relying on previously compiled classes. Lifecycle Checkstyle passed.

Earlier implementation verification

  • shenyu-common: 655 tests, 0 failures, 0 errors, 1 pre-existing skip.
  • shenyu-plugin-agent-gateway: 620 tests, 0 failures, 0 errors, 0 skipped.
  • shenyu-spring-boot-starter-plugin-agent-gateway: 196 tests, 0 failures, 0 errors, 0 skipped.
  • shenyu-plugin-metrics: 26 tests, 0 failures, 0 errors, 0 skipped.
  • Windows and RISC-V/QEMU produced the same results for the four modules above.
  • After merging the then-current master, shenyu-plugin-ai-proxy passed 337 tests with 0 failures, errors, and skips on Windows; the same module passed on RISC-V/QEMU.
  • Checkstyle, RAT, and git diff --check checks passed for the verified module scope; the cached whitespace check only reported pre-existing warnings from master.

These earlier results apply to their original implementation snapshots, not a new full-suite run on the latest head.

…ateway-p105

# Conflicts:
#	shenyu-plugin/shenyu-plugin-agent-gateway/src/main/java/org/apache/shenyu/plugin/agent/gateway/AgentGatewayPlugin.java
#	shenyu-plugin/shenyu-plugin-agent-gateway/src/main/java/org/apache/shenyu/plugin/agent/gateway/protocol/AgentMcpHttpHandler.java
#	shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-proxy/src/main/java/org/apache/shenyu/plugin/ai/proxy/enhanced/service/AiProxyEngine.java
#	shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-agent-gateway/src/main/java/org/apache/shenyu/springboot/starter/plugin/agent/gateway/AgentGatewayPluginConfiguration.java
@Aias00

Aias00 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

agent_gateway_migrations failure: root cause found

The failing case is test_quoted_null_is_not_a_null_literal, and it is not a flaky test — it is caused by the sort change in this PR.

db/upgrade/2.7.1-upgrade-2.7.2-mysql.sql now writes:

INSERT INTO `namespace_plugin_rel` (...) VALUES (...,'68', NULL, 169, 0, ...);

but the regression test uses the real file content as its fixture and does a literal string replacement:

# .github/scripts/test-agent-gateway-migrations.py:87
changed = self.migration.replace("'68', NULL, 198", "'68', 'NULL', 198")
with self.assertRaisesRegex(ValueError, "mismatch"):
    CHECK.check_pair(self.schema, changed)

Since '68', NULL, 198 no longer exists in the file, replace() is a no-op, changed == self.migration, check_pair sees a consistent pair and raises nothing — hence AssertionError: ValueError not raised.

The sort 198 -> 169 change itself looks intentional and fine. The fix belongs in the test: locate the NULL position structurally instead of hardcoding the literal, e.g.

changed, n = re.subn(r"('68', )NULL(, \d+)", r"\1'NULL'\2", self.migration, count=1)
self.assertEqual(1, n, "fixture drifted: no '68', NULL, <sort> row found")

The assertEqual on the substitution count matters — without it the test silently degrades into a no-op whenever the SQL is reformatted, which is exactly what happened here.

Same failure is present on the other four Agent Gateway PRs of this series (#7860, #7864, #7921, #8002), so fixing it once in the script and rebasing them will clear all five.

@BobSong-dev

Copy link
Copy Markdown
Contributor Author

agent_gateway_migrations failure: root cause found

The failing case is test_quoted_null_is_not_a_null_literal, and it is not a flaky test — it is caused by the sort change in this PR.失败的案例是 test_quoted_null_is_not_a_null_literal 的,这不是不靠谱的测试——它是由于这次 PR 的分类变化引起的。

db/upgrade/2.7.1-upgrade-2.7.2-mysql.sql now writes:db/upgrade/2.7.1-upgrade-2.7.2-mysql.sql 现在写道:

INSERT INTO `namespace_plugin_rel` (...) VALUES (...,'68', NULL, 169, 0, ...);

but the regression test uses the real file content as its fixture and does a literal string replacement:但回归测试使用真实文件内容作为固定,并进行字面字符串替换:

# .github/scripts/test-agent-gateway-migrations.py:87
changed = self.migration.replace("'68', NULL, 198", "'68', 'NULL', 198")
with self.assertRaisesRegex(ValueError, "mismatch"):
    CHECK.check_pair(self.schema, changed)

Since '68', NULL, 198 no longer exists in the file, replace() is a no-op, changed == self.migration, check_pair sees a consistent pair and raises nothing — hence AssertionError: ValueError not raised.由于 “68”,NULL,198 已不存在于文件中,replace() 是 no-op, 改动 == self.migration,check_pair 看到一致的对,但不提出任何问题——因此 AssertionError: ValueError 未被提出 。

The sort 198 -> 169 change itself looks intentional and fine. The fix belongs in the test: locate the NULL position structurally instead of hardcoding the literal, e.g.198%-3E 169 的变更看起来是有意为之且没问题的。 修复应该在测试中进行:结构性地定位 NULL 位置,而不是硬编码文字,例如:

changed, n = re.subn(r"('68', )NULL(, \d+)", r"\1'NULL'\2", self.migration, count=1)
self.assertEqual(1, n, "fixture drifted: no '68', NULL, <sort> row found")

The assertEqual on the substitution count matters — without it the test silently degrades into a no-op whenever the SQL is reformatted, which is exactly what happened here.替换计数的主张 Equal 很重要——没有它,测试在 SQL 被重新格式化时会默默降级为 no-op,这正是这里发生的情况。

Same failure is present on the other four Agent Gateway PRs of this series (#7860, #7864, #7921, #8002), so fixing it once in the script and rebasing them will clear all five.本系列其他四个 Agent Gateway PR 也出现同样的故障( #7860 , #7864 , #7921 , #8002 ),所以在脚本中修复一次并重新基准它们,就能清除全部五个。

Thanks for your review. But it depends on the forward PR.so it caused failure.

@BobSong-dev
BobSong-dev marked this pull request as ready for review October 26, 2026 02:45
Aias00
Aias00 previously approved these changes Oct 26, 2026

@Aias00 Aias00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Large but well-organized PR. Three coherent areas:

  1. Agent resource admission - AgentMcpResourceAdmission / AgentResourceAdmission enforce allow-lists (mirroring the existing tool/path admission model) and integrate into AgentMcpDispatcher and AgentMcpHttpHandler.
  2. AI proxy observability - AiRequestObservation, AiUpstreamUsageTap, AiObservationSupport, outbound trace context, and Prometheus collectors (AgentAdmissionMetricsCollector, AgentCatalogMetricsCollector, AgentRuntimeMetricsReporter) extend the metrics story.
  3. Audit bridge - AgentInvocationAuditBridge composes an optional audit sink with the existing observers without altering traffic, swallowing sink failures.

The audit safely() wrapping and the decision/reason mapping in emit() are sensible.

Coordination needed:

  • This PR and #7669 both modify AgentMcpDispatcher.java (resource path). They should be merged in sequence; #7669 first if it carries the base resource dispatcher, then rebase #8095. Please confirm the merge order and resolve any dispatcher conflicts.
  • AiProxyApiKeyServiceImpl.convert now returns id; verify the admin UI/serialization expects the key id field.

Approving the design; please coordinate the #7669/#8095 ordering.

…to integration/agent-gateway-p105

# Conflicts:
#	.github/scripts/test-agent-gateway-migrations.py
#	shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-proxy/src/main/java/org/apache/shenyu/plugin/ai/proxy/enhanced/service/AiProxyEngine.java
#	shenyu-plugin/shenyu-plugin-metrics/src/main/java/org/apache/shenyu/plugin/metrics/reporter/MetricsReporter.java
#	shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-agent-gateway/src/main/java/org/apache/shenyu/springboot/starter/plugin/agent/gateway/AgentGatewayPluginConfiguration.java
@Aias00

Aias00 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Hi @BobSong-dev, this PR was approved, but the squash-merge could not be completed because it now has merge conflicts.

This PR and #7669 both modify AgentMcpDispatcher.java; #7669 (MCP resources registry/dispatcher) was just merged into master ahead of this one. Your branch feat/agent-gateway-resource-admission-7951 therefore conflicts with the merged dispatcher.

Please rebase your branch onto the latest master so your resource-admission changes apply on top of #7669's dispatcher, resolve the AgentMcpDispatcher conflict, and let CI re-run. Once green, we can squash-merge. Thanks!

…nt-gateway-audit-7950-integration

# Conflicts:
#	shenyu-plugin/shenyu-plugin-agent-gateway/src/main/java/org/apache/shenyu/plugin/agent/gateway/protocol/AgentMcpDispatcher.java
#	shenyu-plugin/shenyu-plugin-agent-gateway/src/main/java/org/apache/shenyu/plugin/agent/gateway/protocol/AgentMcpExecutionContext.java
#	shenyu-plugin/shenyu-plugin-agent-gateway/src/main/java/org/apache/shenyu/plugin/agent/gateway/protocol/AgentMcpHttpHandler.java
#	shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-proxy/src/main/java/org/apache/shenyu/plugin/ai/proxy/enhanced/service/AiProxyEngine.java
#	shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-proxy/src/test/java/org/apache/shenyu/plugin/ai/proxy/enhanced/AiProxyPluginTest.java
#	shenyu-plugin/shenyu-plugin-metrics/src/main/java/org/apache/shenyu/plugin/metrics/reporter/MetricsReporter.java
#	shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-agent-gateway/src/main/java/org/apache/shenyu/springboot/starter/plugin/agent/gateway/AgentGatewayPluginConfiguration.java
#	shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-ai-proxy/src/main/java/org/apache/shenyu/springboot/starter/plugin/ai/proxy/AiProxyPluginConfiguration.java
…nt-gateway-audit-7950-integration

# Conflicts:
#	shenyu-plugin/shenyu-plugin-metrics/src/main/java/org/apache/shenyu/plugin/metrics/reporter/MetricsReporter.java
#	shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-agent-gateway/src/main/java/org/apache/shenyu/springboot/starter/plugin/agent/gateway/AgentGatewayPluginConfiguration.java
@codecov-commenter

codecov-commenter commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.73394% with 126 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.26%. Comparing base (1748a0e) to head (5c87f99).
⚠️ Report is 1391 commits behind head on master.

Files with missing lines Patch % Lines
...henyu/common/audit/AgentInvocationAuditBridge.java 58.53% 12 Missing and 5 partials ⚠️
...e/shenyu/common/metrics/AgentAdmissionMetrics.java 0.00% 17 Missing ⚠️
...agent/gateway/protocol/AgentResourceAdmission.java 90.96% 9 Missing and 7 partials ⚠️
...shenyu/common/audit/AgentInvocationAuditEvent.java 88.77% 10 Missing and 1 partial ⚠️
...ent/gateway/protocol/AgentMcpExecutionContext.java 41.17% 9 Missing and 1 partial ⚠️
...g/apache/shenyu/plugin/key/auth/KeyAuthPlugin.java 47.05% 8 Missing and 1 partial ⚠️
.../org/apache/shenyu/common/dto/ProxyApiKeyData.java 0.00% 8 Missing ⚠️
...agent/audit/AgentInvocationAuditConfiguration.java 0.00% 7 Missing ⚠️
...shenyu/common/dto/AgentGatewayAdmissionConfig.java 76.92% 3 Missing and 3 partials ⚠️
.../agent/gateway/remote/ManagedRemoteMcpCatalog.java 64.70% 6 Missing ⚠️
... and 11 more
Additional details and impacted files
@@              Coverage Diff              @@
##             master    #8095       +/-   ##
=============================================
+ Coverage     61.49%   72.26%   +10.77%     
- Complexity     8818    18871    +10053     
=============================================
  Files          1261     1812      +551     
  Lines         39273    70642    +31369     
  Branches       3725     8361     +4636     
=============================================
+ Hits          24151    51052    +26901     
- Misses        12952    15312     +2360     
- Partials       2170     4278     +2108     
Flag Coverage Δ
admin 75.72% <100.00%> (?)
client-register-registry 54.30% <ø> (?)
core 66.83% <71.22%> (?)
dist-extra 62.04% <ø> (?)
gateway-runtime 83.70% <ø> (?)
plugin-ai 77.34% <86.03%> (?)
plugin-base 80.35% <93.33%> (?)
plugin-logging 76.65% <ø> (?)
plugin-proxy 77.25% <47.05%> (?)
starters 75.32% <81.63%> (?)
starters-agent 93.76% <96.66%> (?)
sync 66.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Aias00 Aias00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stream Agent analysis

FINAL synthesis of PR #8095 (apache/shenyu) at head ab421f7. Cross-file review of 37 partitions (complete_diff true, CI passed) shows all_parts_passed=false due to two child NEEDS_CHANGES with HIGH defects: missing AtomicInteger import in AgentToolRegistryTest.java (part-17) and incorrect audit target assertion in AgentInvocationAuditBridgeTest.java (part-7). No other cross-file blockers identified. Verdict NEEDS_CHANGES.

Evidence

  • part-17 blocking finding: AtomicInteger used but not imported (line 61, RIGHT, HIGH)
  • part-7 blocking finding: assertion expects target 'fallback' but observation context 'one' has no target (line 60, RIGHT, HIGH)
  • FINAL synthesis: all_parts_passed=false, complete_diff=true, CI passed=true, head ab421f7

Recommended next steps

  • Add missing import java.util.concurrent.atomic.AtomicInteger in shenyu-plugin/shenyu-plugin-agent-gateway/src/test/java/org/apache/shenyu/plugin/agent/gateway/tool/AgentToolRegistryTest.java
  • Fix incorrect target assertion at line 60 of shenyu-common/src/test/java/org/apache/shenyu/common/audit/AgentInvocationAuditBridgeTest.java to align with observation context
  • Re-run CI and partition reviews after test fixes

Scope: captured diff and GitHub check metadata only; no local tests were executed.

Task: 52bc6ca4-a601-4f4b-9dae-26878243c2ca · Commit: ab421f7f4bb219a495e371ed7e28f956541e453d

Review verdict: NEEDS_CHANGES

SYNTHESIS/FINAL: Assessed all 37 child partition summaries. Global complete_diff=true, CI passed=true, but all_parts_passed=false because part-17 and part-7 returned NEEDS_CHANGES with anchored HIGH defects. Per rules, child NEEDS_CHANGES cannot be overridden to PASS. The defects are concrete: missing import causing compilation failure and incorrect test assertion contradicting sibling tests. No other cross-file blockers evident. Therefore FINAL verdict is NEEDS_CHANGES.

Publication: REQUEST_CHANGES (VERIFIED_BLOCKING_FINDINGS)

  • shenyu-plugin/shenyu-plugin-agent-gateway/src/test/java/org/apache/shenyu/plugin/agent/gateway/tool/AgentToolRegistryTest.java:61 [RIGHT] AtomicInteger is used but not imported; missing 'import java.util.concurrent.atomic.AtomicInteger;' will cause compilation failure of the test.
  • shenyu-common/src/test/java/org/apache/shenyu/common/audit/AgentInvocationAuditBridgeTest.java:60 [RIGHT] Assertion expects logical audit record (records.get(2)) to have target "fallback", but observation was created with context("one") without a target; attempt targets are set on separate attempt contexts. This contradicts sibling tests where logical target derives from observation context, likely causing test failure or wrong contract enforcement.

Review details

Recommendation: Do not merge until the two test defects are fixed. 1) Add import java.util.concurrent.atomic.AtomicInteger; to AgentToolRegistryTest.java (line 61). 2) Correct the logical audit record target assertion in AgentInvocationAuditBridgeTest.java line 60 to match observation context without target. After fixes, re-run CI and partition reviews.

@Aias00 Aias00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stream Agent analysis

FINAL synthesis of PR #8095 (apache/shenyu) at head c3487f5. Across 37 partition reviews, 36 passed and part-17 (AgentToolRegistryTest.java) returned NEEDS_CHANGES due to missing imports for AtomicInteger and Set, causing test compilation failure. CI status is complete but passed=false. Complete diff was reviewed in partitions (global_complete_diff=true). Cross-file interactions among admission controller, config, plugin wiring, and audit appear consistent in passing partitions, but the test compilation blocker and failed CI prevent a PASS. Verdict: NEEDS_CHANGES.

Evidence

  • Child review part-17: NEEDS_CHANGES with HIGH findings on AgentToolRegistryTest.java lines 61 and 77 (missing AtomicInteger and Set imports)
  • CI summary: complete=true, passed=false, check_count=9
  • all_parts_passed=false; global_complete_diff=true; head_sha=c3487f5070d2ba889f206a2fe7b4991195b5b3ab

Recommended next steps

  • Add imports for java.util.concurrent.atomic.AtomicInteger and java.util.Set in shenyu-plugin/shenyu-plugin-agent-gateway/src/test/java/org/apache/shenyu/plugin/agent/gateway/tool/AgentToolRegistryTest.java
  • Re-run CI to confirm compilation and tests pass after import fix
  • Validate cross-module contracts with prerequisite PRs since PR is draft building on unmerged work

Scope: captured diff and GitHub check metadata only; no local tests were executed.

Task: f65486a0-5d0e-4ea6-81c0-5de8ebd6404a · Commit: c3487f5070d2ba889f206a2fe7b4991195b5b3ab

Review verdict: NEEDS_CHANGES

FINAL scope synthesis from 37 partition reviews. Per rules, child NEEDS_CHANGES cannot be overridden. part-17 identified concrete HIGH severity blocking defects: missing imports for AtomicInteger and Set in AgentToolRegistryTest.java (RIGHT side lines 61,77) causing compilation failure. Additionally CI passed=false though complete. complete_diff=true and head_sha set. Cross-file assessment of other partitions shows no contradictory HIGH/CRITICAL defects, but the test compile blocker and CI failure necessitate NEEDS_CHANGES. Limitations: no local test execution; prerequisite PRs (#8002,#7860,#7921) not independently verified; partition reviews relied on supplied diff segments only.

Publication: REQUEST_CHANGES (VERIFIED_BLOCKING_FINDINGS)

  • shenyu-plugin/shenyu-plugin-agent-gateway/src/test/java/org/apache/shenyu/plugin/agent/gateway/tool/AgentToolRegistryTest.java:61 [RIGHT] AtomicInteger is used but no import for java.util.concurrent.atomic.AtomicInteger is present in the added imports; compilation will fail.
  • shenyu-plugin/shenyu-plugin-agent-gateway/src/test/java/org/apache/shenyu/plugin/agent/gateway/tool/AgentToolRegistryTest.java:77 [RIGHT] Set.of is used but no import for java.util.Set is present in the added imports; compilation will fail.

Review details

PR #8095 introduces bounded MCP resource admission with audit and metrics. Partition review found one blocking issue: AgentToolRegistryTest.java lacks imports for java.util.concurrent.atomic.AtomicInteger (line 61) and java.util.Set (line 77), which will fail test compilation. All other 36 partitions passed without HIGH/CRITICAL defects. CI is currently failing. Recommend adding the missing imports and ensuring CI passes before merge; also confirm integration with prerequisite PRs (#8002, #7860, #7921) as noted in PR description.

@Aias00 Aias00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stream Agent analysis

Synthesis of PR #8095 (apache/shenyu) at head c3487f5 implementing bounded local and remote MCP resource admission. All 37 partition reviews returned PASS with no HIGH/CRITICAL findings; complete_diff=true and all_parts_passed=true. However CI status shows passed=false across 38 checks, and the PR is a draft dependent on unmerged prerequisites. Therefore FINAL PASS cannot be granted; verdict INCONCLUSIVE.

Evidence

  • Attached review summary: all_parts_passed=true, complete_diff=true, 37/37 partition verdicts PASS with empty blocking_findings
  • CI object in attachment: check_count=38, complete=true, passed=false, legacy_state=pending
  • Multiple partition notes state PR builds on unmerged prerequisites (#8002, #7860, #7921) and is not independently mergeable

Recommended next steps

  • Investigate and resolve CI failures (38 checks reported, passed=false)
  • Merge prerequisite PRs #8002, #7860, #7921 before integrating this draft
  • Re-run full cross-module test suite with prerequisites to confirm admission contracts

Scope: captured diff and GitHub check metadata only; no local tests were executed.

Task: 372c954e-259e-4e3f-a370-76a0c1bb5556 · Commit: c3487f5070d2ba889f206a2fe7b4991195b5b3ab

Review verdict: INCONCLUSIVE

FINAL synthesis scope: all 37 child partition reviews returned PASS with no HIGH/CRITICAL findings, complete_diff=true and all_parts_passed=true. However the governing rule requires CI passed before a FINAL PASS, and the attached CI data shows passed=false (38 checks complete). Additionally, the PR is a draft that explicitly depends on unmerged prerequisite PRs, so cross-file contract correctness cannot be fully confirmed from static partition reviews alone. With no concrete blocking defect to justify NEEDS_CHANGES but inability to confirm PASS, the only admissible verdict is INCONCLUSIVE.

Publication: COMMENT (INCONCLUSIVE_REVIEW)

Review details

Based on the frozen partition reviews, all supplied code segments are clean, but CI did not pass and the PR relies on unmerged prerequisite work. Recommend not merging until CI is green and prerequisites are integrated. Verdict: INCONCLUSIVE.

@BobSong-dev

Copy link
Copy Markdown
Contributor Author

Stream Agent analysis  流代理分析

FINAL synthesis of PR #8095 (apache/shenyu) at head c3487f5. Across 37 partition reviews, 36 passed and part-17 (AgentToolRegistryTest.java) returned NEEDS_CHANGES due to missing imports for AtomicInteger and Set, causing test compilation failure. CI status is complete but passed=false. Complete diff was reviewed in partitions (global_complete_diff=true). Cross-file interactions among admission controller, config, plugin wiring, and audit appear consistent in passing partitions, but the test compilation blocker and failed CI prevent a PASS. Verdict: NEEDS_CHANGES.PR #8095 (apache/shenyu)在头部 c3487f5 的最终合成。在 37 次分区审查中,36 次通过,第 17 部分(AgentToolRegistryTest.java)因缺少 AtomicInteger 和 Set 的导入而返回 NEEDS_CHANGES,导致测试编译失败。CI 状态为 complete,但 passed=false。完全差分在分区中复习(global_complete_diff=真)。准入控制器、配置、插件布线和审计之间的跨文件交互似乎一致地通过分区,但测试编译阻断器和失败的配置配置阻止了 PASS。结论:NEEDS_CHANGES。

Evidence

  • Child review part-17: NEEDS_CHANGES with HIGH findings on AgentToolRegistryTest.java lines 61 and 77 (missing AtomicInteger and Set imports)子审阅第 17 部分:NEEDS_CHANGES AgentToolRegistryTest.java 第 61 行和第 77 行发现异常高(缺少 AtomicInteger 和 Set 导入)
  • CI summary: complete=true, passed=false, check_count=9CI 摘要:complete=true,passed=false,check_count=9
  • all_parts_passed=false; global_complete_diff=true; head_sha=c3487f5070d2ba889f206a2fe7b4991195b5b3aball_parts_passed=假;global_complete_diff=真;head_sha=c3487f5070d2ba889f206a2fe7b4991195b5b3ab

Recommended next steps

  • Add imports for java.util.concurrent.atomic.AtomicInteger and java.util.Set in shenyu-plugin/shenyu-plugin-agent-gateway/src/test/java/org/apache/shenyu/plugin/agent/gateway/tool/AgentToolRegistryTest.java在 shenyu-plugin/shenyu-plugin-agent-gateway/src/test/java/org/apache/shenyu/plugin/plugin/gateway/plugin/agent/gateway/tool/AgentToolRegistryTest.java 中添加 java.util.concurrent.atomic.Atomic.Atomic.Atomic.Set 的导入文件。
  • Re-run CI to confirm compilation and tests pass after import fix重新运行 CI 以确认导入修复后编译和测试是否通过
  • Validate cross-module contracts with prerequisite PRs since PR is draft building on unmerged work验证跨模块合同与先决条件 PR 的关系,因为 PR 是基于未合并工作的草稿构建

Scope: captured diff and GitHub check metadata only; no local tests were executed.范围:仅捕获差异和 GitHub 检查元数据;未进行本地测试。

Task: f65486a0-5d0e-4ea6-81c0-5de8ebd6404a · Commit: c3487f5070d2ba889f206a2fe7b4991195b5b3ab任务:f65486a0-5d0e-4ea6-81c0-5de8ebd6404a ·提交:c3487f5070d2ba889f206a2fe7b4991195b5b3ab

Review verdict: NEEDS_CHANGES

FINAL scope synthesis from 37 partition reviews. Per rules, child NEEDS_CHANGES cannot be overridden. part-17 identified concrete HIGH severity blocking defects: missing imports for AtomicInteger and Set in AgentToolRegistryTest.java (RIGHT side lines 61,77) causing compilation failure. Additionally CI passed=false though complete. complete_diff=true and head_sha set. Cross-file assessment of other partitions shows no contradictory HIGH/CRITICAL defects, but the test compile blocker and CI failure necessitate NEEDS_CHANGES. Limitations: no local test execution; prerequisite PRs (#8002,#7860,#7921) not independently verified; partition reviews relied on supplied diff segments only.最终范围综合,来自 37 次分区评审。根据规则,子 NEEDS_CHANGES 不能被覆盖。第 17 部分识别了混凝土高严重阻断缺陷:AtomicInteger 和 Set in AgentToolRegistryTest.java(右侧行 61,77)缺少导入,导致编译失败。此外,CI passed=false,但已完全。complete_diff=真且 head_sha 集合。对其他分区的跨文件评估显示没有矛盾的高/关键缺陷,但测试编译阻断器和配置项失败导致必须 NEEDS_CHANGES。限制:无法执行本地测试;未独立验证的先决 PR( #8002 , #7860 , ) #7921 分区审查仅依赖于提供的差分段。

Publication: REQUEST_CHANGES (VERIFIED_BLOCKING_FINDINGS)出版:REQUEST_CHANGES(VERIFIED_BLOCKING_FINDINGS 年)

  • shenyu-plugin/shenyu-plugin-agent-gateway/src/test/java/org/apache/shenyu/plugin/agent/gateway/tool/AgentToolRegistryTest.java:61 [RIGHT] AtomicInteger is used but no import for java.util.concurrent.atomic.AtomicInteger is present in the added imports; compilation will fail.shenyu-plugin/shenyu-plugin-agent-gateway/src/test/java/org/apache/shenyu/plugin/agent/gateway/tool/AgentToolRegistryTest.java:61 [右] 使用了 AtomicInteger,但新增导入中未导入 java.util.concurrent.atomic.Atomic.AtomicInteger;编译会失败。
  • shenyu-plugin/shenyu-plugin-agent-gateway/src/test/java/org/apache/shenyu/plugin/agent/gateway/tool/AgentToolRegistryTest.java:77 [RIGHT] Set.of is used but no import for java.util.Set is present in the added imports; compilation will fail.shenyu-plugin/shenyu-plugin-agent-gateway/src/test/java/org/apache/shenyu/plugin/agent/gateway/tool/AgentToolRegistryTest.java:77 [右] 使用了 Set.of,但新增导入中没有 java.util.Set 的导入;编译会失败。

Review details

PR #8095 introduces bounded MCP resource admission with audit and metrics. Partition review found one blocking issue: AgentToolRegistryTest.java lacks imports for java.util.concurrent.atomic.AtomicInteger (line 61) and java.util.Set (line 77), which will fail test compilation. All other 36 partitions passed without HIGH/CRITICAL defects. CI is currently failing. Recommend adding the missing imports and ensuring CI passes before merge; also confirm integration with prerequisite PRs (#8002, #7860, #7921) as noted in PR description.PR #8095 引入了有界的 MCP 资源采纳,并支持审计和指标。分区审查发现了一个阻塞问题:AgentToolRegistryTest.java 缺少 java.util.concurrent.atomic.AtomicInteger(第 61 行)和 java.util.Set(第 77 行)的导入,这会导致测试编译失败。其他 36 个分区均未出现高/关键缺陷。人工耳蜗目前正在失败。建议添加缺失的导入,并确保 CI 通过再合并;还要确认与 PR 描述中注明的先决 PRs #8002 (, #7860 , #7921 )集成。

Thank you for reviewing this again. I checked the complete file at the reviewed commit c3487f5: java.util.Set is already imported at line 38, and java.util.concurrent.atomic.AtomicInteger at line 40. Both imports also exist on master, so they do not appear as added lines in this PR’s diff.

To rule out stale compiled classes, I ran a clean JDK 21 build and the related tests. All 157 selected tests passed, including all 19 tests in AgentToolRegistryTest, with no failures, errors, or skips.

I also updated the PR description to clarify the dependency status: #7860 and #7921 have merged, while #8002 remains the outstanding prerequisite. Could you please take another look at the two import findings against the complete file? Thank you for your time.

@Aias00 Aias00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stream Agent analysis

WHOLE_PR review at the pinned head is INCONCLUSIVE: the frozen versioned-diff evidence was fully delivered, but CI is complete and not passing, and the attachment lacks failure logs needed to verify a HIGH/CRITICAL source-level blocker.

Evidence

  • Frozen attachment: scope WHOLE_PR, VERSIONED_DIFF, file_count 59, complete_diff true; engine read progress records 283241/283241 diff characters delivered with no unread pages; coverage notes no local tests executed.
  • CI evidence: complete=true, check_count=93, passed=false; failed checks at the head SHA include build, e2e, compat_java21 (admin, shenyu-admin), and e2e-storage (shenyu-e2e-case-storage, e2e-mysql-compose). The attachment provides conclusions and run IDs but no failure logs.
  • Targeted pinned-head reads verified malformed Javadoc in new AgentResourceAdmission.java RIGHT lines 61 and 73, but no CI log proves these lines caused the failed build; no source-level HIGH/CRITICAL defect is established.

Recommended next steps

  • Collect the four failed CI job logs for head 226f40e and fix the verified root cause.
  • Rerun CI after the #8002 dependency synchronization described in the PR description.
  • Return for re-review with passing CI evidence or a source-level failure cause anchored to changed lines.

Scope: captured diff and GitHub check metadata only; no local tests were executed.

Task: 2243019f-645f-43e1-bbaa-abf851f9f28f · Commit: 226f40eb24a8f154c42f61044c4432225f798dec

Review verdict: INCONCLUSIVE

Scope is the complete #8095 change at head 226f40e. Full diff coverage is recorded, but PASS requires passing CI and CI is explicitly failed with four failed checks, so PASS is not supported. NEEDS_CHANGES is also not supported because the frozen evidence contains no failure logs and no verified HIGH/CRITICAL defect anchored to a changed path, side and line. The missing CI root-cause evidence makes the analysis incomplete; therefore the explicit verdict is INCONCLUSIVE with no blocking findings.

Publication: COMMENT (INCONCLUSIVE_REVIEW)

hanzhe-one added a commit to hanzhe-one/shenyu that referenced this pull request Nov 12, 2026
…dgets

Address the review of apache#8411.

The remote binding compared the whole Config record, which now contains the
request/response budgets, against the config returned by the credential
resolver. Any resolver written before this feature rebuilds that target from
the four reference fields and therefore carries the 8192 defaults, so every
non-default budget failed with "Missing or mismatched service credential
binding" and the data-sync update was silently dropped. Binding identity is
name/endpoint/credentialRef/credentialVersion only (Config#bindsTo); budgets
stay trusted transport configuration. The file resolver no longer mirrors
budgets into its comparison, and the Config javadoc now states that record
equals/hashCode still cover the complete snapshot, budgets included.

Also make the documented limit relationship accurate: remoteResponseBytes bounds
upstream JSON-RPC wire bytes, while the response the rule renders is bounded by
the rule handle's maxResponseBytes in AgentHttpToolExecutor. The two are
independent and both must pass, so a 1 MiB remote budget is only usable when
the entry budget is raised as well. Document the resulting memory bound
(8 Servers x 64 in-flight x remoteResponseBytes, ~512 MiB only at the hard
maximum, 4 MiB at the defaults) and state explicitly that this change adds no
aggregate admission limit, which stays with apache#8095.

Finally use the imported AgentGatewayAggregationConfig instead of inline FQNs
and give the budget range rule a single error message in budget() and
validateRemotePayloadBudget().

@Aias00 Aias00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stream Agent analysis

WHOLE_PR review of #8095 (bounded local and remote MCP resource admission, audit bridge, metrics, docs, and Spring Boot wiring): the entire 283,244-character pinned diff was read and cross-file contracts were spot-checked on the frozen head, but CI has not completed and the PR still carries an unmerged dependency, so no definitive PASS or NEEDS_CHANGES verdict is supported.

Evidence

  • Coverage: frozen VERSIONED_DIFF fully consumed with complete_diff=true; all pages read to has_more=false (next_unread_offset 283244 = total_characters 283244) for the empty path, plus the complete AgentResourceAdmission.java sub-path; targeted resource_read/resource_search on pinned head 5c87f99 located AgentResourceAdmission, AgentMcpResourceAdmission, AgentMcpDispatcher and AgentToolRegistry references.
  • CI is unfinished: ci.check_count=11 while every enumerated check has status=queued and conclusion=null; legacy_state=pending, status_count=0, failed_checks=[], passed=false. No passing CI exists to satisfy the PASS requirement.
  • PR description states the branch 'still depends on #8002' and will be 'synchronized with master' after that merge so the final patch contains only the resource-admission delta, meaning the reviewed head carries a non-final patch.

Recommended next steps

  • Re-evaluate once the 11 reported CI checks leave the queued/pending state and their conclusions are available.
  • Re-review after the branch is rebased on master following the #8002 merge, so the patch contains only the resource-admission delta.
  • Verify admission wiring across AgentGatewayPluginConfiguration, AiProxyPluginConfiguration, MetricsReporter and the new agent-audit starter once CI is green.

Scope: captured diff and GitHub check metadata only; no local tests were executed.

Task: 505c8798-f3db-48db-9b02-f50f0305be7c · Commit: 5c87f99f2baf7cd485fff193117d6d9fe0bc8dd6

Review verdict: INCONCLUSIVE

Scope was WHOLE_PR with full diff coverage on head 5c87f99 and no tool failures; no concrete HIGH/CRITICAL blocking defect was verified, so NEEDS_CHANGES is unjustified (and no tests were executed by the reviewer). However PASS explicitly requires passing CI, and the frozen CI snapshot shows 11 checks all queued/pending with passed=false and status_count=0; the PR additionally depends on unmerged #8002, so the reviewed patch is not final. Because this evidence is incomplete, the explicit verdict must be INCONCLUSIVE rather than PASS.

Publication: COMMENT (INCONCLUSIVE_REVIEW)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] Bound local and remote MCP resource admission

3 participants