Skip to content

[BUG] Scheduled runs fail on memory-enabled harnesses: "preload memory search failed: memory requires caller identity" #3812

Backlog

Description

@leshcat

📋 Prerequisites

  • I have searched the existing issues to avoid creating a duplicate
  • By submitting this issue, you agree to follow our Code of Conduct
  • I am using the latest version of the software
  • I have tried to clear cache/cookies or used incognito mode (if ui-related)
  • I can consistently reproduce this issue

🎯 Affected Service(s)

Not Sure

🚦 Impact/Severity

Minor inconvenience

🐛 Bug Description

A scheduled run of an Agent whose Harness has spec.kagent.memory set always fails before the model is called:

agent run failed: preload memory search failed: memory requires caller identity

The same Agent works when invoked interactively (UI or kagent agent invoke), and memory is saved/recalled correctly there.

🔄 Steps To Reproduce

  1. Enable memory on a kagent Harness:
    spec:
      kagent:
        memory:
          modelConfigRef:
            name: embedding-model-config
          ttlDays: 30
  2. Create an Agent on that Harness and check that memory works interactively.
  3. In the UI, create a schedule for that Agent with any prompt (e.g. Answer Hello to my Hi) and trigger it, or wait for it to fire.
  4. The execution's session shows agent run failed: preload memory search failed: memory requires caller identity.

🤔 Expected Behavior

The scheduled execution runs as the schedule's creator, the same identity that owns the schedule and its Session. Memory is then read and written for that user, as in an interactive Session.

📱 Actual Behavior

Scheduled runs fail on memory-enabled harnesses:

agent run failed: preload memory search failed: memory requires caller identity

💻 Environment

  • kagent chart / images: 1.0.0 (code path unchanged in v1.0.1)
  • Harness type: kagent
  • Memory: pgvector, embedding ModelConfig on the OpenAI provider (embedding provider is irrelevant — the call fails before any embedding request)
  • config.server.auth.mode: default (insecure)

🔧 CLI Bug Report

No response

🔍 Additional Context

No response

📋 Logs

📷 Screenshots

image image

🙋 Are you willing to contribute?

  • I am willing to submit a PR to fix this issue

Activity

  1. atishay-kasliwal commented on Dec 1, 2026

    @atishay-kasliwal

    As far as I can tell, scheduled runs never pass the creator's identity to the runtime.

    • Interactive messages carry the HTTP auth session. The gateway forwards it as X-User-Id, and UserIDCallInterceptor turns that into the caller that memory needs.
    • The scheduled run controller (go/core/internal/controller/scheduledrun/controller.go) calls c.gateway.SendStreamingMessage(dispatchCtx, ...) with a context that has no auth session. So the runtime sees no user, and memoryUserID fails with "memory requires caller identity".

    Proposed fix: attach an auth session for execution.GetCreator() to dispatchCtx before the send, so the run executes as the schedule's creator, as the issue expects. I'd add a controller test that checks the forwarded identity is the creator.

    Happy to take it if that matches how you want scheduled runs to authenticate. Or would you rather they use a service identity?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions