Skip to content

[CHA-6998] fix(api): a device can't name the user the agent joins and writes Chat as - #2393

Merged
Loschcode merged 4 commits into
mainfrom
fix/cha-6998-device-user-id
Nov 24, 2026
Merged

Loschcode merged 4 commits into
mainfrom
fix/cha-6998-device-user-id

Conversation

@Loschcode

@Loschcode Loschcode commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Why

POST /v1/agents/sessions and the /v1/agents/socket start frame are client-accessible. Both copied a device's user_id, user_name and agent_id into the session spec (specOf), and refuseServerSideFields didn't check any of them. The router then acts as that identity with its own server credentials:

  • user_id: a Stream user token is minted for it, the agent joins the call as it, and the voice transcript is written as it (cmd/router/sessions.go:38,47,75).
  • agent_id: on a kept conversation, the Chat user is created if missing, it becomes the channel's created_by and a member, and every agent message is sent as it (internal/conversation/conversation.go:768-775, sendWith at :2354).
  • user_name: stored as the name of the Chat user the agent writes as.

So a user's or guest's device could make the agent write Chat messages as any other user of the app, with content the device steers.

Changes

  • refuseSessionRequest calls a new refuseDeviceAgentIdentity. createSession and the socket's start frame both go through it, so they answer the same. For a caller that isn't server-side:
    • agent_id: refused (403) for any non-empty value.
    • user_id: refused unless it is the default vision-agent, or the caller's own user id on a verified (signed-in or guest) caller. An anonymous caller's id is a claim nobody checked, so it gets only the default, as memory.user_id already does.
    • user_name: refused unless it is the default Vision Agent.
  • A backend sends all three as before.
  • The defaults stay allowed because generated clients fill them in. The Swift CreateSessionRequest init defaults userId: "vision-agent" and userName: "Vision Agent".
  • session.DefaultUserID / DefaultUserName export the existing defaults so the check uses the same values.
  • The indirect route through id. A voice session with no agent id is keyed under its call id (Normalize, KeyedAgentID), and that call id is the session id, which a device may choose. So {"id": "bob", "start_voice": true} from a device produced agent id bob, the same impersonation as sending agent_id. keyDeviceAgent now gives a device's voice session, on createSession and on the socket, an agent id nobody chose (session.NewAgentID). Text sessions already got a fresh one. A session that carries on a conversation keeps that conversation's agent id, because opening it refuses any other (conversation.go:982).
  • The thread-channel tests (thread_access_test.go) relied on devices naming an agent_id. They now check that a device naming a thread channel's agent id is refused exactly as one naming an unknown agent id. The invariant they protect still holds: nothing a device is told reveals that a thread exists. Two MessageHooksSuite tests drop the device's agent_id, or expect the refusal.
  • SessionToolsSuite.TestAHostedCallInASessionOpenedWithAUsersTokenIsForThem used a device agent_id to reach a worker's hosted tool. It now opens by config, and the worker hosts under the config's name (hostedTools checks AgentID, then AgentName).

Validation

  • Unit (session_identity_unit_test.go): another user's id (user, guest, anonymous), an anonymous caller's own claimed id, any agent_id, and a non-default user_name are refused. All four tests failed on main. The defaults, a signed-in device's own id, and a backend naming anything are let through.
  • Integration (SocketSessionSuite.TestADeviceMayNotHandTheSocketAnotherAgentIdentity): user, guest and anonymous callers are refused by both createSession and the socket, with the same message, code and type. All 9 cases failed on main.
  • Integration (SocketSessionSuite.TestADevicesVoiceSessionIsNotKeyedUnderTheIdItChose): a device's voice session, through the socket and through createSession with start_voice, does not get its chosen id as agent id, while a backend's does. Removing either keyDeviceAgent call makes it fail. Unit tests cover the text and resumed cases.
  • The full internal/api integration package (-tags integration -p 1) ran locally on a private Postgres and Redis. Its one failure, the hosted-call test above, is reworked here and passes. On main, SlackChannelSuite and MessageHooksSuite pass too. Unit tests for internal/api and internal/session pass.
  • Local note: my local -tags integration build of internal/api failed in limits_test.go (Requests.Insert). test(api): insert limits test requests with insertRequest #2388 fixes that. I applied it locally only, and it is not part of this PR. CI's integration (api) job is green on this branch.

Ticket

  • CHA-6998 (Security · Chat API authorization & visibility audit)
  • Same finding as AI-3586 (Audit Scan 23 November)

Notes for review

