Skip to content

fix(harness): scope gateway turn leases to each subscription - #3550

Merged
juruoO-o merged 1 commit into
agentscope-ai:mainfrom
CryoThrust:fix/harness-subscription-lease
Nov 12, 2026
Merged

juruoO-o merged 1 commit into
agentscope-ai:mainfrom
CryoThrust:fix/harness-subscription-lease

Conversation

@CryoThrust

Copy link
Copy Markdown
Contributor

Cancelling a queued subscription to a reused Gateway publisher could close the lease of a different, still-active turn. Keep each acquired lease and its cleanup inside that subscription's defer boundary for both run and runStream; defer the agent supplier too so synchronous failures still release the lease.

Fixes #3549. Independent of #3533: no changes to LocalSessionTurnGate.

Verification: both public Gateway cancellation controls fail on current main and #3533, then pass with this change. Ten focused cases cover queued cancellation and completion/error/supplier-failure/active-cancellation paths for Mono and Flux. mvn -T1 -pl agentscope-harness,agentscope-extensions/agentscope-extensions-controlplane -am clean verify passes: 4,401 tests, zero failures/errors, 27 skips across seven modules, including formatting. This is scoped local verification with a fake agent and real local gate, not the full repository or a live deployment.

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@guslegend0510 guslegend0510 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.

LGTM

@CryoThrust

Copy link
Copy Markdown
Contributor Author

@guslegend0510 Thanks for the review. The overlapping #3593 was closed in favor of this PR on November 10. The fix is still needed on main: the lease reference is shared outside Mono.defer, so concurrent subscriptions can overwrite each other's lease.

The five checks on c476fb76 are green. Is there anything else needed before this can merge? I can address any remaining concerns here.

@juruoO-o juruoO-o left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed subscription-scoped turn lease ownership and completion/error/cancellation cleanup, including synchronous supplier failures.

No blocking findings in the reviewed diff. This was a static review of source and tests; local Java/Maven tests were not run.

@juruoO-o
juruoO-o merged commit 3438964 into agentscope-ai:main Nov 12, 2026
6 checks passed
chickenlj pushed a commit that referenced this pull request Nov 13, 2026
Backport the verified fix to the 2.0.x implementation and retain its existing public contracts where the upstream kernel differs.

(cherry picked from commit 3438964)
Backport-review-patch: 392524ae509d6899c3f0bc31a1abe72fba081137
Constraint: No AgentScope Service or SDK migration
Confidence: high
Not-tested: Whole-repository verification pending after lane integration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 紧急不重要

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cancelling a queued subscription can release another active gateway turn lease

4 participants