#1672·adk-go

artifact: session "user" leaks filenames into other sessions' listings

Author: ktsoatorCreated Sep 30, 2026Updated Sep 30, 2026
Labelsbug

Description

When using artifact.InMemoryService(), a regular artifact saved in a session named "user" appears in other sessions' artifact listings under the same app and user.

The other session cannot load the artifact, so List returns a filename that Load cannot resolve.

Reproduction

go
package main

import (
	"context"
	"errors"
	"fmt"
	"io/fs"
	"slices"

	"google.golang.org/adk/v2/artifact"
	"google.golang.org/genai"
)

func main() {
	ctx := context.Background()
	svc := artifact.InMemoryService()

	_, err := svc.Save(ctx, &artifact.SaveRequest{
		AppName:   "app",
		UserID:    "u",
		SessionID: "user",
		FileName:  "private.txt",
		Part:      genai.NewPartFromText("test"),
	})
	if err != nil {
		panic("save failed")
	}

	listed, err := svc.List(ctx, &artifact.ListRequest{
		AppName:   "app",
		UserID:    "u",
		SessionID: "other-session",
	})
	if err != nil {
		panic("list failed")
	}
	fmt.Println("private artifact listed:",
		slices.Contains(listed.FileNames, "private.txt"))

	_, err = svc.Load(ctx, &artifact.LoadRequest{
		AppName:   "app",
		UserID:    "u",
		SessionID: "other-session",
		FileName:  "private.txt",
	})
	fmt.Println("load returns not found:", errors.Is(err, fs.ErrNotExist))
}

Actual Behavior

private artifact listed: true
load returns not found: true

Save accepts "user" as the session ID. Another session sees the private filename, but loading it returns fs.ErrNotExist.

Expected Behavior

private artifact listed: false
load returns not found: true

Regular artifacts should only appear in their own session. Artifacts whose filenames start with user: should remain shared across sessions belonging to the same user.