Skip to content

revert: rollback "chore: add is_container_env to telemetry MCP-2 #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 30, 2025

Conversation

fmenezes
Copy link
Collaborator

@fmenezes fmenezes commented Jun 30, 2025

Reverts #298

fixes #320

@Copilot Copilot AI review requested due to automatic review settings June 30, 2025 14:39
@fmenezes fmenezes requested a review from a team as a code owner June 30, 2025 14:39
@fmenezes fmenezes changed the title Revert "chore: add is_container_env to telemetry MCP-2" revert: rollback "chore: add is_container_env to telemetry MCP-2" Jun 30, 2025
@gagik gagik changed the title revert: rollback "chore: add is_container_env to telemetry MCP-2" revert: rollback "chore: add is_container_env to telemetry MCP-2 Jun 30, 2025
@fmenezes fmenezes enabled auto-merge (squash) June 30, 2025 14:40
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR reverts the previous addition of the is_container_env telemetry property and related container-detection logic, restoring the original telemetry behavior.

  • Remove is_container_env from common properties and types
  • Strip out container environment detection and associated filesystem checks
  • Update telemetry initialization and emission flow to use an async startup and catch promise rejections
  • Adjust unit and integration tests to reflect the removal of container logic and new async patterns

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/telemetry/types.ts Removed is_container_env from CommonProperties
src/telemetry/telemetry.ts Dropped container detection, refactored startup/emit flow
src/tools/tool.ts Made emitToolEvent async and added .catch()
src/server.ts Added .catch() to emitEvents call
src/logger.ts Removed unused telemetryContainerEnvFailure log ID
tests/unit/telemetry.test.ts Updated imports, removed container test helpers, await emitEvents
tests/integration/telemetry.test.ts New integration test for actual machine ID resolution
Comments suppressed due to low confidence (1)

tests/unit/telemetry.test.ts:141

  • We currently lack a test covering the error path when apiClient.sendEvents fails. Adding a test to simulate a send error and verify that events are buffered and retried would improve coverage.
                await telemetry.emitEvents([testEvent]);

@@ -74,12 +74,12 @@ export abstract class ToolBase {
logger.debug(LogId.toolExecute, "tool", `Executing tool ${this.name}`);

const result = await this.execute(...args);
this.emitToolEvent(startTime, result, ...args);
await this.emitToolEvent(startTime, result, ...args).catch(() => {});
Copy link
Preview

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

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

[nitpick] Silently swallowing errors may make debugging failures difficult. Consider logging the caught error or at least adding a comment explaining why it's safe to ignore.

Copilot uses AI. Check for mistakes.

@@ -130,7 +130,7 @@ export class Server {
}
}

this.telemetry.emitEvents([event]);
this.telemetry.emitEvents([event]).catch(() => {});
Copy link
Preview

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

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

[nitpick] This empty .catch() will swallow any errors from emitEvents. It may be worth logging an error or warning to help diagnose unexpected telemetry failures.

Suggested change
this.telemetry.emitEvents([event]).catch(() => {});
this.telemetry.emitEvents([event]).catch((err) => {
logger.warn(`Failed to emit telemetry event: ${err.message}`, { error: err });
});

Copilot uses AI. Check for mistakes.

"telemetry",
`Error sending event to client: ${result.error instanceof Error ? result.error.message : String(result.error)}`
);
this.eventCache.appendEvents(events);
Copy link
Preview

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

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

[nitpick] On send failure the code appends events back to the cache but does not schedule an immediate retry. Consider documenting that retry happens on the next emit or add an explicit retry trigger to avoid long delays in flushing backlog.

Copilot uses AI. Check for mistakes.

@fmenezes fmenezes merged commit 8654791 into main Jun 30, 2025
17 checks passed
@fmenezes fmenezes deleted the revert-298-MCP-2 branch June 30, 2025 17:18
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 15979273150

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 41 of 45 (91.11%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.9%) to 75.857%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/tools/tool.ts 2 3 66.67%
src/telemetry/telemetry.ts 38 41 92.68%
Files with Coverage Reduction New Missed Lines %
src/telemetry/telemetry.ts 1 88.16%
Totals Coverage Status
Change from base Build 15979268264: 0.9%
Covered Lines: 827
Relevant Lines: 1008

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JavaScript heap out of memory
4 participants