Repository navigation
fix: close durable runtime stores after shutdown drains writers - #732
Merged
imran-siddique merged 1 commit intoOct 6, 2026
Merged
imran-siddique merged 1 commit into
imran-siddique merged 1 commit into
Conversation
Signed-off-by: Héctor Alejandro Flórez Díaz <327943577+soyeladice-svg@users.noreply.github.com> Signed-off-by: Alejandro Florez <soyeladice@gmail.com>
soyeladice-svg
requested review from
a team,
carloshvp,
qubeena07,
rajnisht7 and
zohebk8s
as code owners
October 6, 2026 03:23
Contributor
|
🔴 Contributor Check: HIGH
Automated check by AgenTrust Contributor Check. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
imran-siddique
approved these changes
Oct 6, 2026
imran-siddique
left a comment
Member
There was a problem hiding this comment.
This meets #676 and the September 24 constraint: the stores close only once shutdown_drained is set, stay open when draining fails so a late call can still write its outcome, and each close is attempted independently with the original shutdown error kept as primary. All 18 checks pass, fuzzing included. Thanks @soyeladice-svg.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes #676.
Pass the three CLI-owned durable stores explicitly to MCPServer and close them during server shutdown only after MCPProxy has confirmed that all admitted calls have drained. Reuse the existing admission gate and drain logic.
Shutdown is serialized. Every owned store gets an independent close attempt; successful closes are not repeated, failed closes can be retried, and an earlier proxy shutdown error remains the primary error. Kill-switch store close uses its existing lock. Embedded servers retain ownership of stores they have not explicitly transferred.
Why
The production runtime creates persistent audit, kill-switch, and sensitivity stores but did not close their handles in the server lifespan. Closing them before a cancellation-resistant call has drained would instead break its final durable writes.
Security impact
No policy, receipt format, audit-chain, or TEE behavior changes. Durable handles remain open when draining fails, so an admitted tool can still persist its audit outcome and state before a later shutdown retry closes them.
Test plan
Regression coverage: normal closure; one close failure does not stop other stores and retries only the failed close; original proxy cleanup errors are preserved; incomplete drain permits real durable audit/state writes, rejects new admissions and then closes on retry; borrowed stores are not closed.
No manual deployment test was performed.
AI assistance: prepared and tested with Codex for Burs-IA.
DCO sign-off