BobSong-dev opened a new pull request, #8002: URL: https://github.com/apache/shenyu/pull/8002
Fixes #7950 ## Background Metrics and traces do not provide one correlated, privacy-preserving terminal record for AI and MCP invocations, especially when traffic is rejected before an upstream call. The gateway also had no shared vocabulary for correlating a logical invocation with its retry or fallback attempts. This draft integrates the audit contract with the request context and terminal observation work from #7860 and runtime governance from #7921. It is not independently mergeable until those prerequisite PRs are merged and the audit delta is rebased onto the resulting master. ## Changes - Adds a versioned, metadata-only `AgentInvocationAuditEvent` with logical and attempt records, trusted identity, internal API-key id, target, decision, bounded outcome/reason, status, timing, and correlation fields. - Reuses the existing AI and MCP terminal owners to emit one logical terminal record and separately numbered upstream attempts; late or duplicate terminal callbacks do not create another logical completion. - Records Key Auth and invalid Agent Gateway rule rejections before upstream execution without inventing tenant, subject, or model metadata. - Synchronizes the internal AI Proxy API-key mapping id and records it instead of the presented key or upstream credential. - Adds a shared opt-in audit starter that reuses ShenYu's bounded `AbstractLogCollector` delivery, existing queue instrumentation, and an application-replaceable consumer; it does not create another logging subsystem. - Documents the record schema, identity limitations, policy/config version semantics, delivery guarantees, shutdown behavior, configuration, and retention boundary in `docs/agent-invocation-audit.md`. ## Verification - Windows/JDK 17, 57-module selected `verify` including Admin, Agent Gateway, AI Proxy, the audit starter, and dependencies: 421 tests, 0 failures/errors/skips; Checkstyle and RAT passed for all 57 modules. - RISC-V/QEMU, 35-module selected `verify` for the two plugin starters and dependencies: 409 tests, 0 failures/errors/skips; Checkstyle and RAT passed for all 35 modules. QEMU is not native hardware. - Additional Windows AI protocol-conversion regression: 6 classes, 50 tests, 0 failures/errors/skips. - Source audit confirmed 4,801 tracked and new files matched byte-for-byte by SHA-256 between the Windows and RISC-V workspaces. - Not run: full-project tests, e2e tests, a deployed Admin/WebSocket/Bootstrap run, or remote CI. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
