Repository navigation
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
oss-maintainer
left a comment
There was a problem hiding this comment.
Summary
Extracts the v2 streaming contract into a new EventStreamingAgent SPI, implements it on ReActAgent/HarnessAgent, and drops the ReActAgent cast plus the reflective HarnessAgent call from AguiAgentAdapter. Nice de-escalation of a hard-coded type check into a proper capability interface, with tests for the ReAct / Harness / custom-agent paths and the v1 fallback.
Verdict
Approachable with one compatibility question answered (see inline): agents that used to reach the v2 path by class name alone now fall back to 1.x silently.
Automated review by github-manager-bot
|
@oss-maintainer 麻烦审核一下 |
oss-maintainer
left a comment
There was a problem hiding this comment.
Summary
Re-review after df4b9b20 + 9a142de1. The direction is right and the mechanics hold up: EventStreamingAgent/SessionStateAgent as opt-in capability interfaces is the correct way to let AG-UI adapt custom agents, ReActAgent and HarnessAgent both implement them, callSerializationKey(RuntimeContext) is null-tolerant so the RuntimeContext.empty() normalisation is safe, and AguiRequestProcessor.resolveRuntimeContext pinning sessionId = threadId once and reusing it for disconnect interrupts removes the user-id-dropping bug in the old interrupt(threadId). Verified on the head blob rather than the patch: RuntimeContext.Builder.from(null) returns an empty builder (so builder(resolved) with a null resolver result is fine), HarnessAgent overrides interrupt(RuntimeContext) at line 617, and the removed AguiUtil has no remaining reference in the repo.
Two things need attention before merge, one of which is blocking CI:
- [Warning]
AguiWebFluxHandlerTest.java:7— the new file's license header duplicates the "you may not use this file…" sentence with a stray*, and that is exactly the oneinvalid: 1file reported by the failingCheck Licensejob on this head. Copy the block from the siblingAguiMvcControllerTest.javaand the job goes green. - [Warning]
Agent.java:100— deletingAguiUtilreplaces a structural probe (any agent with a publicgetDelegate()returning aReActAgent) with an override obligation. In-repo wrappers are covered, but an external wrapper that only exposesgetDelegate()now silently falls intointerrupt(), i.e. the wrong-session behaviour this PR fixes, with no signal. A fallback, a log, or a migration note would close that. - [Info]
AguiRequestProcessor.java:104—ProcessResult.interrupt(String)→interrupt()and theAguiUtilremoval are source-breaking for published 2.0.x consumers and the PR touches nodocs/v2/**; a release-notes bullet namingAgent.interrupt(RuntimeContext)as the replacement is enough. - [Info]
ReActAgent.java:1122— the null →empty()normalisation is safe against every in-repoctx == nullguard on this path; worth one javadoc sentence making "implementations pass a non-null context" an explicit contract for custom agents.
The Check License failure is the only red check; everything else passes, and CLA is signed.
Automated review by github-manager-bot
|
@oss-maintainer 麻烦审核一下 |
oss-maintainer
left a comment
There was a problem hiding this comment.
Summary
Re-review of d0b44c9 — the only commit pushed since my previous review on 9a142de1. It is a docs-only change plus a license-header fix, and it lands the two things that mattered: the malformed header in AguiWebFluxHandlerTest.java (that was the single invalid: 1 file behind the red Check License job — the job is green now, along with build (ubuntu-latest), build (windows-latest), Check Module Sync and codecov/patch) and the explicit "implementations must pass a non-null RuntimeContext" contract on EventStreamingAgent. CLA is signed.
Two items from the previous review are only partly addressed, so I am leaving this as COMMENT rather than APPROVE:
Agent.java:98— the override obligation is now documented ("Multi-session agents and wrappers should override"), but the failure mode is still silent. Before this PR,AguiUtil.asReActAgentunwrapped any agent exposing a publicgetDelegate()returning aReActAgent; now such a third-party wrapper falls throughdefault interrupt(RuntimeContext) → interrupt()and interrupts the default slot — exactly the wrong-session behaviour this PR set out to fix, with no signal. A WARN log whenctx != null && ctx.sessionId() != null, or a reflection-free unwrap hook consulted by the default method, closes it.AguiRequestProcessor.java:103— the javadoc replacement note helps source readers but not consumers who only read release notes.ProcessResult.interrupt(String threadId)and the publicAguiUtilclass are both gone (source-breaking for published 2.0.x artifacts) and this PR still touches 0docs/paths. One changelog bullet indocs/v2/en/**+docs/v2/zh/**namingAgent.interrupt(RuntimeContext)as the replacement is enough.
Nothing in the new code paths themselves looks incorrect, and the null → RuntimeContext.empty() normalisation is now consistent across ReActAgent, EventStreamingAgent and AguiRequestProcessor.interrupt(). Happy to re-review and approve once the wrapper fallback/log and the changelog bullet are in (or tell me why you would rather keep the javadoc-only mitigation for the wrapper case).
Findings
- [Warning]
agentscope-core/.../agent/Agent.java:98— documented but still silent regression for wrappers exposing onlygetDelegate() - [Info]
agentscope-extensions-agui/.../processor/AguiRequestProcessor.java:103— source-breaking removals need adocs/v2/**changelog entry, not just javadoc - [Info]
agentscope-core/.../agent/EventStreamingAgent.java:35— resolved: non-nullRuntimeContextcontract is now explicit
Automated review by github-manager-bot
| * Interrupt the in-flight call identified by {@code ctx}. | ||
| * | ||
| * <p>The default implementation falls back to {@link #interrupt()}. Multi-session agents and | ||
| * wrappers should override this to target the session in {@code ctx} instead of the default |
There was a problem hiding this comment.
Thanks for picking this up in d0b44c9 — the javadoc now tells wrappers to override, but the behaviour for an external wrapper is still silent: AguiUtil.asReActAgent used to unwrap any agent exposing a public getDelegate() returning a ReActAgent, while default void interrupt(RuntimeContext ctx) { interrupt(); } routes such a wrapper to the default slot. So a third-party wrapper that only exposes getDelegate() keeps interrupting the wrong session, with no signal. A minimal non-doc mitigation would be one of: (a) log at WARN in the default method when ctx != null && ctx.sessionId() != null, or (b) keep a reflection-free unwrap hook (e.g. an optional DelegateAware marker interface) that the default method consults before falling back. Either closes the silent-regression hole without restoring the old reflection probe.
| * @param threadId The AG-UI thread id for this request | ||
| * <p>Uses the resolved {@link RuntimeContext} so multi-session agents receive both the | ||
| * caller user id and the AG-UI {@code threadId} (session id). Replaces the former {@code | ||
| * interrupt(String threadId)} overload; call {@link Agent#interrupt(RuntimeContext)} |
There was a problem hiding this comment.
The javadoc replacement note is the right call for readers of the source, but it does not reach consumers who only read release notes: ProcessResult.interrupt(String threadId) is gone and public class AguiUtil is deleted, both source-breaking for anyone compiling against the published 2.0.x artifacts. Please add one bullet to the v2 changelog/release notes (docs/v2/en/** + docs/v2/zh/**) naming Agent.interrupt(RuntimeContext) as the replacement — this PR currently touches zero docs/ paths.
| * <p>Implementations of {@link #streamEvents(List, RuntimeContext)} must pass a non-null | ||
| * {@link RuntimeContext} into their execution pipeline (middleware, reactor context, and | ||
| * session lookup). Use {@link RuntimeContext#empty()} when the caller has none. The | ||
| * convenience overloads already do this, so custom agents should not re-introduce {@code |
There was a problem hiding this comment.
Good — this makes "implementations pass a non-null RuntimeContext" an explicit contract instead of an emergent property of ReActAgent, and the matching @param note on ReActAgent#streamEvents(List, RuntimeContext) closes the earlier item. No change requested; noting it here so the thread is visibly resolved.
|
This PR currently conflicts with git fetch upstream
git checkout feat/event-streaming-agent
git rebase upstream/main
# resolve conflicts, then:
git push --force-with-leaseOnce conflicts are resolved, ping @oss-maintainer for a re-review if the head also moves. This is a one-time reminder. Automated notification by github-manager-bot |
|
This PR has conflicts with the git fetch origin
git checkout feat/event-streaming-agent
git rebase origin/main
# resolve conflicts, then:
git push --force-with-leaseThis is a one-time reminder. Feel free to @mention oss-maintainer for a re-review after conflicts are resolved. Automated notification by github-manager-bot |
Extract optional streaming and session contracts so protocol adapters can adapt custom agents without hard-coding ReActAgent or HarnessAgent.
d0b44c9 to
4bd0c65
Compare
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
AgentScope-Java Version
2.1.0-SNAPSHOTDescription
Closes #1894
Related #2102 #2105 #2552
Background
Protocol adapters such as AG-UI used to hard-code concrete types (
ReActAgent/HarnessAgent) to reach fine-grainedstreamEvents, session-scoped state, and per-session interrupt. Custom agents could not plug in cleanly without extending those types.Purpose
Extract optional contracts on the core Agent surface so adapters can detect capabilities without knowing the concrete class. AG-UI / adapter wiring is intentionally deferred to a follow-up.
Changes
EventStreamingAgentwithstreamEvents(...)overloads.ReActAgentandHarnessAgentimplement it. Agents that do not implement it stay on the deprecated v1stream()path.Agent.getAgentState(String, String)/getAgentState(RuntimeContext)defaults (nullwhen unsupported).ReActAgent/HarnessAgentoverride and forward.Agent.interrupt(RuntimeContext)/interrupt(String, String)(andMsgvariants). Defaults fall back to the no-session overloads and log a WARN when a non-blank user/session id is present so silent wrong-slot interrupts are visible. Multi-session wrappers must override.StreamableAgentdocumentation atEventStreamingAgent.docs/v2release notes.Out of scope (follow-up)
instanceof EventStreamingAgentAguiUtil/ changingProcessResult.interruptnullRuntimeContexttoRuntimeContext.empty()inReActAgent#streamEventsHow to test / Test plan
EventStreamingAgentTestAgentGetAgentStateOverloadTestAgentBaseTest#testInterruptRuntimeContextFallsBackToNoArgHarnessAgentEventStreamingContractTestChecklist
mvn spotless:apply