Skip to content

agent-relay-mcp.startup.test.ts asserts on telemetry that varies by machine #1437

Description

@khaliqgant

Two tests in packages/cli/src/cli/agent-relay-mcp.startup.test.ts fail on a clean checkout because they assert on telemetry context that is read from local machine configuration:

  • registers owned tools, prompt text, fleet tools, and strips execution metadata from tools/list
  • passes telemetry context through Agent Relay MCP clients

The assertion expects a fixed telemetry payload, but the received object carries this machine's real values:

+     "agentRelayOrgSlug": "khaliq-gant-s-workspace-d3f705aa",
+     "agentRelayUserId": "0403d3ba-55ba-4ee6-aeee-13403d9aeac2",
      "baseUrl": "https://relay.example.com/",

Reproduction

On an unmodified checkout of main (b0151fff2):

npx vitest run packages/cli/src/cli/agent-relay-mcp.startup.test.ts
→ Tests  2 failed | 24 passed (26)

Both failures are present before any change and reproduce identically after one, so they are environmental rather than a regression. I confirmed this while working on #1436 — baseline 24 passed / 2 failed, and 34 passed / same 2 failed with that change applied.

Why it is worth fixing

A test whose result depends on whose laptop it runs on cannot gate anything. It will pass in CI where the values happen to be absent or stubbed, fail locally for anyone with a real workspace configured, and train contributors to ignore a red suite in that file — which is where a real regression would eventually hide.

The fix is presumably to stub the telemetry context (org slug, user ID, distinct ID) rather than letting the resolver read ambient configuration during the test.

Filed from the delegation-identity work; not fixing it here to keep #1436 scoped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions