fix(runtime): await gateway telemetry shutdown - #442
Open
zhengdaqi wants to merge 2 commits into
Open
Conversation
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
Make local gateway disposal await the owned telemetry shutdown and prevent disabled telemetry from creating a new empty queue file. This addresses the benchmark cleanup race where
dispose()returned beforetelemetry/queue.jsonlwas recreated, causing isolatedPILOT_HOMEremoval to fail withENOTEMPTY.This branch includes the already independently tested network-timer fix from PR #441 as its local parent so repository-wide tests have a clean baseline. The telemetry changes are the second commit and can be reviewed independently.
Changes
createLocalGateway().dispose()and await it in the server stop path.QA & Evidence
What was tested: Focused telemetry and local-gateway tests.
Observed result: 4 passed, 0 failed, 0 cancelled.
Artifact:
.omo/evidence/20260723-telemetry-shutdown/build-and-focused.txtWhy sufficient: Directly covers the observed queue-file race and the new awaitable/idempotent API.
What was tested: Complete
npm testsuite on the combined local branch.Observed result: 149 passed, 0 failed, 0 cancelled, exit code 0.
Artifact:
.omo/evidence/20260723-telemetry-shutdown/full-suite.txtWhy sufficient: Confirms no repository-wide regression after the parent timer baseline and telemetry lifecycle changes.
What was tested: Isolated real
createLocalGateway()initialization and disposal with disabled telemetry.Observed result: Calling
dispose()twice returns the same Promise; awaiting it leaves notelemetry/queue.jsonlbehind.Artifact:
.omo/evidence/20260723-telemetry-shutdown/build-and-focused.txtWhy sufficient: Exercises the actual gateway construction and shutdown surface rather than only mocking the sender.
Risks & Residuals
dispose()remains safe for existing callers that do not await it, while callers that need deterministic teardown can await the returned Promise. The gateway still does not own externally supplied telemetry; the server path continues to shut that client down separately. No credentials or external telemetry uploads were used.Related