Skip to content

fix(telemetry): use hosted ingestion proxy#171

Merged
willwashburn merged 1 commit into
mainfrom
telemetry-hosted-proxy
Jun 3, 2026
Merged

fix(telemetry): use hosted ingestion proxy#171
willwashburn merged 1 commit into
mainfrom
telemetry-hosted-proxy

Conversation

@willwashburn
Copy link
Copy Markdown
Member

@willwashburn willwashburn commented Jun 3, 2026

User description

Summary

  • default MCP telemetry capture to the hosted ingestion proxy at https://i.agentrelay.com
  • default engine PostHog log export to the same hosted proxy
  • keep explicit POSTHOG_HOST / Relaycast host overrides working

Verification

  • npm --prefix packages/mcp run test -- src/__tests__/telemetry.test.ts
  • npm --prefix packages/engine run test -- src/lib/__tests__/logger.test.ts src/lib/__tests__/origin.test.ts

CodeAnt-AI Description

Send telemetry and logs through the hosted proxy by default, while still allowing custom host overrides

What Changed

  • MCP telemetry now sends events to the hosted ingestion proxy by default instead of PostHog directly
  • Engine log export also uses the hosted proxy by default
  • Custom PostHog host settings still work for both telemetry and log export
  • Added test coverage for the default hosted proxy path and for host overrides

Impact

✅ Centralized telemetry delivery
✅ Fewer blocked log and event uploads
✅ Existing custom telemetry endpoints still work

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented Jun 3, 2026

CodeAnt AI is reviewing your PR.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Warning

Rate limit exceeded

@willwashburn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 27 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f4b1944d-b488-4c52-a091-cd26723c897d

📥 Commits

Reviewing files that changed from the base of the PR and between ae4d763 and 50f9158.

📒 Files selected for processing (4)
  • packages/engine/src/lib/__tests__/logger.test.ts
  • packages/engine/src/lib/logger.ts
  • packages/mcp/src/__tests__/telemetry.test.ts
  • packages/mcp/src/telemetry.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch telemetry-hosted-proxy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@agent-relay-code
Copy link
Copy Markdown
Contributor

ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed.

pr-reviewer could not complete review for #171 in AgentWorkforce/relaycast.
The review harness exited with code 1.
No review was posted; this needs operator attention.

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Jun 3, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the default PostHog host from https://us.i.posthog.com to https://i.agentrelay.com in both the engine logger and MCP telemetry modules, and updates or adds corresponding unit tests. The feedback suggests asserting that nodeRequestMock was called in the telemetry tests before accessing its call arguments to prevent cryptic TypeError failures.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +137 to +141
const options = nodeRequestMock.mock.calls[0]?.[0] as {
hostname: string;
path: string;
};
expect(options.hostname).toBe('app.posthog.example');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For better test failure messages and consistency with the other tests in this file (e.g., line 107), assert that nodeRequestMock was called before accessing its call arguments. This avoids a cryptic TypeError if the mock was not called.

Suggested change
const options = nodeRequestMock.mock.calls[0]?.[0] as {
hostname: string;
path: string;
};
expect(options.hostname).toBe('app.posthog.example');
expect(nodeRequestMock).toHaveBeenCalledTimes(1);
const options = nodeRequestMock.mock.calls[0]?.[0] as {
hostname: string;
path: string;
};
expect(options.hostname).toBe('app.posthog.example');

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented Jun 3, 2026

CodeAnt AI finished reviewing your PR.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/engine/src/lib/logger.ts">

<violation number="1" location="packages/engine/src/lib/logger.ts:7">
P2: Host overrides are not normalized here, so a blank/whitespace `posthogHost` can bypass the default and break log export with a relative URL.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

type LogFields = Record<string, unknown>;

const DEFAULT_POSTHOG_HOST = 'https://us.i.posthog.com';
const DEFAULT_POSTHOG_HOST = 'https://i.agentrelay.com';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Host overrides are not normalized here, so a blank/whitespace posthogHost can bypass the default and break log export with a relative URL.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/engine/src/lib/logger.ts, line 7:

<comment>Host overrides are not normalized here, so a blank/whitespace `posthogHost` can bypass the default and break log export with a relative URL.</comment>

<file context>
@@ -4,7 +4,7 @@ import type { AppEnv, EngineRuntime } from '../env.js';
 type LogFields = Record<string, unknown>;
 
-const DEFAULT_POSTHOG_HOST = 'https://us.i.posthog.com';
+const DEFAULT_POSTHOG_HOST = 'https://i.agentrelay.com';
 const DEFAULT_APP_VERSION = '0.1.0';
 const DEFAULT_SDK_VERSION = 'unknown';
</file context>

@willwashburn willwashburn merged commit 7e1cd29 into main Jun 3, 2026
5 checks passed
@willwashburn willwashburn deleted the telemetry-hosted-proxy branch June 3, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant