The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
feat(backend): avatars in the attachments bucket when there is no avatar bucket, linked on its CDN (#1938)
0xken15b004d94bbee2
diff --git a/backend/integration/superTabProfile.test.ts b/backend/integration/superTabProfile.test.tsindex e29a9ec7c..37c3c90bc 100644--- a/backend/integration/superTabProfile.test.ts+++ b/backend/integration/superTabProfile.test.ts@@ -9,7 +9,7 @@ import { PrismaClient } from '@prisma/client'import Fastify, { type FastifyInstance } from 'fastify'import type { AuthUser } from '../src/lib/ssoAuth.js'import { SuperTabStore } from '../src/superTabs/store.js'-import { MemoryAttachmentStore, MemoryAvatarStore } from '../src/superTabs/attachments.js'+import { CdnAvatarStore, MemoryAttachmentStore, MemoryAvatarStore } from '../src/superTabs/attachments.js'import { superTabRoutes } from '../src/routes/superTabs.js'import { errorHandler } from '../src/middlewares/errorHandler.js'import type { Command } from '../src/superTabs/commands.js'@@ -231,6 +231,60 @@ describe('setting avatars', () => {})})+// Prod has no avatar bucket (Ken, 2026-10-28): pictures go in the attachments bucket under avatars/ and are linked on its+// CDN, as chat files are.+describe('avatars in the attachments bucket', () => {+ const bucket = new MemoryAttachmentStore()+ let shared: SuperTabStore+ let reads: FastifyInstance+ beforeAll(async () => {+ shared = new SuperTabStore(db, Date.now, { store: bucket, prefix: 'super-tabs', publicBase: 'https://cdn.example.test',+ avatars: new CdnAvatarStore(bucket, 'https://cdn.example.test'), avatarPrefix: 'avatars' })+ reads = Fastify()+ reads.setErrorHandler(errorHandler)+ reads.addHook('onRequest', async request => { request.user = [owner, peer].find(u => `Bearer ${u.sub}` === request.headers.authorization) })+ await reads.register(superTabRoutes, { store: shared, github: null })+ await reads.ready()+ })+ afterAll(async () => { await reads?.close() })+ const picture = async (tab: string, bytes: Uint8Array) => {+ const { Readable } = await import('node:stream')+ const { avatar } = await shared.uploadAvatar(owner, tab, { body: Readable.from([Buffer.from(bytes)]) })+ await shared.execute(owner, tab, { operationId: randomUUID(), command: { type: 'member.avatar', avatar: { kind: 'upload', id: avatar.id } } })+ return (await db.superTabAttachment.findUniqueOrThrow({ where: { id: avatar.id } })).objectKey+ }+ const linkFor = async (tab: string) => {+ const response = await reads.inject({ method: 'GET', url: `/api/super-tabs/${tab}/parts`, headers: { authorization: `Bearer ${peer.sub}` } })+ return response.json().data.derived?.avatars?.[`person:${owner.sub}`] as string | undefined+ }++ it('uploads, reads and replaces a picture, linked on the CDN', async () => {+ const tab = (await shared.create(owner, randomUUID(), 'Shared bucket')).id+ const invitation = await shared.execute(owner, tab, { operationId: randomUUID(), command: { type: 'invite.create', email: peer.email, role: 'collaborator', conversationId: 'lead' } })+ await shared.execute(peer, tab, { operationId: randomUUID(), command: { type: 'invite.accept', inviteId: invitation.result.inviteId as string } })+ const first = await picture(tab, image(64))+ expect(first).toMatch(new RegExp(`^avatars/${tab}/[0-9a-f]{32}/avatar$`))+ expect(bucket.objects.get(first)).toMatchObject({ contentType: 'image/png' })+ expect(await linkFor(tab)).toBe(`https://cdn.example.test/${first}`)+ expect(bucket.objects.get(first)!.bytes).toEqual(Buffer.from(image(64)))+ const second = await picture(tab, image(96))+ expect(second).not.toBe(first)+ expect(await linkFor(tab)).toBe(`https://cdn.example.test/${second}`)+ expect(bucket.objects.get(second)!.bytes).toEqual(Buffer.from(image(96)))+ })++ it('keeps chat files out of the avatar folder and out of avatar links', async () => {+ const tab = (await shared.create(owner, randomUUID(), 'Shared bucket')).id+ const { Readable } = await import('node:stream')+ const chat = await shared.upload(owner, tab, 'lead', { name: 'contract.pdf', mime: 'application/pdf', body: Readable.from([Buffer.from('private')]) })+ const chatKey = (await db.superTabAttachment.findUniqueOrThrow({ where: { id: chat.attachment.id } })).objectKey+ expect(chatKey).toMatch(/^super-tabs\//)+ await expect(shared.execute(owner, tab, { operationId: randomUUID(), command: { type: 'member.avatar', avatar: { kind: 'upload', id: chat.attachment.id } } }))+ .rejects.toMatchObject({ code: 'AVATAR_UNAVAILABLE' })+ expect([...bucket.objects.keys()].filter(objectKey => objectKey.startsWith('avatars/'))).not.toContain(chatKey)+ })+})+describe('reactions', () => {const post = async (tab: string, text = 'Shipped the fix') =>(await run(tab, { type: 'message.send', conversationId: 'lead', text, replyTo: null, recipientIds: [] })).result.messageId as stringdiff --git a/backend/src/config/env.ts b/backend/src/config/env.tsindex b1d9bfe69..a2a1e2ac8 100644--- a/backend/src/config/env.ts+++ b/backend/src/config/env.ts@@ -245,7 +245,9 @@ const envSchema = z.object({SUPER_TAB_ATTACHMENTS_PREFIX: z.string().default('super-tabs'),// Where clients read the files. https:// in production (superTabs/attachments.ts refuses anything else at startup).SUPER_TAB_ATTACHMENTS_PUBLIC_BASE: z.string().url().default('https://cdn.harness.autonomous.ai'),- // A private bucket (no public read) for Swarm avatars, served only through signed links. Unset: avatar uploads are off.+ // A private bucket (no public read) for Swarm avatars, served only through signed links that expire. Unset: avatars go in+ // the attachments bucket under avatars/ and are linked on its public CDN like chat files, links that never expire+ // (docs/swarms.md). No attachments bucket either: avatar uploads are off.SUPER_TAB_AVATARS_BUCKET: z.string().default(''),// The Harness GitHub App (github/app.ts, docs/swarm-github-app.md): a Swarm agent doing a task pushes and opens pulldiff --git a/backend/src/superTabs/attachments.test.ts b/backend/src/superTabs/attachments.test.tsindex 6e0754d3e..faa4ddb31 100644--- a/backend/src/superTabs/attachments.test.ts+++ b/backend/src/superTabs/attachments.test.ts@@ -50,9 +50,28 @@ describe('attachment bucket credentials', () => {expect(attachmentsFromEnv({ ...env(''), NODE_ENV: 'production' })?.publicBase).toBe('https://cdn.example.test')})- it('keeps avatars off without a private bucket, and never in the public one', () => {- expect(attachmentsFromEnv(env(encoded(key)))?.avatars).toBeNull()- expect(attachmentsFromEnv(env(encoded(key), 'attachments', 'avatars'))?.avatars).toBeInstanceOf(GcsAvatarStore)+ // Prod has the attachments bucket only (Ken, 2026-10-28): avatars live there under their own folder and are linked on+ // its CDN like chat files, so nothing is signed (no signing permission is needed either).+ it('keeps avatars in the attachments bucket under avatars/, on its CDN, without a bucket of their own', async () => {+ const shared = attachmentsFromEnv(env(encoded(key)))!+ expect(shared.avatarPrefix).toBe('avatars')+ expect(await shared.avatars!.signedUrl('avatars/tab/0123/avatar', Date.now() + 3_600_000)).toBe('https://cdn.example.test/avatars/tab/0123/avatar')+ const bucket = await (shared.avatars as unknown as { store: { files(): Promise<import('@google-cloud/storage').Bucket> } }).store.files()+ expect(bucket.name).toBe('attachments')+ })++ it('lets a dedicated avatar bucket win, under the attachments prefix as before', () => {+ const dedicated = attachmentsFromEnv(env(encoded(key), 'attachments', 'avatars'))!+ expect(dedicated.avatars).toBeInstanceOf(GcsAvatarStore)+ expect(dedicated.avatarPrefix).toBe('super-tabs')+ })++ it('refuses at startup a chat-file prefix that would put chat files in the avatar folder', () => {+ for (const prefix of ['avatars', '/avatars/', 'avatars/chat']) {+ expect(() => attachmentsFromEnv({ ...env(''), SUPER_TAB_ATTACHMENTS_PREFIX: prefix })).toThrow('SUPER_TAB_ATTACHMENTS_PREFIX')+ }+ // With a bucket of their own, the folders never meet.+ expect(attachmentsFromEnv({ ...env('', 'attachments', 'pictures'), SUPER_TAB_ATTACHMENTS_PREFIX: 'avatars' })).not.toBeNull()})it('signs an avatar link with the configured key, for a limited time, without a network call', async () => {diff --git a/backend/src/superTabs/attachments.ts b/backend/src/superTabs/attachments.tsindex da61e52ba..8cabf5356 100644--- a/backend/src/superTabs/attachments.ts+++ b/backend/src/superTabs/attachments.ts@@ -27,18 +27,23 @@ export interface AttachmentStore {/** Streams `body` into the object and answers its size. Past `cap` bytes it throws AttachmentTooLarge and leaves no object. */put(objectKey: string, file: { name: string; mime: string }, body: Readable, cap: number): Promise<number>}-/** The private bucket avatars are kept in: nobody reads an object without a link the server signed (avatarLinks.ts). */+/** Where avatars are kept, and the link a member read carries for one (avatarLinks.ts). */export interface AvatarStore extends AttachmentStore {- /** A link that opens [objectKey] until [expiresAt] (epoch ms), and never after. */+ /** A link that opens [objectKey]: in a private bucket until [expiresAt] (epoch ms) and never after; on the CDN, for good. */signedUrl(objectKey: string, expiresAt: number): Promise<string>}-/** `avatars`: the private avatar bucket; without one, avatar uploads are refused and presets still work. */-export interface Attachments { store: AttachmentStore; prefix: string; publicBase: string; avatars?: AvatarStore | null }+/** `avatars`: where avatars are kept and how they are linked (AvatarStore); without it, avatar uploads are refused and presets+ * still work. `avatarPrefix`: the folder avatar keys start with, and the only one a link is signed for (avatarLinks.ts);+ * `prefix` when unset. */+export interface Attachments { store: AttachmentStore; prefix: string; publicBase: string; avatars?: AvatarStore | null; avatarPrefix?: string }+/** Avatars' folder in the attachments bucket, when they have no bucket of their own. */+export const SHARED_AVATAR_PREFIX = 'avatars'+export const trimPrefix = (prefix: string) => prefix.replace(/^\/+|\/+$/g, '')/** Anyone holding a link can open the file, so the key carries 128 random bits; the name segment is for people. */export function objectKeyFor(prefix: string, tabId: string, name: string): string {const safe = name.replaceAll(/[^A-Za-z0-9._-]+/g, '_').replace(/^[._]+/, '').slice(-120) || 'file'- return [prefix.replace(/^\/+|\/+$/g, ''), tabId, randomBytes(16).toString('hex'), safe].filter(Boolean).join('/')+ return [trimPrefix(prefix), tabId, randomBytes(16).toString('hex'), safe].filter(Boolean).join('/')}export const publicUrl = (base: string, objectKey: string) => `${base.replace(/\/+$/, '')}/${objectKey}`@@ -150,6 +155,13 @@ export class GcsAvatarStore extends GcsAttachmentStore implements AvatarStore {}}+/** Avatars in the attachments bucket, linked on its CDN as chat files are: permanent public links, so nothing is signed. */+export class CdnAvatarStore implements AvatarStore {+ constructor(readonly store: AttachmentStore, private readonly publicBase: string) {}+ put(objectKey: string, file: { name: string; mime: string }, body: Readable, cap: number) { return this.store.put(objectKey, file, body, cap) }+ async signedUrl(objectKey: string) { return publicUrl(this.publicBase, objectKey) }+}+export class MemoryAttachmentStore implements AttachmentStore {readonly objects = new Map<string, { bytes: Buffer; contentType: string; contentDisposition: string }>()async put(objectKey: string, file: { name: string; mime: string }, body: Readable, cap: number) {@@ -188,8 +200,16 @@ export function attachmentsFromEnv(env: { NODE_ENV: string; SUPER_TAB_ATTACHMENT// Read even without a bucket, so a broken key fails the deploy that set it rather than the one that adds the bucket.const account = serviceAccountFrom(env.SUPER_TAB_ATTACHMENTS_CREDENTIALS)if (!env.SUPER_TAB_ATTACHMENTS_BUCKET) return null- // Avatars are member-only, so never the public attachments bucket: without a private one, uploads stay off.- return { store: new GcsAttachmentStore(env.SUPER_TAB_ATTACHMENTS_BUCKET, account), prefix: env.SUPER_TAB_ATTACHMENTS_PREFIX,- publicBase: env.SUPER_TAB_ATTACHMENTS_PUBLIC_BASE,- avatars: env.SUPER_TAB_AVATARS_BUCKET ? new GcsAvatarStore(env.SUPER_TAB_AVATARS_BUCKET, account) : null }+ const base = { store: new GcsAttachmentStore(env.SUPER_TAB_ATTACHMENTS_BUCKET, account), prefix: env.SUPER_TAB_ATTACHMENTS_PREFIX,+ publicBase: env.SUPER_TAB_ATTACHMENTS_PUBLIC_BASE }+ // A bucket of their own wins: nobody reads it without a signed link.+ if (env.SUPER_TAB_AVATARS_BUCKET) return { ...base, avatars: new GcsAvatarStore(env.SUPER_TAB_AVATARS_BUCKET, account), avatarPrefix: trimPrefix(base.prefix) }+ // Prod has only the attachments bucket (Ken, 2026-10-28, option B1): avatars live there in their own folder and are linked+ // on its CDN like chat files, so anyone who once had a picture's link keeps it (docs/swarms.md). Chat files never go in+ // the avatar folder, and avatar links are made for that folder alone.+ const chat = trimPrefix(base.prefix)+ if (chat === SHARED_AVATAR_PREFIX || chat.startsWith(`${SHARED_AVATAR_PREFIX}/`)) {+ throw new Error(`SUPER_TAB_ATTACHMENTS_PREFIX must not be ${SHARED_AVATAR_PREFIX}/ or inside it while avatars share the attachments bucket. Pick another prefix, or set SUPER_TAB_AVATARS_BUCKET.`)+ }+ return { ...base, avatars: new CdnAvatarStore(base.store, base.publicBase), avatarPrefix: SHARED_AVATAR_PREFIX }}diff --git a/backend/src/superTabs/avatarLinks.test.ts b/backend/src/superTabs/avatarLinks.test.tsnew file mode 100644index 000000000..a60d00c2b--- /dev/null+++ b/backend/src/superTabs/avatarLinks.test.ts@@ -0,0 +1,19 @@+import { describe, expect, it } from 'vitest'+import { MemoryAvatarStore } from './attachments.js'+import { AvatarLinks } from './avatarLinks.js'++describe('avatar links', () => {+ const now = Date.UTC(2026, 9, 28, 6, 0)++ // In the shared attachments bucket a link opens whatever key it names: only the avatar folder is ever signed.+ it('signs only pictures in the avatar folder', async () => {+ const bucket = new MemoryAvatarStore('https://bucket.example.test')+ const links = await new AvatarLinks(bucket, 'avatars').forReader(+ { people: [{ id: 'p1', avatar: { kind: 'upload', key: 'avatars/tab/0123/avatar' } },+ { id: 'p2', avatar: { kind: 'upload', key: 'super-tabs/tab/4567/contract.pdf' } },+ { id: 'p3', avatar: { kind: 'upload', key: 'avatarsx/tab/89ab/avatar' } }] } as never,+ [{ id: 'a1', avatar: { kind: 'upload', key: 'super-tabs/tab/cdef/notes.txt' } }], now)+ expect(Object.keys(links)).toEqual(['person:p1'])+ expect(links['person:p1']).toMatch(/^https:\/\/bucket\.example\.test\/avatars\/tab\/0123\/avatar\?/)+ })+})diff --git a/backend/src/superTabs/avatarLinks.ts b/backend/src/superTabs/avatarLinks.tsindex decf6d699..d2ae523d1 100644--- a/backend/src/superTabs/avatarLinks.ts+++ b/backend/src/superTabs/avatarLinks.ts@@ -2,8 +2,9 @@ import type { AvatarStore } from './attachments.js'import type { Avatar } from './profile.js'import type { SuperTabState } from './model.js'-/** A link is the same through each half hour, so a picture is fetched once in it rather than on every poll, and lasts an- * hour from that half hour's start: a copied link stops opening within an hour, and a member removed gets no new one. */+/** A link is the same through each half hour, so a picture is fetched once in it rather than on every poll. In a private+ * avatar bucket it lasts an hour from that half hour's start: a copied link stops opening within an hour, and a member+ * removed gets no new one. On the attachments CDN (no avatar bucket) it is the picture's permanent address. */export const AVATAR_LINK_WINDOW_MS = 30 * 60_000export const AVATAR_LINK_TTL_MS = 60 * 60_000export const avatarLinkExpiry = (now: number) => Math.floor(now / AVATAR_LINK_WINDOW_MS) * AVATAR_LINK_WINDOW_MS + AVATAR_LINK_TTL_MS@@ -11,17 +12,21 @@ export const avatarLinkExpiry = (now: number) => Math.floor(now / AVATAR_LINK_WI/** Signs at most once per picture and window: signing may call the cloud (IAM signBlob) without a key of our own. */export class AvatarLinks {private readonly signed = new Map<string, string>()- constructor(private readonly bucket: AvatarStore) {}+ /** [folder]: the only keys signed. In the shared attachments bucket a link opens whatever key it names, so a key outside+ * the avatar folder (a chat file's) never gets one, whatever a record says. Empty: the whole (avatar-only) bucket. */+ constructor(private readonly bucket: AvatarStore, private readonly folder = '') {}/** A member read's links, by `person:<id>` and `agent:<id>`, for the people and agents it can see that have uploads. */async forReader(state: Pick<SuperTabState, 'people'>, agents: Array<{ id: string; avatar?: Avatar }>, now: number): Promise<Record<string, string>> {const expiresAt = avatarLinkExpiry(now)const holders = [...state.people.map(p => [`person:${p.id}`, p.avatar] as const), ...agents.map(a => [`agent:${a.id}`, a.avatar] as const)]const links = await Promise.all(holders.flatMap(([who, avatar]) =>- avatar?.kind === 'upload' ? [this.link(avatar.key, expiresAt).then(url => [who, url] as const)] : []))+ avatar?.kind === 'upload' && this.inFolder(avatar.key) ? [this.link(avatar.key, expiresAt).then(url => [who, url] as const)] : []))return Object.fromEntries(links)}+ private inFolder(objectKey: string) { return !this.folder || objectKey.startsWith(`${this.folder}/`) }+private async link(objectKey: string, expiresAt: number): Promise<string> {const cached = this.signed.get(`${objectKey}@${expiresAt}`)if (cached) return cacheddiff --git a/backend/src/superTabs/model.ts b/backend/src/superTabs/model.tsindex d4af433d5..ca1a3dc18 100644--- a/backend/src/superTabs/model.ts+++ b/backend/src/superTabs/model.ts@@ -557,7 +557,7 @@ export function visibleState(state: SuperTabState, actor: Actor, now = Date.now(}for (const project of projectsOf(visible)) for (const target of awaitingWorkers(visible, project.id)) target.workDecision = 'awaiting'for (const project of visible.projects ?? []) project.skillSet = skillSetOf(project)- // An uploaded avatar's stored key stays on the server; readers get a signed link with each parts read (avatarLinks.ts).+ // An uploaded avatar's stored key stays on the server; readers get a link with each parts read (avatarLinks.ts).visible.people = visible.people.map(withAvatarView) as Person[]visible.agents = visible.agents.map(withAvatarView) as Agent[]// On Custom every agent shows the role it runs, null when its kind has none; elsewhere a role id means nothing yet.diff --git a/backend/src/superTabs/profile.ts b/backend/src/superTabs/profile.tsindex a1be7d554..1426c7cf3 100644--- a/backend/src/superTabs/profile.ts+++ b/backend/src/superTabs/profile.ts@@ -30,8 +30,8 @@ export function setStatus(state: SuperTabState, actor: Actor, status: z.infer<ty/** Pictures a person may pick instead of uploading one; Desktop draws each. */export const AVATAR_PRESETS = ['fox', 'owl', 'cat', 'panda', 'octopus', 'cactus', 'rocket', 'sun'] as const/** What a member or agent shows: an uploaded picture or a preset. Absent: the default, initials for a person, a pattern from- * the name for an agent (Desktop). An upload keeps its object's key in the private avatar bucket; readers never get the key,- * only a short-lived signed link with each read (avatarLinks.ts). */+ * the name for an agent (Desktop). An upload keeps its object's key on the server; readers never get the key, only a link with+ * each read (avatarLinks.ts): short-lived in a private avatar bucket, permanent on the attachments CDN. */export type Avatar = { kind: 'upload'; key: string } | { kind: 'preset'; key: (typeof AVATAR_PRESETS)[number] }/** An avatar as readers get it: an upload says only that there is one. */export type AvatarView = { kind: 'upload' } | Extract<Avatar, { kind: 'preset' }>diff --git a/backend/src/superTabs/read/service.ts b/backend/src/superTabs/read/service.tsindex 28b1ab065..8d6dd9450 100644--- a/backend/src/superTabs/read/service.ts+++ b/backend/src/superTabs/read/service.ts@@ -40,7 +40,7 @@ export class SwarmReads {constructor(private readonly store: SuperTabStore, private readonly options: { now?: () => number; githubApp?: boolean } = {}) {this.db = store.dbthis.now = options.now ?? store.now- this.avatarLinks = store.avatars ? new AvatarLinks(store.avatars) : null+ this.avatarLinks = store.avatars ? new AvatarLinks(store.avatars, store.avatarPrefix) : null}private readonly avatarLinks: AvatarLinks | nulldiff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.tsindex 522572402..f2c45f33e 100644--- a/backend/src/superTabs/store.ts+++ b/backend/src/superTabs/store.ts@@ -11,7 +11,7 @@ import { redactCredentials } from './credentials.js'import type { AvatarUpload } from './profile.js'import { reactionCounts, type ReactionTarget } from './reactions.js'import { pageDeliveries, pageReactions } from './pageReads.js'-import { attachmentMime, attachmentName, AttachmentTooLarge, AVATAR_PURPOSE, AVATAR_TYPES, checkedType, MAX_ATTACHMENT_BYTES, MAX_AVATAR_BYTES, objectKeyFor, peekType, publicUrl,+import { attachmentMime, attachmentName, AttachmentTooLarge, AVATAR_PURPOSE, AVATAR_TYPES, checkedType, MAX_ATTACHMENT_BYTES, MAX_AVATAR_BYTES, objectKeyFor, peekType, publicUrl, trimPrefix,type Attachment, type Attachments, type AttachmentStore, type AvatarStore } from './attachments.js'import { randomBytes } from 'node:crypto'import type { Readable } from 'node:stream'@@ -265,8 +265,10 @@ const routeDecisionOf = (command: Command): string | undefined => command.type =export class SuperTabStore {readonly native: SuperTabNativeStorereadonly workspaces: SwarmWorkspaces- /** The private avatar bucket, whose links member reads sign (read/service.ts); null when avatar uploads are off. */+ /** Where avatars are kept, whose links member reads carry (read/service.ts); null when avatar uploads are off. */get avatars(): AvatarStore | null { return this.attachments?.avatars ?? null }+ /** The folder avatar keys start with (attachments.ts `avatarPrefix`). */+ get avatarPrefix(): string { return trimPrefix(this.attachments?.avatarPrefix ?? this.attachments?.prefix ?? '') }constructor(readonly db: PrismaClient, readonly now: () => number = Date.now,private readonly attachments: Attachments | null = null, private readonly hooks: SuperTabStoreHooks = {}) {this.polls = hooks.polls ?? localPollMemory(now)@@ -1268,7 +1270,7 @@ export class SuperTabStore {/** A picture for a person's or an agent's avatar (profile.ts): png, jpg or webp by its real bytes, at most 1 MB. Any* member who may write uploads one; the command that sets it decides whose it becomes. */async uploadAvatar(user: AuthUser, tabId: string, file: { body: Readable }, asAgentId?: string) {- // Member-only: never the public attachments bucket. Until a private one is configured, uploads stay off (presets work).+ // Off until a bucket for avatars is configured (attachmentsFromEnv); presets still work.const avatars = this.attachments?.avatars ?? fail('AVATARS_UNAVAILABLE', 'Uploading pictures is not set up on this server yet. Pick one of the pictures instead.', 503)const key = await this.uploader(tabId, async tx => {const { state } = await this.load(tx, user, tabId, {})@@ -1276,12 +1278,12 @@ export class SuperTabStore {author(state, actor, true)return actor})- const row = await this.keep(avatars, this.attachments!.prefix, tabId, key, { name: 'avatar', conversationId: '', purpose: AVATAR_PURPOSE }, async () => {+ const row = await this.keep(avatars, this.avatarPrefix, tabId, key, { name: 'avatar', conversationId: '', purpose: AVATAR_PURPOSE }, async () => {const peeked = await peekType(file.body)if (!peeked.type || !AVATAR_TYPES.has(peeked.type)) fail('AVATAR_TYPE', 'Use a PNG, JPEG or WebP picture.', 415)return { mime: peeked.type, body: peeked.body }}, file.body, MAX_AVATAR_BYTES)- // No link: a picture is only reached through the signed links member reads carry (avatarLinks.ts).+ // No link: a picture is only reached through the links member reads carry (avatarLinks.ts).return { avatar: { id: row.id } }}diff --git a/desktop/lib/super_tabs/profile_model.dart b/desktop/lib/super_tabs/profile_model.dartindex fdb1a48d4..205bf888c 100644--- a/desktop/lib/super_tabs/profile_model.dart+++ b/desktop/lib/super_tabs/profile_model.dart@@ -3,6 +3,8 @@/// them; a value this build does not know reads as absent.library;+import 'attachment_upload.dart' show kSuperTabAttachmentHost;+/// What a member or agent shows instead of the default.sealed class SuperTabAvatarPicture {const SuperTabAvatarPicture();@@ -25,8 +27,10 @@ const kSuperTabAvatarHost = String.fromEnvironment(defaultValue: 'storage.googleapis.com',);-/// A picture someone uploaded, through the signed link a member read carries:-/// https on the avatar host only, never a public or outside address.+/// A picture someone uploaded, through the link a member read carries: https,+/// and only on the avatar host (a private bucket's signed link) or the chat+/// files' CDN (a server without an avatar bucket keeps pictures there, Ken+/// 2026-10-28). Never an outside address.class SuperTabUploadedAvatar extends SuperTabAvatarPicture {const SuperTabUploadedAvatar._(this.url);final Uri url;@@ -35,7 +39,8 @@ class SuperTabUploadedAvatar extends SuperTabAvatarPicture {final url = Uri.tryParse(value);return url != null &&url.scheme == 'https' &&- url.host == kSuperTabAvatarHost+ (url.host == kSuperTabAvatarHost ||+ url.host == kSuperTabAttachmentHost)? SuperTabUploadedAvatar._(url): null;}diff --git a/desktop/test/super_tab_profile_model_test.dart b/desktop/test/super_tab_profile_model_test.dartindex d5899eaec..cbf739981 100644--- a/desktop/test/super_tab_profile_model_test.dart+++ b/desktop/test/super_tab_profile_model_test.dart@@ -55,12 +55,19 @@ void main() {read({'kind': 'upload', 'url': 'https://elsewhere.example/a.png'}),isNull,);- // Avatars are never public: not even the chat files' own CDN.+ // A server without an avatar bucket keeps them with the chat files and+ // links them on the chat files' CDN (Ken, 2026-10-28): that host too.expect(- read({- 'kind': 'upload',- 'url': 'https://cdn.harness.autonomous.ai/a.png',- }),+ (read({+ 'kind': 'upload',+ 'url': 'https://cdn.harness.autonomous.ai/avatars/t/a/avatar',+ })!+ as SuperTabUploadedAvatar)+ .url,+ Uri.parse('https://cdn.harness.autonomous.ai/avatars/t/a/avatar'),+ );+ expect(+ read({'kind': 'upload', 'url': 'http://cdn.harness.autonomous.ai/a'}),isNull,);// An upload whose signed link has not come yet shows the default face.diff --git a/docs/swarms.md b/docs/swarms.mdindex 3da6299e8..2c178d2ae 100644--- a/docs/swarms.md+++ b/docs/swarms.md@@ -270,13 +270,27 @@ after four hours or at the end of the day. It shows next to their name and asa small emoji on their avatar, and disappears at its time even on a page wherenothing else changes.-Avatars and status reach only the Swarm's members. Uploaded pictures are kept-in a private bucket that nobody can read directly. Each member's read of the-Swarm carries signed links to the pictures it shows. A link stays the same for-half an hour, so pictures are not fetched on every poll, and stops opening-within an hour. A copied link expires, and someone removed from the Swarm gets-no new links. A server without the private bucket (`SUPER_TAB_AVATARS_BUCKET`)-refuses uploads; the eight pictures still work.+Avatars and status reach only the Swarm's members: only a member's read of+the Swarm carries the link to a picture. Where the link points depends on the+server:++- With a private avatar bucket (`SUPER_TAB_AVATARS_BUCKET`), nobody can read a+ picture directly. Each read carries signed links. A link stays the same for+ half an hour, so pictures are not fetched on every poll, and stops opening+ within an hour. A copied link expires, and someone removed from the Swarm+ gets no new links.+- Without one (production today, by the owner's choice on 2026-10-28),+ pictures are kept in the chat files' bucket, in a folder of their own+ (`avatars/`), and linked on the same public CDN. **They work like chat files:+ a picture's link never expires.** Anyone who once had it, including someone+ later removed from the Swarm or anyone they pass it to, can still open that+ picture. Only the 128 random bits in its address keep it from being guessed.+ A new picture gets a new address; the old one stays reachable. Chat files+ never go in the avatar folder, and the server makes avatar links for that+ folder alone.++A server with no attachments bucket refuses uploads; the eight pictures still+work.People and agents react to a message with a small set: 👍 🎉 ❤️ 😄 👀 🚀.Counts show under the message, with the reader's own highlighted and the names