🤖 Generated with Claude Code

Laurent Schaffner and others added 3 commits November 24, 2026 18:05
…t as

createSession and the socket's start frame copied a device's user_id, user_name and
agent_id into the session spec. The router then minted a token for that user id, joined
the call as it, and created the conversation channel and wrote the agent's messages as
agent_id, with its own server credentials. A user's device could make the agent write as
any other user of the app.

refuseSessionRequest now refuses, from an end user's device:
- agent_id, any value;
- user_id, unless it is the default (vision-agent) or the caller's own verified user id;
- user_name, unless it is the default (Vision Agent).
A backend sends them as before. The defaults stay allowed because generated clients
(Swift) fill them in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ig, not an agent id

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A voice session that names no agent id is keyed under its call id, which is its session id.
A device may choose that id, so a device naming another user's id as the session id got the
agent's conversation created by, and written as, that user: the same impersonation as
naming agent_id. createSession and the socket now give a device's voice session an agent id
nobody chose. Text sessions already get a fresh one, and a session carrying on a conversation
keeps that conversation's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Loschcode added a commit that referenced this pull request Nov 24, 2026
…est names one (#2395)

## Why
Stream reserves user ids that start with `!`, for anonymous users among
others. The router acts as the user ids it is handed, with the app's own
credentials:
- it signs call and chat tokens for them;
- it adds them to channels;
- it links numbers and guests to them;
- it joins calls and writes Chat as a session's `user_id` / `agent_id`.

`checkUserID` already refused `!`, because its pattern doesn't admit it,
but only for policies and limits. Every other place took any id. Chat
refuses storing a reserved id on its own writes (GetStream/chat#21135).
That guard does not cover the token the router signs locally
(`streamapp/mint.go`, `streamedge`) or the call it joins.

## Changes
`refuseReservedUserID` (`user_policies.go`) answers 400 for an id that
starts with `!`, after trimming spaces. It is called where a request
names a user id that reaches Stream or is stored against one:

| Where | Fields |
|---|---|
| `POST /v1/agents/calls/{id}/token` | `user_id` |
| `POST /v1/agents/chat-token` | `user_id`, `agent_id` |
| `POST /v1/agents/channels/links` | `user_id` |
| `POST /v1/agents/guests/claim` | `user_id` |
| `PUT /v1/agents/users/{user_id}` when linking a number | path
`user_id` |
| `createSession` and the socket start frame, via `refuseSessionRequest`
| `user_id`, `agent_id`, `memory.user_id` |

`/v1/policies/users/{user_id}` and limits already used `checkUserID`.

`GET /v1/agents/users/{user_id}`, unlinking (`PUT` with `phone: null`),
and the `DELETE .../memories` / `.../connections` paths are left open on
purpose. They don't write anything new, and anything already kept under
such an id must stay readable and erasable.

## Validation
- Unit (`reserved_user_id_unit_test.go`): the prefix is refused,
including after leading spaces. Ordinary ids, including a `!` inside an
id, and empty ids pass. A backend's session naming a reserved `user_id`,
`agent_id` or `memory.user_id` is refused, and ordinary ones are not.
- Integration: unlinking a reserved id's number still answers 200. Plus
one test per endpoint above, in `CallsSuite`, `ChannelsSuite`,
`GuestsSuite` and `UserPhonesSuite`. Each failed with the check disabled
and passes with it. Those suites, plus `SocketSessionSuite`,
`SessionToolsSuite` and the session-owner tests, pass locally.
- Merged with #2393 (CHA-6998), the change merges cleanly, and `go vet`
plus the `internal/api` unit tests pass on the result.

## Ticket
[CHA-6986](https://linear.app/stream/issue/CHA-6986) (Security · Chat
API authorization & visibility audit)

## Notes for review
- Opened after #2393 (CHA-6998) as a separate PR. The two touch
different hunks of `session_create.go`, and either can land first.
- Prod use was checked on the ticket: zero `!`-prefixed values in router
and gateway logs in us-east4, europe-west4 and us-west1 since 13-11. So
nothing real should start getting 400s.
- The error message names the field, the same way the other input checks
do.
- **Out of scope, filed as CHA-7277:**
- the router's own check on the acting-for id (`X-Stream-User-Id` /
`?user_id=`), which CHA-6973 already refuses at the Chat proxy;
  - the `POST /v1/agents/guests` body `id`;
  - a backend `call.id` that becomes the agent id by default.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Laurent Schaffner <laurentschaffner@Laurents-MacBook-Pro-Stream.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ser-id

# Conflicts:
#	acceleration/internal/api/session_create.go
#	acceleration/internal/api/socketws_test.go
@Loschcode
Loschcode merged commit d1416c2 into main Nov 24, 2026
13 checks passed
@Loschcode
Loschcode deleted the fix/cha-6998-device-user-id branch November 24, 2026 19:05
Loschcode added a commit that referenced this pull request Nov 25, 2026
…vice session ids (behind switches) (#2460)

## Why
Two follow-ups from the reviews of #2395 (CHA-6986) and #2393
(CHA-6998).

**CHA-7277: reserved (`!`) user ids are still accepted in three
places.** Stream reserves user ids starting with `!`. #2395 refused them
in request bodies, but three places still take them:
- **The acting-for id.** A backend's `X-Stream-User-Id` or `?user_id=`
becomes `Caller.UserID`. The router stores it as the owner of sessions,
tasks and connections, and upserts it as a Chat user when a conversation
opens. The Chat proxy refuses such an id (CHA-6973), but the router has
no check of its own.
- **The `POST /v1/agents/guests` body `id`.**
- **A voice session's `call.id`.** When the session names no `agent_id`,
the call id becomes the agent id (`Spec.KeyedAgentID`), which gets past
#2395's `agent_id` check.

**CHA-7274: a device can probe for thread channels.** A device's session
`id` of the form `thread-<uuid>` answered 409 when a thread channel had
that id, and opened a session when none did. So the answer said whether
the thread exists, against the invariant `thread_access_test.go`
protects.

## Changes
- **`transitional` package (new).** `transitional.Switch` ships a
security change that a legitimate caller could feel, switched OFF.
Unset, it keeps the old behaviour exactly. The env var takes `true` for
every app, or a comma-separated list of app ids. Every request the
change applies to is counted in
`router_security_would_change_total{switch,app_id,outcome}` and logged,
whether the switch is on or off. It is the router's equivalent of chat's
`chat.security.*` Release flags (CHA-7311). The same file is in #2458
(CHA-7261), so whichever lands second merges cleanly.
- **CHA-7277**, behind `ROUTER_SECURITY_CHA7277_RESERVED_USER_IDS`
(`security.cha7277.reserved_user_ids`):
- `refuseReservedActingFor` answers 400 to a backend acting for a
reserved id on these writes: session create, the socket start frame
(both via `refuseSessionRequest`), fork, resume, run, scheduled-task
create and connection create. Reads and deletes stay open, so what is
already kept under such an id stays readable and erasable.
  - A `call.id` that would become the agent id is refused the same way.
- **CHA-7277, guest `id`, no switch.** A reserved `id` on `POST
/v1/agents/guests` is taken as naming no guest, and a new guest is
minted. No guest ever has such an id, so nobody is refused anything new.
- **CHA-7274**, behind
`ROUTER_SECURITY_CHA7274_DEVICE_THREAD_SESSION_IDS`
(`session.ThreadSessionIDsSwitch`). In `Manager.Create`, when an end
user's device names a session id shaped like a thread channel's
(`thread-` plus a UUID, case-folded), the id is answered as taken. The
answer is the same for an existing thread and an unknown one, on REST
and on the socket. Other `thread-…` ids still open. The backend is
unchanged.

## Validation
Every new test with the switch on fails on main and passes here:
- **Unit:** `TestABackendActingForAReservedUserIdOpensNoSession` and
`TestABackendsCallIdThatWouldBecomeAReservedAgentIdIsRefused`.
`TestWithTheSwitchOff…IsLetThrough` checks the old answer is kept.
- **`ReservedActingForSuite`:** create, fork, resume, scheduled task and
connection are refused. Listing still works. An app the switch isn't on
for is let through.
- **`GuestsSuite`:** `TestAReservedIDIsTakenAsNamingNoGuest`.
- **`SlackChannelSuite`:** a device's session id on an existing thread
versus an unknown `thread-<uuid>` gets the same reply, on create
(including upper case) and on the socket. A `thread-` id that isn't a
UUID still opens. With the switch off, an unknown thread id opens as
before. A backend's unknown thread id opens.
- **`transitional`:** off by default, on via env, on for listed apps,
and forced on for a test's app.
- Also run locally: `ConnectionsSuite` and `ScheduledTasksSuite`.

## Ticket
[CHA-7277](https://linear.app/stream/issue/CHA-7277),
[CHA-7274](https://linear.app/stream/issue/CHA-7274) (Security · Chat
API authorization & visibility audit)

## Notes for review
- **Prod traffic** in router logs (GCP, every acceleration cluster, last
30 days): zero requests with `user_id=!…`, and zero requests on a
`/v1/agents/sessions/thread-…` path. Bodies aren't logged, so the guest
`id`, `call.id` and the session id on create can't be counted directly.
The switch's counter covers that.
- **Kept out of scope:**
- `recordUser` / `recordEmail` still record a users row for a reserved
acting-for id on reads. Filed as CHA-7323.
- `threadConversation`'s device branches, on the agent-id route, are
left as defence in depth.
- **Fable review fixes (second round).**
- The thread switch counts a device's thread-shaped id only when no
thread has it, since that is the only case where the answer changes.
- `endUserKind` leaves out a backend acting for a user
(`Caller.ServerSide`).
- The acting-for check on tasks and connections runs after the customer
is known, so the counter never gets an empty `app_id`.
- A reserved guest `id` from the backend now gets a new guest (200)
instead of the old 400 "not a guest of this app". No guest can have such
an id.
- **Overlap with #2366.** It touches `session_create.go` and
`sessions.go` too, but different hunks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Laurent Schaffner <laurentschaffner@Laurents-MacBook-Pro-Stream.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
kanat added a commit that referenced this pull request Nov 26, 2026
## Why

Since #2393 the router refuses `agent_id`, a non-default `user_id` and a
non-default `user_name` from an end user's device
(`refuseDeviceAgentIdentity`,
`acceleration/internal/api/session_create.go:230`). That refusal stays.
But a browser chat widget whose every visitor should talk to one named
agent used those fields: now each visitor's conversation gets a fresh
router-made agent id, a nameless Chat user, and an operator who reads
history with the agent's known `agent_id` gets nothing for new
conversations.

The owner of the agent now sets its identity once, on the server, in the
agent config. A device only names the config with `agent`, as it does
today. This is where ElevenLabs, Vapi and Retell keep a bot's persona
too.

## How it works

```
POST /v1/agents/sessions  or  /v1/agents/socket start frame
  {"agent": "support"}            (device: guest, user or anonymous)
        │
        ├─ refuseDeviceAgentIdentity          unchanged: agent_id / other user_id /
        │                                     other user_name from a device -> 403
        ├─ configFor -> store.AgentConfig{Identity}
        └─ specOf -> identifyAs(spec, config.Identity)
              ├─ user_id    request's, unless empty or "vision-agent" -> config's
              ├─ user_name  request's, unless empty or "Vision Agent" -> config's
              └─ agent_id   request's, unless empty -> config's, only for a
                            session that keeps its conversation: never with a
                            conversation_id (the conversation keeps the agent id
                            it was kept under), never for an incognito session
                            (it gets an agent id of its own)

POST /v1/agents/sessions/{id}/resume (a stopped session, from its row)
POST /v1/agents/sessions/{id}/fork   (live or stored parent; or naming a config)
        └─ FromConfig -> actAs(spec, config.Identity)
              ├─ user_id / user_name  the config's, as above
              └─ agent_id             resume: the conversation's; fork: its own

new conversation of a session given the config's agent_id
        └─ CreateMissingUsers(agent_id: {name: identity.user_name})
              the text agent's Chat user gets the configured name
              (only when the config sets user_name and Chat has no such user)
```

Config writes, all server-side only (no `x-client-accessible`,
`PostureSuite`):

| Write | `identity` left out | `identity: {}` | `identity: {...}` |
| --- | --- | --- | --- |
| `POST /v1/agents/configs` | none | none | stored |
| `PUT /v1/agents/configs/{id}` | kept (a client that does not know it
keeps it) | removed | replaced whole |
| `PATCH /v1/agents/configs/{id}` | kept | removed | replaced whole |
| `POST /v1/agents/sync` | kept (sync starts from the stored row) | n/a
| n/a |

Id rules at write (`identityComplaint`, 400 `invalid_request` naming the
field), the rules a session open enforces:

| Field | Rule | Where a session enforces it |
| --- | --- | --- |
| `identity.agent_id` | no `!` prefix | `refuseReservedUserID`
(`session_create.go:287`); session open checks nothing more |
| `identity.user_id` | no `!` prefix; `^[A-Za-z0-9_.-]{1,128}$` |
`refuseReservedUserID`; `conversation.ValidAuthor` (open refuses others
with "invalid voice transcript author") |
| `identity.user_name` | none | none |

Why "the default counts as naming none": Huma fills in the schema
defaults (`default:"vision-agent"`, `default:"Vision Agent"`,
`schemas.go:299-300`) for a body that leaves them out (`setDefaults`,
huma v2.39.1 `huma.go:2151`), and generated clients send them too.
Without this rule the config's user would never apply over HTTP.

Resume from the row and fork take the config's `user_id`/`user_name`
(`actAs`). Unchanged: message hooks, campaigns, scheduled tasks, child
agents and every other `session.FromConfig` caller; they do not go
through `specOf`.

## First check: many guests share one agent id

Before the feature: tests only (commit 1), green on the base `aa4c2d4d9`
as well.

| What guest A tries on guest B's session of the same agent id | Answer
| Guard |
| --- | --- | --- |
| `GET /v1/agents/sessions/{B}` | 404 | `Owner.Reaches` +
`canReadSession` |
| events socket of B | 404 | same |
| `POST .../{B}/responses` | 404 | same |
| `GET /v1/agents/conversations/{B's cid}/messages` | 403 (server-side
op); 400 "another user" via its backend | `ownedBy`
(`conversation.go:1055`) |
| reopen B's `conversation_id` | 400 "another user" | `ownedBy` |

Routing: a hook finds a session by the agent id its channel is named
after (`ByAgentWhere`). A guest's conversation channel is
`agent:<session id>`, stamped `support_trigger: session_commands`, which
no hook answers, and a session that keeps its conversation takes no hook
message. So the config's agent id goes only to sessions that keep their
conversation: an incognito session keeps none, would take any Chat
user's message in `agent:<agent id>`, and gets an agent id of its own
instead. The episode-card retire branch acts only on a session whose
transcript goes into the channel the message was written in
(`TranscriptChannel()`): that is every session a worker opened there, as
on main. Main also closed a session found by that id whose transcript
goes elsewhere; no such session is reachable by a device (its agent id
is router-made, and a device cannot name a call: 403 "call is sent
server-side"), and none is retired now. A guest's session of an
identified config keeps its conversation in `agent:<its session id>`, so
a message in `agent:<shared agent id>` closes none of them. A message in
A's channel, or in a channel named after the shared agent id, reaches no
session; A's turns reach only A's session, by its id.

## Known limits

- Per-call stats: usage and turn attribution in operator call detail is
read by agent id and a time window (`calls.go:118`, `:729`, `:733`,
`:1057`). Concurrent guests under one agent id blur each other's turns
there. Not fixed here (server-side read only, not a guest read):
AI-3943.

## Changes

- `store.AgentConfig.Identity` (`identity_agent_id`, `identity_user_id`,
`identity_user_name`), migration
`20270301007100_agent_config_identity.sql` (expand-only, `NOT NULL
DEFAULT ''`), `configColumns`, `schema/global.sql`.
- API: `AgentIdentity` on `AgentConfigRequest`, `AgentConfigPatch` and
`AgentConfig`; `identityComplaint` (with `conversation.ValidAuthor`);
PUT keeps it when omitted.
- `identifyAs` in `specOf` (`sessions.go`), the one place both create
callers go through; `actAs` in `reopenedFromRow` and both fork branches.
- `Spec.AgentIDName` + `conversation.WithAgentName`: the agent id's Chat
user is made with the identity's `user_name`.
- Message hook retire branch (`messagehooks.go`): only a session whose
transcript goes into the channel written in is retired. With no identity
set, every session a worker opened on the channel is retired as on main;
a session found by agent id whose transcript goes into another channel
(a guest's session of an identified config, or a router-made id nobody
writes to) is spared. No test builds a non-worker session that keeps its
conversation in the written channel (a device cannot), so that case is
argued from the code, not run.
- `Manager.ByAgent` doc: several sessions may share an agent id.
- `CHANGELOG.md` Breaking Changes: the Rust SDK's `get_agent_log` takes
a query (base spec drift the regen picks up).
- `openapi.yaml` and every client regenerated: Go, Python, JS, .NET,
Ruby, Rust, PHP, Kotlin, Dart. Swift's generator is not in this repo;
`generate.py --check` is stale on the base already. The Kotlin, Dart,
Ruby, Rust and PHP regen also picks up base drift from earlier spec
changes (`region` fields and query params, the `shards` doc): Rust's
`get_agent_log` now takes its query, as the spec says.
- SDK note:
`.claude/skills/sdk/notes/2026-11-25-ai-3900-agent-identity.md`.

## Validation

| Test | Catches |
| --- | --- |
| `SessionOwnershipSuite/TestGuestsOfOneAgentIdReachNothingOfEachOthers`
| a guest reaching another guest's session, socket, turns, messages or
conversation under a shared agent id |
|
`AppHooksSuite/TestAGuestsMessageReachesOnlyItsOwnSessionOfASharedAgentId`
| a Chat message routed by agent id to the newest guest's session |
|
`SessionOwnershipSuite/TestADevicesSessionNamingTheConfigIsTheAgentItNames`
| guest, user and anonymous, text and voice, not written as the config's
agent |
|
`SessionOwnershipSuite/TestGuestsOfAConfigsAgentReachNothingOfEachOthers`
| the same isolation for two guests through the config |
|
`SessionOwnershipSuite/TestADeviceNamingTheAgentsIdentityIsRefusedWhenTheConfigSetsOne`
| the #2393 refusal loosened when a config has an identity |
|
`SessionOwnershipSuite/TestWhatASessionRequestNamesWinsOverTheConfigsIdentity`
| the config overriding a backend's own identity or a device's own user
id; the sent defaults not counting as none |
|
`SessionOwnershipSuite/TestAConversationBegunBeforeTheConfigNamedItsAgentCarriesOnAsItWas`
| a `conversation_id` resume refused after the config got an agent id |
|
`SessionOwnershipSuite/TestAConfigNamingNoAgentLeavesTheAgentToTheRouter`
| control: passes unchanged on the base `aa4c2d4d9` |
|
`SocketSessionSuite/TestASocketSessionNamingTheConfigIsTheAgentItNames`
| the socket start frame not using the config's identity |
|
`ConfigsSuite/TestAConfigKeepsItsAgentIdentityUntilAWriteNamesAnother`,
`...MadeWithout...`, `TestASyncKeepsTheAgentIdentityTheConfigHolds` |
PUT/PATCH/sync dropping or not replacing it |
| `ConfigsSuite/TestAnAgentIdentityNamingAnIdStreamKeepsIsRefused`,
`...FieldNobodyKnowsIsRefused`,
`TestAnEndUsersDeviceMayNotSetAnAgentIdentity` | a reserved id stored,
an unknown key ignored, a device writing it |
|
`AppHooksSuite/TestAnotherUsersMessageReachesNoGuestsIncognitoSessionOfAConfigsAgent`,
`...IsNeverAnsweredInAGuestsIncognitoSession` | an incognito session
under the shared agent id taking, and answering, another Chat user's
message |
|
`ChatEpisodesSuite/TestAMessageInAConfigsAgentChannelRetiresNoDeviceSessionKeepingItsConversation`
| a message in `agent:<agent id>` closing a device session that holds a
person's cards |
|
`SessionOwnershipSuite/TestASessionCarriedOnOrForkedWritesAsTheConfigsUser`,
`TestAForkNamingAConfigWritesAsItsUser` | resume and fork (live, stored,
naming a config) writing as `vision-agent` |
| `SessionOwnershipSuite/TestTheConfigsAgentIdWritesUnderItsUserName` |
the agent id's Chat user made with no name; a name given without
`user_name` or to a fork's agent id |
| `ConfigsSuite/TestAnAgentIdentityUserNoSessionOpensAsIsRefused` | a
`user_id` stored that every session open then refuses |
| unit `TestASessionTakesTheConfigsIdentityWhereTheRequestNamedNone`,
`TestAConfigsIdentityFieldLeftEmptyNamesNothing` | each branch of
`identifyAs`, incognito included |

Control from the base:
`TestAConfigNamingNoAgentLeavesTheAgentToTheRouter` and both first-check
tests were run on a worktree at `aa4c2d4d9` and pass there unchanged.

Mutations, one script applying, testing and restoring each: 30 of 31
killed. Every new guard in `identifyAs`, `identityComplaint` (each
field, the call, the nil case), `identityOf`, the PUT keep, the PATCH
replace, the response render, the closed schema, `configColumns`, the
`specOf` call, and the two #2393 refusals with an identity set; for the
first check, `ownedBy`'s owner test, `Owner.Reaches` with
`canReadSession`, and the hook guards. Survivor: `identity.AgentID !=
""` in `identifyAs`, an equivalent mutant (it writes an empty agent id
over an empty one).

## Decisions

- A session request that sends `user_id: "vision-agent"` or `user_name:
"Vision Agent"` gets the config's identity: the default counts as naming
none, because Huma and generated clients fill it in.
- Resume and fork take the config's `user_id`/`user_name`; the agent id
stays the conversation's (resume) or the fork's own.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant