Skip to content

[ISSUE #8127] Define explicit AI Proxy Rule generation overrides - #8279

Open
yangjj-iso wants to merge 14 commits into
apache:masterfrom
yangjj-iso:feat/issue-8127-rule-overrides
Open

yangjj-iso wants to merge 14 commits into
apache:masterfrom
yangjj-iso:feat/issue-8127-rule-overrides

Conversation

@yangjj-iso

@yangjj-iso yangjj-iso commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Introduce an explicit generationOverrides Rule block for model, temperature, maxTokens and stream. Preserve inert legacy root fields and define Plugin < Selector < Rule configuration precedence, explicit null clearing and the existing client-stream precedence.

Reject target/provider/protocol/credential/fallback/body-patch fields inside the new block. Parse and validate once at configuration publication, use immutable cached Rule values, and merge into request-owned configuration. Preserve the existing custom resolver entry point and the original authentication/fallback/transport owners. The documentation audits current SQL metadata and states the migration requirement for previously unused malformed Rule JSON.

Fixes #8127.

Depends on #8274 and #8276. This PR includes the contract foundation and generic Admin Rule validation hook; merge those prerequisites first, then rebase/update this branch. It does not depend on Divide, lifecycle observation or the new HTTP failure mapper.

Feature-only comparison: yangjj-iso/shenyu@feat/issue-8205-rewrite-contract...feat/issue-8127-rule-overrides

Validation: AiProxyRuleContractTest; Admin create/update/import checks in RuleServiceTest; real AiProxyPlugin/engine outgoing requests; clearing, protected fields, invalid-update retention, owner removal, concurrent request isolation and custom resolver compatibility. Checkstyle and RAT are included in verification on master 92d16c2.

@yangjj-iso
yangjj-iso marked this pull request as ready for review November 1, 2026 22:41

@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 review of PR #8279 (apache/shenyu) at head 5a6fff0: complete diff and CI green, but child partition found HIGH NPE in ConfigurationContract.java:89 (List.copyOf on null). all_parts_passed false, verdict NEEDS_CHANGES.

Evidence

  • Child review part-10 flagged NPE in ConfigurationContract 9-arg ctor
  • FINAL synthesis: all_parts_passed=false, complete_diff=true, CI passed

Recommended next steps

  • Fix List.copyOf null-safety in ConfigurationContract.java:89 (9-arg constructor)
  • Re-run CI and request re-review after patch

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

Task: f0a02370-8492-49d7-89ad-c61604761291 · Commit: 5a6fff0168254f947915c081af40b9600d4618d4

Review verdict: NEEDS_CHANGES

SYNTHESIS/FINAL: child partition reported HIGH NPE defect at ConfigurationContract.java:89; all_parts_passed false. Cannot override with PASS. Complete diff supplied, CI passed, blocker persists.

Publication: REQUEST_CHANGES (VERIFIED_BLOCKING_FINDINGS)

  • shenyu-common/src/main/java/org/apache/shenyu/common/config/contract/ConfigurationContract.java:89 [RIGHT] List.copyOf(values) throws NPE when values is null (via 9-arg constructor). Use null-safe copy.

Normalize optional null Field enumeration values to immutable empty lists
in both constructors, retaining defensive copies and null-entry rejection.
Add regression tests for constructor and collection contracts.

Validation: standalone Java 21 checks against the actual production classes
reproduce the original NPE and pass all five checks after the fix.
git diff --check passes. Local Maven/JUnit/Checkstyle/RAT could not run:
wrapper download failed with UnknownHostException for repo.maven.apache.org.
Hosted CI for this exact commit must be checked separately.
yangjj-iso added a commit to yangjj-iso/shenyu that referenced this pull request Nov 4, 2026
Propagate the same optional-enumeration correction reviewed for apache#8279
into this prerequisite branch. Null enum metadata means unrestricted;
non-null lists retain defensive copying and null-entry rejection.
Add regression tests adapted to this branch's Field constructors.

Validation: actual production classes compiled with Java 21, standalone
constructor/copy/immutability/null-element checks pass; git diff --check
passes. Local Maven/JUnit/Checkstyle/RAT remain blocked by wrapper DNS
failure for repo.maven.apache.org. Hosted exact-head CI checked separately.
Propagate the same optional-enumeration correction reviewed for apache#8279
into this prerequisite branch. Null enum metadata means unrestricted;
non-null lists retain defensive copying and null-entry rejection.
Add regression tests adapted to this branch's Field constructors.

Validation: actual production classes compiled with Java 21, standalone
constructor/copy/immutability/null-element checks pass; git diff --check
passes. Local Maven/JUnit/Checkstyle/RAT remain blocked by wrapper DNS
failure for repo.maven.apache.org. Hosted exact-head CI checked separately.

@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 #8279: child reviews show one INCONCLUSIVE (part-10 execution failure) and others PASS with no HIGH/CRITICAL. CI failed. all_parts_passed false, preventing FINAL PASS. Verdict INCONCLUSIVE.

Evidence

  • Reduce node: part-10 INCONCLUSIVE due execution failure; 21/22 PASS
  • CI passed=false, complete=true, 68 checks
  • all_parts_passed=false, complete_diff=true, head 00aa5ac

Recommended next steps

  • Re-run failed CI checks (68 checks currently failed/pending)
  • Re-execute child partition part-10 review to resolve INCONCLUSIVE

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

Task: 3079ba4a-574f-4e34-9934-90132bbad47c · Commit: 00aa5ac9ddaadbbb0a2d2c991bcffcfc09179533

Review verdict: INCONCLUSIVE

FINAL scope: child part-10 INCONCLUSIVE and CI passed=false; all_parts_passed false. Rules forbid overriding to PASS. Cross-file correctness not certifiable without green CI and full child passes.

Publication: COMMENT (INCONCLUSIVE_REVIEW)

@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 #8279 at head fe2f482. The attached durable partition reviews cover 27 nodes (part-0..part-26). 26 partitions returned PASS with no anchored HIGH/CRITICAL findings; part-13 returned INCONCLUSIVE due to review task failure. The synthesis reports all_parts_passed=false, complete_diff=true, global_complete_diff=true, CI passed (68 checks). Because a child partition is INCONCLUSIVE and all_parts_passed is false, a FINAL PASS is prohibited. No concrete blocking defect was identified in any supplied diff segment.

Evidence

  • Attached synthesis JSON: all_parts_passed=false, 27 partitions, scope FINAL.
  • Child node part-13 review_verdict=INCONCLUSIVE, reason 'Partition execution failed; no passing review inferred.'
  • CI passed true (68 checks) but incomplete partition evidence prevents FINAL PASS.

Recommended next steps

  • Re-execute the partition part-13 review task to resolve its INCONCLUSIVE status.
  • After part-13 yields a verdict, recompute FINAL synthesis; if all pass and CI green, issue PASS.

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

Task: 5b971b21-4f2d-48b3-944b-bb3760855f17 · Commit: fe2f48283cdb61ac5e5740ce66b5e5f721270864

Review verdict: INCONCLUSIVE

Scope is FINAL synthesis of all child partition reviews for PR #8279 at head fe2f482. The frozen attachment shows 27 partitions; part-0..part-12 and part-14..part-26 returned PASS with empty blocking_findings. part-13 returned INCONCLUSIVE because the review task did not produce a validated result after retry. The synthesis field all_parts_passed is false. Rules forbid overriding a child INCONCLUSIVE with PASS, and require all_parts_passed=true, complete_diff=true, and CI passed before a FINAL PASS. While complete_diff and CI passed are satisfied, the child INCONCLUSIVE and all_parts_passed=false block PASS. No anchored HIGH/CRITICAL defects exist in reviewed segments. Verdict limited to INCONCLUSIVE due to incomplete evidence from part-13; cross-file correctness not fully verified for that partition.

Publication: COMMENT (INCONCLUSIVE_REVIEW)

Review details

Automated FINAL review of PR #8279 (head fe2f482). Across 27 partition tasks, 26 passed without anchored HIGH/CRITICAL defects, and CI is green (68 checks). However, partition part-13 failed to produce a validated review (INCONCLUSIVE: 'Partition execution failed; no passing review inferred.'). Per review policy, a child INCONCLUSIVE cannot be overridden by PASS, and all_parts_passed must be true for a FINAL PASS. Therefore the overall verdict is INCONCLUSIVE. Recommend re-running the part-13 review to complete the cross-file assessment. No blocking findings were invented; the supplied code, tests, docs, and fixtures appear coherent where reviewed.

@yangjj-iso

Copy link
Copy Markdown
Contributor Author

Follow-up on fe2f482: the earlier nullable-values finding is addressed in the canonical ConfigurationContract.Field constructor, which converts null to an empty list before making an immutable copy; the convenience constructor delegates to it. Current-head checks are complete: 65 successful and 3 skipped, with no failures. The latest review is inconclusive only because part-13 did not produce a result. Please complete that review and re-review the current head.

@yangjj-iso
yangjj-iso requested a review from Aias00 November 6, 2026 12:17
Aias00 pushed a commit that referenced this pull request Nov 10, 2026
…n providers (#8274)

* feat(config): add scoped plugin configuration contracts (#8200)

* test(admin): deduplicate import after upstream plugin-event changes

* fix(common): normalize absent configuration enum values

Propagate the same optional-enumeration correction reviewed for #8279
into this prerequisite branch. Null enum metadata means unrestricted;
non-null lists retain defensive copying and null-entry rejection.
Add regression tests adapted to this branch's Field constructors.

Validation: actual production classes compiled with Java 21, standalone
constructor/copy/immutability/null-element checks pass; git diff --check
passes. Local Maven/JUnit/Checkstyle/RAT remain blocked by wrapper DNS
failure for repo.maven.apache.org. Hosted exact-head CI checked separately.
Resolve the three add/add conflicts introduced by merged apache#8274. Retain
both Field constructors and description metadata, normalize absent enum
values in the canonical constructor, preserve both constructor regressions,
and register the Rewrite provider alongside the upstream gateway provider.
The Admin merge retains upstream canary/sticky validation and the shared
Rule contract hook. No Rewrite coercion or request behavior is changed.

Validation: all 38 local workflow checks pass. Compile the actual merged
ConfigurationContract, ConfigurationScope and ConfigurationViolation with
OpenJDK 21 using Java 17 source/target; nine standalone constructor,
defensive-copy and constraint assertions pass. This is not the full JUnit
reactor or Java 17 runtime validation. Maven downloads remain DNS-blocked,
so Admin/Rewrite JUnit, Checkstyle and RAT await hosted CI. The PR diff
against master passes git diff --check; the created tree matches the
locally resolved merge exactly.
Bring in apache#8276 at 1143aed, including master 9dd9a12 after apache#8274 merged.
This removes the duplicated foundation conflicts while retaining the
Rewrite and AI Rule providers, description-aware Field constructors,
and null-enumeration regression coverage. Preserve upstream Admin sticky
validation, AI request-view publication and response-cache scope handling;
the AI plugin delta still only applies the existing Rule overrides to
request-owned configuration before credential handling.

Validation: automatic merge with the updated prerequisite yields exactly
the same tree as the independently resolved master merge. Contract sources,
registry regressions and workflow suite match the prerequisite validated by
38 workflow checks and a nine-assertion real-source Java constructor probe.
Provider registrations are unique and resolve to existing sources; the
remaining diff passes git diff --check. Maven dependencies remain DNS-
blocked; no fresh Admin/AI/Rewrite JUnit, Checkstyle or RAT result is claimed.
Hosted CI and the outstanding review remain required; apache#8276 is not yet
merged upstream.

@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

Review of #8279 at 1174726 — introduces an explicit AI Proxy Rule generationOverrides block (model/temperature/maxTokens/stream) plus a rewrite configuration contract. Full pinned diff read end-to-end (88,224 chars, all pages, has_more=false). No concrete blocking defect found in the changed code.

Evidence

  • Full pinned VERSIONED_DIFF read end-to-end (88,224 chars; final page has_more=false).
  • AiProxyRuleOverrides.parse accepts only model/temperature/maxTokens/stream; default branch throws invalid() and block.size()>4 is rejected, enforcing the no-target/provider/credential guarantee with explicit null clearing via the 'specified' set.
  • Frozen CI metadata: complete=true but passed=false; all 10 checks status=queued/pending, conclusion=null (no passing conclusion).

Recommended next steps

  • Await or re-run CI: all 10 checks are queued/pending with null conclusions, so passing CI cannot be confirmed as required for PASS.

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

Task: 5b8628f3-d480-419c-a9c7-de965a67c04a · Commit: 1174726644726fa02816165afcd1bff3bfc4c17c

Review verdict: INCONCLUSIVE

Complete diff coverage with no concrete blocking defect found; however the frozen CI evidence shows passed=false with all 10 checks queued/pending and null conclusions, so the required passing-CI gate for a PASS verdict cannot be confirmed.

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][AI Proxy] Define explicit AI Proxy Rule-level override semantics and compatibility

2 participants