Skip to content

Fix agent nickname Identity RPC calls missing x-identity-id metadata #46

@rowan-stein

Description

@rowan-stein

User request

E2E CI (agynio/e2e) is failing when creating/updating/importing an agent with a nickname.

Symptom

Terraform provider acceptance tests fail:

  • TestAccAgynAgent_update
  • TestAccAgynAgent_import

Error excerpt:

create agent: internal: set nickname: rpc error: code = Unauthenticated desc = identity not available: x-identity-id not found in metadata

Example failing run:

Root cause (analysis)

When CreateAgent includes a non-empty nickname, agents-service calls Identity service to set the nickname.

Identity service requires x-identity-id in outgoing gRPC metadata, but agents-service currently calls Identity using the incoming request context (ctx) without forwarding the identity metadata from incoming → outgoing.

As a result, Identity returns Unauthenticated and agent creation rolls back.

Specification / fix

In agents-service, for any Identity RPCs that require caller identity (e.g. SetNickname, RemoveNickname, etc.):

  1. Extract x-identity-id from metadata.FromIncomingContext(ctx).
  2. Create an outgoing context that includes that header, e.g. metadata.AppendToOutgoingContext(ctx, "x-identity-id", identityID).
  3. Use that outgoing context when calling the Identity client.

Acceptance criteria

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