Repository navigation
Preserve vMCP resources until requests drain - #6715
Merged
Merged
Conversation
Keep workflow auditing and session resources available when HTTP draining times out, so callers can retry shutdown without losing terminal audit records. Preserve cleanup error chains during server construction and serving failures. Document drain ownership and retry limits, and cover incomplete shutdown, constructor rollback, and joined errors with regression tests. Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
JAORMX
requested review from
ChrisJBurns,
amirejaz,
jerm-dro,
jhrozek,
rdimitrov and
tgrunnagle
as code owners
September 25, 2026 13:32
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6715 +/- ##
==========================================
- Coverage 79.23% 79.23% -0.01%
==========================================
Files 800 800
Lines 81019 81013 -6
==========================================
- Hits 64194 64188 -6
Misses 16820 16820
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ChrisJBurns
approved these changes
Sep 25, 2026
ChrisJBurns
approved these changes
Sep 25, 2026
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.
Summary
Follow-up to #6110.
Server.Stopnow leaves request-used resources intact when HTTP draining fails. A serial retry with a fresh context can complete the drain and cleanup.Servefailure with the core-close error, andStartpreserves both serving and shutdown error chains.Type of change
Test plan
task test; targeted regressions pass, full-suite failures detailed below)task test-e2e)task lint-fix)git diff --checkand comparison of unrelated failures against untouched merge commit6180ced93The three new regression tests pass with race detection through the repository task:
Coverage includes a real HTTP composite workflow held across two failed shutdown attempts, a terminal audit record written before cleanup, successful fresh-context shutdown retry, constructor rollback releasing the audit descriptor, and preservation of both error identities on a serving failure.
task lint-fixreports zero issues.The full
task testrun was not green:pkg/transport:TestBridge_ToolsListChanged_TriggersReSynctimed out during teardown after ten minutes. Reproduced the hang on untouched6180ced93using a 30-second test timeout.pkg/vmcp/server/sessionmanager: the termination-during-initialization test received the earlier termination error and missed its expected factory call. Its focused baseline rerun passed; this failure was not reproduced in that rerun.Does this introduce a user-facing change?
Library callers receive an error without resource teardown if the owned HTTP server has not drained. Callers that keep running must retry
Stopserially with a fresh context. Embedders servingHandlerthrough their own HTTP server must fully drain that server before callingStop.Implementation plan
Implementation plan
Servefails; remove the now-unnecessary deferred cleanup guard.http.Server.Shutdowndrain barrier. Return immediately on drain failure before closing core, audit, or session resources, while retaining the HTTP server for a serial retry.Startwitherrors.Join.Special notes for reviewers
Stopcalls.