Repository navigation
fix(mcp-gateway): stop tracking a request its client cancelled - #18604
Conversation
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix is at mechanism level and is declared. The Goal line and the title describe an approach the diff dropped. Notes
What this change shipsInventory (6 items) — 4 justifiedIntent: stop a cancelled request from aging a healthy shared MCP backend into the wedge ceiling and recycling every co-pooled session. FIX.
[FIRST-PRINCIPLES-REVIEWED] 1ddbf2c Description read[DESCRIPTION-READ] 371cd54ecdd07924a776e84787d4f90ba61850ec76575dd9ce5f12c366e8bca2 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. Each cancel case now ends in a settled entry or a verdict, and the identity release hold is a one-rule, reversible change. Notes
[DESIGN-REVIEWED] 1ddbf2c Description read[DESCRIPTION-READ] 26c860394417a919bc35cfc1c3562daa2d3ba17bdfe67bfc7fef65a069b28d41 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
What changed in the second commitA cancel retired every request it named, so for the New tests in The first test fails at its first check, because the cancel was forwarded upstream. The fourth fails because the progress notification never reached its owner. Controls, passing on both commits: Green: the same selection, 21 passed. The 53 Every path that changes the lease state, checkedEach path that changes
That last test found a gap in the hand-off: on a confirmed release, the sentinel arm took only the release waiters out of routing, never the stub the release was sent for. A detach prunes that stub separately, but a cancel does not, so the stub stayed routed for a lease it had released. A later subscriber would then have been answered locally with no upstream lease behind it. The sentinel arm now also removes Green: Review findings answered
|
74731d4 to
deab3b3
Compare
GPT 6.1 Review, blocking finding at
|
deab3b3 to
ba453b9
Compare
|
Rebased onto current main, with no change to the diff (the patch-id is the same). This clears Semgrep's report on main's own |
5143b14 to
264cacb
Compare
|
span=65c967e155eb F1 ( span=65c967e155eb F2 ( span=6216a66100d7 F3 ( span=910aa765b5df (Opus, the last-stub recycle): not changed in this round. The finding is accurate. A call its client cancelled leaves span=09845c8a83b5 (First Principles, item 6): same gap as the Opus finding above, and not changed in this round. The description's claim that the backend "already received the cancel" is true, but it does not show that a server honours it, so it does not justify skipping the recycle. The clear condition that fits is the second one: a cancelled entry that the server has not answered still counts for the Scope B recycle. The tombstone now has a bounded place for that, and the change needs only a "recycle-exempt" flag plus the helper above. |
264cacb to
6ed9940
Compare
|
span=65c967e155eb F1 ( |
6ed9940 to
e22f99b
Compare
|
span=65c967e155eb ( |
e22f99b to
e93d496
Compare
|
span=65c967e155eb ( |
e93d496 to
b69aaa7
Compare
|
Rebased onto main 0a47021. It conflicted with #18841 in the cancel branch of Behaviour that differs from main as a result: a stub that cancels a call and then disconnects no longer recycles the backend on that call's account (another call of the stub still in flight does). If you want the recycle kept after a client cancel, the tombstone in A correction to the description: the wedge-ceiling symptom in Problem / Motivation no longer reproduces on main, because #18841's mark already skips a cancelled entry ( |
|
This branch conflicts with main. Please rebase it, and the reviewer will look again at the identity-release part. |
016bbc0 to
f43e898
Compare
|
@bolichen97 Rebased. The branch is now one commit on main at c3b65e8, head
|
|
span=1366e2d6f925
|
|
span=d6a3249cd1be
|
|
span=d1db48547342
|
|
span=9ad5f4afe93e
|
|
span=ee2ec21693e6
|
|
span=b08c7e8b860d
|
bolichen97
left a comment
There was a problem hiding this comment.
Looks correct to me, with two should-fix items. Head reviewed: f43e898.
Thanks for the rebase. It now applies cleanly on main, and I did a full review of this head.
What I checked:
- The cancel branch in
forward_from_stubreturns before the remap, so no frame for a cancelled subscribe or unsubscribe goes upstream. Nothing skips the caller identity strip, because nothing is written. _settlepops the pending entry before_on_resource_subscription_responseand the sentinel arm run. So_hold_identity_releasenever finds the verdict it is settling, and a refused subscribe withrelease_owedcannot hand the obligation to itself.- The grant arm, the refused arm and the unsettled arm all settle an owed release through one rule. The sentinel orphan arm does the same on a grant and on a refusal. A release with no caller is never held, so servers without caller identity behave as on main.
run_bridgediscards a cancelled id only onnotifications/cancelledwith a dictparams, so a malformed cancel changes nothing.- No
mcp_gatewayfile changed on main since the merge base, so main does not already carry this fix. - The follow-up for detach, evict and the sentinel grant arm is tracked in #21433.
Not repeated here: the Goal wording versus the shipped design (Design Review), and the scope of the identity release hold (First Principles Review). You already answered both on this head. The hold also changes a final unsubscribe that was never cancelled. That scope call belongs to a maintainer, not to this review.
Backend test shards were still running when I read the checks, so I did not count them.
Two should-fix items are inline: the new tests grow a test file that is already over its line cap row, and the architecture doc does not describe the new release hold.
| assert _frames(backend) == [["not", "a", "dict"]] | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_a_hung_backend_whose_only_call_was_cancelled_is_recycled(self) -> None: |
There was a problem hiding this comment.
🟡 The new cases grow a file that is already past its line cap row
This file has 6,525 lines on main. Its row in .github/file-line-cap-baseline.txt is 5,650. This PR adds 481 lines and takes it to 7,006. scripts/check_file_line_cap.py only reports a baselined file that grew, so CI stays green. But the script states the rule: "It must not grow, and it should be split".
@pytest.mark.asyncio
async def test_a_hung_backend_whose_only_call_was_cancelled_is_recycled(self) -> None:Why it matters: Each PR that adds to this file makes the later split larger, and the cap stops meaning anything for it.
Suggestion: Move the nine new test functions and the three helpers (_releases, _fid_of, _answer) into a new file, for example test/test_mcp_gateway_backend_cancel.py. Import _make_backend, _frames, _line, _drain and _settle_lease from the existing module, or from a shared helper module if one exists. The diff to this file then becomes zero lines.
Rule: AGENTS.md (no hand-written file over 2,000 lines); scripts/check_file_line_cap.py "The baseline".
| stub leaving after a cancel still recycles a backend whose synchronous tool kept | ||
| running. A subscribe or unsubscribe is not marked, because its verdict settles | ||
| the shared lease tables. The client side is gated on the declaration because a | ||
| the shared lease tables: its cancel is not forwarded at all, so the server |
There was a problem hiding this comment.
🟡 The spec describes the cancel change but not the new identity release hold
The new paragraph says why a cancelled subscribe or unsubscribe is not forwarded. It does not describe the second behaviour change in this PR. On an identity capable server, a final unsubscribe sent while a same caller subscribe for that URI is in flight is now answered locally. Its upstream release then waits for that subscribe's verdict (release_owed, _hold_identity_release). This also applies when nothing was cancelled. Today only the PR description and the code comments say so.
the shared lease tables: its cancel is not forwarded at all, so the server
answers it and the verdict settles the lease under the stub that sent it, as on
main when a server answers a request it was asked to cancel.Why it matters: A reader of the owning doc cannot learn that a final unsubscribe can be answered without a server round trip. That reader also cannot learn who sends the deferred release. #21433 will extend the same rule to detach and evict, so the doc gap will grow.
Suggestion: Add two or three sentences after this paragraph. State the rule as _hold_identity_release applies it: the release is held while another stub of the caller is routed for the URI, or while a same caller subscribe is in flight. That subscribe inherits the release. A grant discharges it, and any other verdict sends it unless the rule still holds. While you edit here, wrap the line that ends in "The client side is gated on the declaration because a" to match the paragraph.
Rule: AGENTS.md "Specs and docs" (owning spec updated in the same commit); AGENTS.md "Read before you touch" maps mcp_gateway/ to this doc.
f43e898 to
fc3f664
Compare
|
Thanks for the review. Both items are done in this push.
No |
bolichen97
left a comment
There was a problem hiding this comment.
Looks good to me. Head reviewed: fc3f664.
Both items from my review of f43e898 are fixed in this push:
- The cancel and identity release tests moved to the new file
test/test_mcp_gateway_backend_cancel.py(533 lines).test/test_mcp_gateway_backend_coverage.pyis no longer in the diff, so it does not grow past its line cap row. The new file imports the shared fixture and helpers frommcp_gateway_backend_coverage_helpers.py, and the autouse_no_real_metrics_filefixture is imported, so the moved tests keep their isolation. docs/architecture/mcp.mdnow describes the identity release hold: when the release is held, who inherits it (release_owed), and how a grant, a refusal, an unknown verdict or a grant that routes no stub settles it. The stray long line in the paragraph above is wrapped.
What I checked on this head:
- The source hunks in the
mcp_gatewaypackage are the same as at f43e898. The only other code change is the new_hold_identity_releaserow intest/test_backend_bindings.py. My earlier correctness read of the cancel branch, the settle order and the three release_owed arms still applies. - No commit on main since the merge base touches the
mcp_gatewaypackage,docs/architecture/mcp.mdor the touched tests, so main does not already carry this fix. - One commit, base
main. No touched path is on the security path list.
Not repeated here: the Goal wording and the scope of the identity release hold (Design Review and First Principles Review). You answered both on an earlier head, and the scope call belongs to a maintainer.
I am not approving yet. Backend Tests, Lint, E2E and the Opus and GPT review lanes were still running on this head when I read the checks, and PR Readiness is pending.
…ler subscribe When the identity release hold answers a last holder's unsubscribe locally, routing for the URI empties while the caller's subscription is still live upstream. An update the server sends before the in-flight subscribe's verdict then routed nowhere and was charged to a correct server as an unattributable-notification hazard. Orphan-mark the URI, as detach does; a grant or a confirmed release clears the mark.
|
Rebased onto current main (no conflicts) and addressed the Opus blocking finding at 3a0db53 in 1ddbf2c: when the identity release hold empties routing for the URI, |
bolichen97
left a comment
There was a problem hiding this comment.
Looks good to me. Head reviewed: 1ddbf2c.
The delta since my review of fc3f664 is the rebase plus one new commit, which orphan-marks a URI when the identity release hold answers the last holder's unsubscribe locally.
What I checked in the new commit:
backend_leases.py: the mark is added only when routing for the URI empties, and it uses the same bounded add (_ORPHANED_LEASES_MAX) as the detach path.- The mark clears on each way the held release settles. A grant of the in-flight subscribe clears it in
_on_resource_subscription_response, and a grant on a sentinel pending clears it in_settle. A refusal or unknown verdict sends the release, and a successful release clears it. A refused release keeps it, which matches the existing detach behavior. - A refusal with another same-caller subscribe still in flight passes the obligation on through
_hold_identity_release, so the mark correctly stays. - The new test asserts the mark directly, so by reading it goes red without the change. It also asserts no hazard while the release waits, and it asserts the hazard comes back after the release succeeds.
docs/architecture/mcp.mddescribes the new mark in the identity release hold paragraph.
All five model review lanes pass on this head, and Security Scope Review finds no security path touched.
I am not approving yet. Backend Tests and one E2E job were still running on this head when I read the checks, PR Readiness is pending, and an earlier change request from another reviewer is still open.
bolichen97
left a comment
There was a problem hiding this comment.
Approving head 1ddbf2c.
Gates checked on this head:
- PR Readiness is passed, and every check on this head is green.
- All model review lanes pass on this head, with no blocking finding.
- No file is on the security path list. The security checklist answers are all no: no auth change, no new external input parsing, no trust boundary or tool visibility change, no sandbox change, no approval gate change, and no secret handling.
- Base is main, and the branch merges cleanly.
My review of the code itself is in my earlier comment on this same head. An earlier change request from another reviewer is still open, so the merge waits for that reviewer.
|
HOLD at 1ddbf2c. The code looks sound. A cancelled What still needs a maintainer:
Auto-merge is armed, so our earlier change request is what holds the merge. — crew-pr-reviewer (r125) |
|
@iamwhatever your change requests here look addressed at the current head 1ddbf2c. Your later review asked for an issue tracking the detach, evict and sentinel grant work that was deferred, and #21433 now tracks it and is linked in the description. The refused resubscribe concern from your first review went away with the hand off design, as your later review noted, and I signed off on the identity release code in my approval on this same head. All checks are green and the branch merges cleanly. If you agree, could you review it again or withdraw the change request? |
iamwhatever
left a comment
There was a problem hiding this comment.
Recommend APPROVE at 1ddbf2cf1cba87b951d367617520f36558432b67. This approval replaces crew-pr-reviewer's earlier change requests (r107 at 016bbc0 and the deep re-check at 0b765e2).
The fix is sound. A cancelled resources/subscribe or unsubscribe is no longer sent its cancel, so the server's verdict settles the lease under the stub that sent it. Every other cancel is still marked and forwarded as on main (backend_stubs.py#L409-L431). On an identity server, _hold_identity_release (backend_leases.py#L592) holds a release only while a stub or in-flight subscribe of the same caller still depends on it. The release is settled on grant, refusal and unknown verdicts (#L655, backend_routing.py#L516, #L547). The bridge drops a cancelled id from _outstanding_ids (stub_bridge.py#L457).
Our r107 request is met. #21433 is open, linked in the description, and names the detach, evict and sentinel-grant sites. The head commit was pushed from the crew-pr-reviewer account, and maintainer bolichen97 reviewed and approved that exact head, including the identity release code. All lanes pass (UX skipped), PR Readiness and every check are green, there's no third-party change request, and the branch merges cleanly with main.
AI findings judged non-blocking
- First Principles item 1 / Design note 2: Goal line and title describe retire/hand-off approaches the diff dropped. Description wording only; the body's What changed states plainly that a cancelled tool call stays marked and the hand-off was rejected, and maintainer bolichen97 approved this head with that known. code
- First Principles item 3 / Design note 1: identity release hold also changes a final unsubscribe nobody cancelled. Declared in Backwards compatibility and docs/architecture/mcp.md; the hold only defers a release while a same-caller stub or subscribe still depends on the subscription, every verdict arm settles it, and maintainer bolichen97 signed off on the identity release code. code
— crew-pr-reviewer (r134)
Problem / Motivation
Goal: A request its client cancels stops being tracked as in flight, so it cannot age into the heartbeat's wedge ceiling and recycle a healthy shared MCP backend. For a tool call that means the entry is retired while the frames still tied to it (a progress notification, a sampling request) keep reaching the stub that made it. For a
resources/subscribeorresources/unsubscribethat holds a URI's lease it means the request is handed off, so the server's answer still settles the lease for the stubs waiting on it.Backend.forward_from_stubhandles a stub'snotifications/cancelledby remappingparams.requestIdto the gateway-scoped id and forwarding it. It keeps the request's_pending_requestsentry. A server that honours an MCP cancellation sends no response, so the entry is never settled._heartbeat_oncereads the oldest pending age, and atHARD_WEDGE_CEILING_SECS(SUBAGENT_TIMEOUT_SECS + 300, 11,100 s) it declares the backend wedged whatever its pings say._broadcast_backend_gonethen fails the in-flight calls of every session on that backend, and the backend is recycled.The stub has the same gap.
run_bridgeadds each request id to_outstanding_idsand removes it only on a response, so a cancelled id keeps the liveness monitor pinging, and a later bridge drop answers the cancelled call with-32603.Why it matters
Cancelling a call is ordinary: stopping a turn sends one. About three hours later, while the cancelling session stays attached, the heartbeat recycles a backend that still answers pings. On kirocrew-core that fails every co-pooled session's running
waitor spawn call.Not a goal
cancel_in_flight_for_stub, from disconnect, abort and app-call teardown). Their entries are whathas_recyclable_in_flightreads to recycle a backend whose last stub left, because a cancel is best-effort, and each is cleared by thedetach_stubthat follows or by the stub's own disconnect._CANCELLED_FIDS_KEPTcancels.What changed (motivation → approach → change)
_PendingRequest.cancelled) and the hard ceiling skips it, but the mark leaves out aresources/subscribeorresources/unsubscribe, whose verdict settles the shared lease tables. Its cancel is still forwarded, and its entry stays pending, unmarked. A server that honours the cancel sends no verdict, so the URI stays in_lease_awaiting_grant(a first subscribe) or_lease_awaiting_release(a final unsubscribe), every stub parked behind it waits for the backend's lifetime, and the entry ages into the ceiling.src/kiro_crew/mcp_gateway/backend_stubs.py, the cancel branch offorward_from_stub: for a subscribe or unsubscribe (an entry withresource_uri) the cancel is not forwarded. The entry stays owned by the stub that sent it, so the server answers it and the verdict settles the lease through the arms main already uses when a server answers a request it was asked to cancel: the URI leaves the awaiting set, parked stubs get their verdict, and a confirmed unsubscribe stops routing the stub. Every other cancelled request is marked and forwarded exactly as on main.src/kiro_crew/mcp_gateway/backend_leases.py, identity-capable server, a stub's final unsubscribe: the existing sharer guard (another routed stub of the same caller: settle locally, forward nothing) now also covers a same-caller subscribe still in flight. Forwarding the unsubscribe beside it would let the server grant that subscribe and then drop the caller's one subscription, leaving the new subscriber routed to nothing. The stub is unrouted and answered locally, and the release is left to that subscribe's verdict (_PendingRequest.release_owed,backend_wire.py). One rule,_hold_identity_release(backend_leases.py, bound onBackend), decides both that step and every later settlement of an owed release: it is sent only when no stub of the caller is routed for the URI and no other same-caller subscribe for it is in flight; a routed stub absorbs it (its own departure releases, as on main), and an in-flight subscribe inherits it (release_owedmoves to that pending). Both settlement arms call it: the stub-owned verdict arm (_on_resource_subscription_response) and the release sentinel's orphan arm in_settle(backend_routing.py), on a grant as well as on a refusal. So with several same-caller subscribes in flight the outcome does not depend on which answers first: no release while one is granted or still in flight, exactly one, as the caller, when none is.src/kiro_crew/mcp_gateway/stub_bridge.py,run_bridge: anotifications/cancelledfrom kiro-cli discards itsrequestIdfrom_outstanding_ids.has_recyclable_in_flight) still count it.Backwards compatibility
Compatible: requests that are not cancelled are tracked, answered and recycled exactly as on main, and every cancelled request other than a subscribe or unsubscribe is marked exactly as on main. A cancelled subscribe or unsubscribe is no longer sent its cancel, so the server answers it and the stub that sent it receives the verdict. On main a server that ignores a cancel produces the same outcome.
Accepted: a granted subscribe whose client cancelled it stays with that stub. The stub is routed and the upstream lease is held until the stub unsubscribes or detaches, both of which release as on main, and the client may receive
notifications/resources/updatedfor it. MCP makes cancellation best-effort: a receiver may ignore it and the requester must be ready for the response anyway, so this is a state every client already handles, and on main it is the outcome with any server that ignores or outruns the cancel. Releasing the grant from the gateway instead would need a gateway-originated release as the caller beside whatever same-caller subscribes are in flight, the ordering this PR's earlier revisions could not make safe; keeping the grant with the stub creates no release at all.On an identity-capable server, a stub's final unsubscribe sent while a same-caller subscribe for that URI is in flight is answered locally and its release waits for that subscribe's verdict, where main forwarded it at once. The cancel change is what makes this necessary: on main the cancel of such an unsubscribe is forwarded, and a server that honours it never applies the unsubscribe, so the in-flight subscribe keeps its grant (the stub is left pending instead, which is this PR's bug). This PR lands every cancelled unsubscribe, so without the rule it would revoke the sibling's grant on every such server. Main has the same race only on a server that ignores the cancel, or when nothing was cancelled. The owning spec,
docs/architecture/mcp.md, now states this rule after its cancel paragraph.No config key, API, frame shape or public function changes.
Tests
In short: eleven new cases fail on main 1b96d89 and pass here. Four of them also fail on this PR's previous head 1731193, which decided a deferred release by the first same-caller subscribe found; two fail on the head before it, e8f4897. With the stub and bindings tests and main's backend coverage file, 282 passed in each of 3 of 3 runs, RC=0.
Red on main (this branch's
test/test_mcp_gateway_backend_cancel.pycopied into a detached checkout of main 1b96d89, imported from that checkout's ownsrc),pytest test/test_mcp_gateway_backend_cancel.py -p no:cacheprovider -q:In
test/test_mcp_gateway_backend_cancel.py(TestForwardFromStubCancelandTestIdentityReleaseHold), failing on main:test_a_cancelled_subscribe_does_not_age_a_healthy_backend_into_the_ceiling: s1 takes a URI's lease, s2 parks behind it, s1 cancels. No cancel is forwarded, the server answers, s2 is granted, nothing stays pending, and past the hard ceiling with fresh pings the backend readsalive.test_a_cancelled_final_unsubscribe_settles_the_release_under_its_stub: the cancel of a final unsubscribe is not forwarded; its success clears routing and_lease_awaiting_release.test_an_identity_cancelled_subscribe_is_settled_by_its_own_verdict: on an identity server the grant routes the stub as the caller that took it, and no release is sent.test_a_last_holder_unsubscribe_waits_for_a_same_caller_subscribe[granted|refused]: s1 holds a URI as caller A, s2's subscribe as A is in flight, and s1 unsubscribes and cancels. No release goes out beside s2's subscribe. A grant routes s2 with no release, and a refusal sends exactly one, carrying A's caller block.test_a_release_left_to_one_of_two_same_caller_subscribes_spares_the_other(3 cases): s2 and s3 both have a subscribe as A in flight when s1, the last holder, unsubscribes. s3 granted then s2 refused, and s2 refused then s3 granted, each end with s3 routed as A and no release; both refused ends with exactly one release, as A. The first two fail on the previous head 1731193, which released on s2's refusal in both orders.test_a_release_left_to_a_detached_stubs_subscribe_spares_a_routed_sibling[granted|refused]: the subscribe carrying the release belongs to s2, which detaches before the server answers; s3 is granted as A meanwhile. s2's verdict settles under the release sentinel and releases nothing. The refused case fails on the previous head.test_a_retracted_subscribe_carrying_the_release_settles_it_beside_another_caller: s1 holds a URI as A and re-subscribes it, sb holds it as B, and s1 unsubscribes while its re-subscribe is in flight. The retracted subscribe inherits the release, and its grant sends exactly one release, as A, with sb still routed. Fails on the previous head, which released nothing because the URI was still routed for B.Passing on main as well:
test_a_cancelled_subscribe_the_server_never_answers_still_ages_out(an unanswered subscribe still trips the ceiling, and the recycle answers the parked rider) andtest_a_hung_backend_whose_only_call_was_cancelled_is_recycled(stale pings still recycle a backend whose only call was cancelled, #18841's mark through a real cancel).In
test/test_stub_bridge_liveness.py, failing on main:test_a_cancelled_request_is_no_longer_outstanding: through the realrun_bridge, the cancelled id is dropped and an uncancelled one stays outstanding.test/test_backend_bindings.pylists the one newBackendmember,_hold_identity_release, in the frozen inventory.Green:
pytest test/test_mcp_gateway_backend_cancel.py test/test_stub_bridge_liveness.py test/test_backend_bindings.py test/test_mcp_gateway_backend_coverage.py -p no:cacheprovider -q -n 8, 3 of 3 runs, 282 passed each (13 + 10 + 172 + 87). flake8, isort and the black ratchet pass on the touched files.Manual verification
None beyond the tests: the backend tests drive the real
forward_from_stub,_route_backend_lineand_heartbeat_onceover a mock process, and the stub test drives the realrun_bridge.Screenshots / video
N/A: no file under
website/changes.Related Issues
Builds on #18841, which marks a cancelled request so the hard ceiling skips it; this PR covers the subscribe and unsubscribe that the mark leaves out. No issue found: searched PRs and issues for "notifications/cancelled", "cancelled request pending", "hard wedge ceiling", "wedge cancelled" and "_pending_requests".
Follow-up: #21433 routes detach, evict and the sentinel's grant arm through
_hold_identity_release, so a same-caller subscribe still in flight is counted there.Pattern harvest
Rule candidate: review-prompt: before a change drops a request that ended without a response (a cancel, a timeout) from the table that tracks it, list every reader of that table; a liveness ceiling, notification attribution and a last-consumer recycle can each need the entry for a different reason, and a request whose verdict other clients wait on has to stay tracked until that verdict arrives.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement