Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
perf(agent-session): deliver a new session's first prompt with its create (#7755)
Wolf Mermelstein391674ac5316
diff --git a/apps/web/src/features/block-agent/context/pending-session.test.tsx b/apps/web/src/features/block-agent/context/pending-session.test.tsxindex 1ce99366fc..c5461602f4 100644--- a/apps/web/src/features/block-agent/context/pending-session.test.tsx+++ b/apps/web/src/features/block-agent/context/pending-session.test.tsx@@ -15,6 +15,7 @@ const fold = vi.hoisted(() => ({readSession: vi.fn(),closeSession: vi.fn(),}));+const flags = vi.hoisted(() => ({ firstPromptOnCreate: true }));const harness = vi.hoisted(() => ({create: vi.fn(),get: vi.fn(),@@ -22,6 +23,17 @@ const harness = vi.hoisted(() => ({}));vi.mock('@core/agent-fold/client', () => fold);+vi.mock('@core/constant/featureFlags', async (importOriginal) => {+ const actual =+ await importOriginal<typeof import('@core/constant/featureFlags')>();+ return {+ ...actual,+ isFeatureEnabled: (flag: Parameters<typeof actual.isFeatureEnabled>[0]) =>+ flag === actual.enableFirstPromptOnCreate+ ? flags.firstPromptOnCreate+ : actual.isFeatureEnabled(flag),+ };+});vi.mock('@service-agent-harness/client', () => ({agentHarnessServiceClient: harness,}));@@ -99,6 +111,7 @@ const snapshots = () =>beforeEach(() => {vi.useFakeTimers();vi.clearAllMocks();+ flags.firstPromptOnCreate = true;fold.pushSession.mockResolvedValue([]);fold.readSession.mockResolvedValue({messages: [],@@ -125,8 +138,10 @@ afterEach(() => {});describe('pending navigation ownership', () => {+ // A persona delivers its first prompt with a control POST once the session+ // exists; these cover who owns the fold while that POST is out.it('keeps one fold and the prompt trace when the POST finishes before mount', async () => {- const id = startPendingSession({ prompt: 'Hello' });+ const id = startPendingSession({ botId: 'persona', prompt: 'Hello' });await settle();const beforeMount = AgentSession.get(id);const trace = promptTrace();@@ -205,7 +220,7 @@ describe('pending navigation ownership', () => {const delivery = deferred<ReturnType<typeof accepted>>();harness.create.mockReturnValue(creation.promise);harness.control.mockReturnValue(delivery.promise);- const id = startPendingSession({ prompt: 'Hello' });+ const id = startPendingSession({ botId: 'persona', prompt: 'Hello' });const destination = mount(id);creation.resolve(created(id));await settle();@@ -229,7 +244,7 @@ describe('pending navigation ownership', () => {it('retains the POST owner when the destination unmounts during delivery', async () => {const delivery = deferred<ReturnType<typeof accepted>>();harness.control.mockReturnValue(delivery.promise);- const id = startPendingSession({ prompt: 'Hello' });+ const id = startPendingSession({ botId: 'persona', prompt: 'Hello' });await settle();const destination = mount(id);await settle();@@ -244,7 +259,7 @@ describe('pending navigation ownership', () => {});it('expires a ready session whose navigation never mounts', async () => {- const id = startPendingSession({ prompt: 'Hello' });+ const id = startPendingSession({ botId: 'persona', prompt: 'Hello' });await settle();expect(AgentSession.get(id)).toBeDefined();await vi.advanceTimersByTimeAsync(5 * 60_000);@@ -257,7 +272,7 @@ describe('pending navigation ownership', () => {it('bounds an abandoned create and does not retain a late result', async () => {const creation = deferred<ReturnType<typeof created>>();harness.create.mockReturnValue(creation.promise);- const id = startPendingSession({ prompt: 'Hello' });+ const id = startPendingSession({ botId: 'persona', prompt: 'Hello' });await vi.advanceTimersByTimeAsync(5 * 60_000);expect(pendingSession(id)).toBeUndefined();creation.resolve(created(id));@@ -270,7 +285,7 @@ describe('pending navigation ownership', () => {it('still delivers a slow create to its mounted destination after registry expiry', async () => {const creation = deferred<ReturnType<typeof created>>();harness.create.mockReturnValue(creation.promise);- const id = startPendingSession({ prompt: 'Hello' });+ const id = startPendingSession({ botId: 'persona', prompt: 'Hello' });const destination = mount(id);await vi.advanceTimersByTimeAsync(5 * 60_000);expect(pendingSession(id)).toBeUndefined();@@ -287,7 +302,7 @@ describe('pending navigation ownership', () => {harness.control.mockResolvedValue(err([{ code: 'HTTP_ERROR', message: 'Runtime is disconnected.' }]));- const id = startPendingSession({ prompt: 'Hello' });+ const id = startPendingSession({ botId: 'persona', prompt: 'Hello' });await settle();expect(pendingSession(id)?.error()).toBe('Runtime is disconnected.');expect(AgentSession.get(id)).toBeUndefined();@@ -302,7 +317,7 @@ describe('pending navigation ownership', () => {harness.create.mockResolvedValue(err([{ code: 'HTTP_ERROR', message: 'Could not create session.' }]));- const id = startPendingSession({ prompt: 'Hello' });+ const id = startPendingSession({ botId: 'persona', prompt: 'Hello' });await settle();const destination = mount(id);expect(pendingSession(id)?.error()).toBe('Could not create session.');@@ -318,7 +333,12 @@ it('retains submitting context until the first prompt is accepted', async () =>harness.control.mockReturnValue(delivery.promise);const onDelivered = vi.fn();const onFailure = vi.fn();- startPendingSession({ prompt: 'Hello', onDelivered, onFailure });+ startPendingSession({+ botId: 'persona',+ prompt: 'Hello',+ onDelivered,+ onFailure,+ });await settle();expect(onDelivered).not.toHaveBeenCalled();delivery.resolve(accepted(harness.control.mock.calls[0][1]));@@ -358,3 +378,138 @@ it('restores submitting context when speed configuration fails', async () => {expect(onFailure).toHaveBeenCalledOnce();expect(harness.control).not.toHaveBeenCalled();});++describe('first prompt on the create', () => {+ it("sends the default persona's first prompt with the create and traces it from there", async () => {+ const id = startPendingSession({ prompt: 'Hello', userId: 'me' });+ await settle();++ const [request] = harness.create.mock.calls[0];+ expect(request).toEqual({+ id,+ prompt: 'Hello',+ promptActionId: expect.any(String),+ });+ const actionId: string = request.promptActionId;+ expect(harness.control).not.toHaveBeenCalled();+ expect(issue).not.toHaveBeenCalled();++ const destination = mount(id);+ await settle();+ expect(+ fold.pushSession.mock.calls+ .flatMap((call) => call[1] as FoldInput[])+ .filter((input) => input.kind === 'speculated')+ ).toEqual([+ {+ kind: 'speculated',+ actionId,+ action: { type: 'prompt', prompt: 'Hello' },+ userId: 'me',+ },+ ]);+ const acceptedAt = stage.mock.calls.findIndex(+ ([name]) => name === 'accepted'+ );+ expect(acceptedAt).toBeGreaterThanOrEqual(0);+ const trace = stage.mock.contexts[acceptedAt];+ expect(trace).toBeInstanceOf(PromptTrace);++ fold.pushSession.mockResolvedValueOnce([+ {+ kind: 'update',+ message: {+ agentSessionId: id,+ turn: 1,+ author: { kind: 'user', userId: 'me' },+ requestId: actionId,+ parts: [{ kind: 'text', text: 'Hello' }],+ stop: null,+ pending: false,+ segments: [],+ phase: null,+ postedAt: null,+ },+ },+ {+ kind: 'new',+ message: {+ agentSessionId: id,+ turn: 1,+ author: { kind: 'agent' },+ requestId: null,+ parts: [{ kind: 'text', text: 'Ready' }],+ stop: null,+ pending: false,+ segments: [],+ phase: null,+ postedAt: null,+ },+ },+ ] satisfies FoldedStreamEvent[]);+ AgentSession.ingest({+ agentSessionId: id,+ entries: [+ {+ id: 'confirmed-row',+ createdAt: new Date().toISOString(),+ direction: 'to_server',+ content: { type: 'acp', jsonrpc: '2.0' },+ } satisfies AgentSessionLogEntryDto,+ ],+ });+ await settle();+ const firstText = stage.mock.calls.findIndex(+ ([name]) => name === 'first_text'+ );+ expect(firstText).toBeGreaterThanOrEqual(0);+ expect(stage.mock.contexts[firstText]).toBe(trace);++ destination.unmount();+ expect(AgentSession.get(id)).toBeUndefined();+ expect(fold.closeSession).toHaveBeenCalledExactlyOnceWith(id);+ });++ it("keeps an effort's first prompt for after the session is configured", async () => {+ const id = startPendingSession({+ prompt: 'Hello',+ effortOverride: { configId: 'effort', value: 'high' },+ });+ await settle();++ expect(harness.create.mock.calls[0][0]).toEqual({ id });+ });++ it('sends the first prompt as a control POST while the rollout is off', async () => {+ flags.firstPromptOnCreate = false;+ const id = startPendingSession({ prompt: 'Hello' });+ await settle();++ expect(harness.create.mock.calls[0][0]).toEqual({ id });+ expect(harness.control).toHaveBeenCalledOnce();+ expect(harness.control.mock.calls[0][1]).toMatchObject({+ type: 'prompt',+ prompt: 'Hello',+ });+ });++ it("keeps a speed's first prompt for after the session is configured", async () => {+ const id = startPendingSession({+ prompt: 'Hello',+ speedOverride: { configId: 'speed', value: 'fast' },+ });+ await settle();++ expect(harness.create.mock.calls[0][0]).toEqual({ id });+ });++ it('releases submitting context once the create carrying the prompt answers', async () => {+ const onDelivered = vi.fn();+ const onFailure = vi.fn();+ startPendingSession({ prompt: 'Hello', onDelivered, onFailure });+ await settle();+ expect(onDelivered).toHaveBeenCalledOnce();+ expect(onFailure).not.toHaveBeenCalled();+ expect(harness.control).not.toHaveBeenCalled();+ });+});diff --git a/apps/web/src/features/block-agent/context/pending-session.ts b/apps/web/src/features/block-agent/context/pending-session.tsindex 279c8c2dda..b020a86360 100644--- a/apps/web/src/features/block-agent/context/pending-session.ts+++ b/apps/web/src/features/block-agent/context/pending-session.ts@@ -30,6 +30,10 @@ import {PromptTrace,} from '@core/agent-session/prompt-telemetry';import { markSessionCreated } from '@core/agent-session/recently-created';+import {+ enableFirstPromptOnCreate,+ isFeatureEnabled,+} from '@core/constant/featureFlags';import { fireAndForget } from '@core/util/fireAndForget';import {replenishWarmAgentSession,@@ -38,6 +42,7 @@ import {import { refetchSoupEntity } from '@queries/soup/normalized-cache';import { agentHarnessServiceClient } from '@service-agent-harness/client';import type {+ AgentAction,CreateAgentSessionRequest,PromptAttachment,} from '@service-agent-harness/generated/schemas';@@ -143,6 +148,27 @@ export function startPendingSession(},}): undefined;+ const firstPrompt: AgentAction | undefined = trace+ ? {+ type: 'prompt',+ prompt,+ ...(options.attachments?.length+ ? { attachments: options.attachments }+ : {}),+ }+ : undefined;+ // The default persona takes its first prompt on the create, so the agent+ // hears it one round trip sooner. An effort or speed must be applied before+ // the prompt, and another persona may run on its operator's machine, where+ // the create cannot deliver one: those send it once the session exists.+ const promptActionId =+ firstPrompt &&+ isFeatureEnabled(enableFirstPromptOnCreate) &&+ !options.botId &&+ !options.effortOverride &&+ !options.speedOverride+ ? uuidv7()+ : undefined;const [sessionId, setSessionId] = createSignal<string>();const [error, setError] = createSignal<string>();let navigation: AgentSession | undefined;@@ -183,6 +209,15 @@ export function startPendingSession(...(options.botId ? { botId: options.botId } : {}),...(options.modelOverride ? { model: options.modelOverride } : {}),...(options.instructions ? { instructions: options.instructions } : {}),+ ...(promptActionId+ ? {+ prompt,+ promptActionId,+ ...(options.attachments?.length+ ? { promptAttachments: options.attachments }+ : {}),+ }+ : {}),...(options.repoUrl? { repoUrl: options.repoUrl, repoBranch: options.repoBranch }: {}),@@ -234,12 +269,7 @@ export function startPendingSession(// an effort holds the block in preflight. Then adopt the session before// issuing the first prompt so that prompt is folded speculatively while// its POST is in flight.- if (- options.effortOverride ||- options.speedOverride ||- prompt ||- options.attachments?.length- ) {+ if (options.effortOverride || options.speedOverride || firstPrompt) {const session = AgentSession.acquire(created);try {if (options.effortOverride || options.speedOverride) {@@ -265,20 +295,19 @@ export function startPendingSession(// fast POST cannot destroy the fold before that view mounts.if (!disposed) navigation = AgentSession.acquire(created);setSessionId(created);- if (prompt || options.attachments?.length) {+ const userId = options.userId ?? result.value.session.ownerId;+ if (promptActionId && firstPrompt && trace) {+ trace.accepted(promptActionId, false);+ session.adoptPrompt(promptActionId, firstPrompt, {+ userId,+ trace,+ });+ options.onDelivered?.();+ } else if (firstPrompt) {const delivered = await issueSessionAction(session,- {- type: 'prompt',- prompt,- ...(options.attachments?.length- ? { attachments: options.attachments }- : {}),- },- {- userId: options.userId ?? result.value.session.ownerId,- trace,- }+ firstPrompt,+ { userId, trace });if (delivered.isErr()) {fail(diff --git a/apps/web/src/features/block-agent/context/resolve-session-id.test.ts b/apps/web/src/features/block-agent/context/resolve-session-id.test.tsindex 32d2a44118..7420e3eccb 100644--- a/apps/web/src/features/block-agent/context/resolve-session-id.test.ts+++ b/apps/web/src/features/block-agent/context/resolve-session-id.test.ts@@ -32,6 +32,8 @@ const create = vi.hoisted(() => ({confirm: undefined as ((error?: string) => void) | undefined,release: vi.fn(),attribution: vi.fn(),+ adopted: vi.fn(),+ requests: [] as unknown[],confirmedModel: undefined as string | undefined,configReported: true,notify: undefined as (() => void) | undefined,@@ -42,6 +44,7 @@ vi.mock('@service-agent-harness/client', () => ({create: vi.fn((request: { id: string }) =>new Promise((resolve) => {+ create.requests.push(request);create.resolve = (id: string = request.id) =>resolve({isErr: () => false,@@ -78,6 +81,7 @@ vi.mock('@core/agent-session/AgentSession', () => ({};return {load: async () => {},+ adoptPrompt: create.adopted,issue: async (action: AgentAction, options: unknown) => {create.attribution(options);const result = await create.control(id, action);@@ -340,7 +344,10 @@ describe('an id whose create is in flight', () => {deliver = resolve;}));- const placeholder = startPendingSession({ prompt: 'Hello' });+ const placeholder = startPendingSession({+ botId: 'persona',+ prompt: 'Hello',+ });await createRoot(async (dispose) => {const resolved = resolveSessionId(() => placeholder);expect(resolved.pendingPrompt()).toBe('Hello');@@ -451,7 +458,10 @@ describe('an id whose create is in flight', () => {isErr: () => true,error: [{ code: 'HTTP_ERROR', message: 'Runtime is disconnected.' }],});- const placeholder = startPendingSession({ prompt: 'Hello' });+ const placeholder = startPendingSession({+ botId: 'persona',+ prompt: 'Hello',+ });await createRoot(async (dispose) => {const resolved = resolveSessionId(() => placeholder);create.resolve?.();@@ -476,12 +486,10 @@ describe('an id whose create is in flight', () => {});it.each(['Describe this', ''])(- 'delivers first-prompt attachments with text %j',+ 'delivers first-prompt attachments with text %j on the create',async (prompt) => {- create.control.mockResolvedValue({- isErr: () => false,- value: { actionId: 'image-action', status: 'accepted' },- });+ create.requests.length = 0;+ create.adopted.mockClear();const attachments = [{uri: 'https://static.macro.com/file/image-id',@@ -492,29 +500,35 @@ it.each(['Describe this', ''])(const id = startPendingSession({ prompt, attachments });create.resolve?.();await flush();- expect(create.control).toHaveBeenCalledWith(id, {- type: 'prompt',- prompt,- attachments,- });+ expect(create.requests).toEqual([+ {+ id,+ prompt,+ promptActionId: expect.any(String),+ promptAttachments: attachments,+ },+ ]);+ expect(create.control).not.toHaveBeenCalled();+ expect(create.adopted).toHaveBeenCalledWith(+ (create.requests[0] as { promptActionId: string }).promptActionId,+ { type: 'prompt', prompt, attachments },+ { userId: 'session-owner', trace: expect.any(PromptTrace) }+ );});it.each([undefined, 'explicit-user'])('attributes the first prompt when userId is %s',async (userId) => {- create.attribution.mockClear();- create.control.mockResolvedValue({- isErr: () => false,- value: { actionId: 'prompt-id' },- });+ create.adopted.mockClear();startPendingSession({ prompt: 'Hello', userId });create.resolve?.();await flush();- expect(create.attribution).toHaveBeenCalledWith({- userId: userId ?? 'session-owner',- trace: expect.any(PromptTrace),- });+ expect(create.adopted).toHaveBeenCalledWith(+ expect.any(String),+ { type: 'prompt', prompt: 'Hello' },+ { userId: userId ?? 'session-owner', trace: expect.any(PromptTrace) }+ );});diff --git a/apps/web/src/lib/core/agent-session/AgentSession.ts b/apps/web/src/lib/core/agent-session/AgentSession.tsindex ced0ca213d..1751f9f271 100644--- a/apps/web/src/lib/core/agent-session/AgentSession.ts+++ b/apps/web/src/lib/core/agent-session/AgentSession.ts@@ -538,6 +538,26 @@ export class AgentSession {);}+ /**+ * Show a prompt another request already delivered - the create that opened+ * this session can carry its first one - and trace it to its first output.+ * Nothing is sent: the delivery named `actionId`, so the confirmed row+ * promotes this speculation in place, or, having landed first, makes it a+ * no-op.+ */+ adoptPrompt(+ actionId: string,+ action: AgentAction,+ options: { userId?: string; trace: PromptTrace }+ ): void {+ this.expect(actionId, action, { userId: options.userId });+ if (this.closed) {+ options.trace.end('released');+ return;+ }+ this.prompts.add(options.trace);+ }+/** Take back a speculation the log will not confirm. Unknown ids are a no-op. */retract(actionId: string): void {fireAndForget(diff --git a/apps/web/src/lib/core/constant/featureFlags.ts b/apps/web/src/lib/core/constant/featureFlags.tsindex d9c4823b66..cf9847c794 100644--- a/apps/web/src/lib/core/constant/featureFlags.ts+++ b/apps/web/src/lib/core/constant/featureFlags.ts@@ -188,6 +188,18 @@ export const enableTasksReviews = defineFlag({default: onInDev,});+/**+ * Sends a new session's first prompt on its create. A harness that predates+ * `promptActionId` and `promptAttachments` ignores them, duplicating the+ * prompt bubble and dropping its files, so deployed environments stay off+ * until that harness is live; local stacks build both together.+ */+export const enableFirstPromptOnCreate = defineFlag({+ key: 'enable-first-prompt-on-create',+ env: 'ENABLE_FIRST_PROMPT_ON_CREATE',+ default: LOCAL_ONLY || undefined,+});+/** Gantt is visible in local previews; deployed apps retain the remote rollout. */export const enableGantt = defineFlag({key: 'enable-gantt',diff --git a/apps/web/src/lib/service-clients/service-agent-harness/generated/schemas/createAgentSessionRequest.ts b/apps/web/src/lib/service-clients/service-agent-harness/generated/schemas/createAgentSessionRequest.tsindex 974cabf006..1a8d35f462 100644--- a/apps/web/src/lib/service-clients/service-agent-harness/generated/schemas/createAgentSessionRequest.ts+++ b/apps/web/src/lib/service-clients/service-agent-harness/generated/schemas/createAgentSessionRequest.ts@@ -10,10 +10,12 @@ import type { CreateAgentSessionRequestInstructions } from './createAgentSessionimport type { CreateAgentSessionRequestModel } from './createAgentSessionRequestModel';import type { CreateAgentSessionRequestOwner } from './createAgentSessionRequestOwner';import type { CreateAgentSessionRequestPrompt } from './createAgentSessionRequestPrompt';+import type { CreateAgentSessionRequestPromptActionId } from './createAgentSessionRequestPromptActionId';import type { CreateAgentSessionRequestRepoBranch } from './createAgentSessionRequestRepoBranch';import type { CreateAgentSessionRequestRepoUrl } from './createAgentSessionRequestRepoUrl';import type { CreateAgentSessionRequestThread } from './createAgentSessionRequestThread';import type { CreateAgentSessionRequestWorkspace } from './createAgentSessionRequestWorkspace';+import type { PromptAttachment } from './promptAttachment';/*** Request body for `POST /agent-sessions`.@@ -71,6 +73,10 @@ needs an owner. */only - an external runtime sends its own first prompt through thecontrol endpoint. Omitted, the session opens idle. */prompt?: CreateAgentSessionRequestPrompt;+ promptActionId?: CreateAgentSessionRequestPromptActionId;+ /** Files `prompt` refers to, in the order the user attached them.+Requires `prompt`. */+ promptAttachments?: PromptAttachment[];/** Starting branch for a managed coding session's selected repository.Omitted, the session starts on the repository's default branch. */repoBranch?: CreateAgentSessionRequestRepoBranch;diff --git a/apps/web/src/lib/service-clients/service-agent-harness/generated/schemas/createAgentSessionRequestPromptActionId.ts b/apps/web/src/lib/service-clients/service-agent-harness/generated/schemas/createAgentSessionRequestPromptActionId.tsnew file mode 100644index 0000000000..23de21e4ee--- /dev/null+++ b/apps/web/src/lib/service-clients/service-agent-harness/generated/schemas/createAgentSessionRequestPromptActionId.ts@@ -0,0 +1,9 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * agent_harness_service+ * OpenAPI spec version: 0.1.0+ */+import type { AgentActionId } from './agentActionId';++export type CreateAgentSessionRequestPromptActionId = null | AgentActionId;diff --git a/apps/web/src/lib/service-clients/service-agent-harness/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-agent-harness/generated/schemas/index.tsindex 984b546495..a6d96c19fb 100644--- a/apps/web/src/lib/service-clients/service-agent-harness/generated/schemas/index.ts+++ b/apps/web/src/lib/service-clients/service-agent-harness/generated/schemas/index.ts@@ -147,6 +147,7 @@ export * from './createAgentSessionRequestInstructions';export * from './createAgentSessionRequestModel';export * from './createAgentSessionRequestOwner';export * from './createAgentSessionRequestPrompt';+export * from './createAgentSessionRequestPromptActionId';export * from './createAgentSessionRequestRepoBranch';export * from './createAgentSessionRequestRepoUrl';export * from './createAgentSessionRequestThread';diff --git a/apps/web/src/lib/service-clients/service-agent-harness/openapi.json b/apps/web/src/lib/service-clients/service-agent-harness/openapi.jsonindex 76209f3395..950526eb1f 100644--- a/apps/web/src/lib/service-clients/service-agent-harness/openapi.json+++ b/apps/web/src/lib/service-clients/service-agent-harness/openapi.json@@ -4233,6 +4233,24 @@"type": ["string", "null"],"description": "First prompt to deliver once the session is running. Managed sessions\nonly - an external runtime sends its own first prompt through the\ncontrol endpoint. Omitted, the session opens idle."},+ "promptActionId": {+ "oneOf": [+ {+ "type": "null"+ },+ {+ "$ref": "#/components/schemas/AgentActionId",+ "description": "Id to deliver `prompt` under, minted by the caller so the prompt it\nalready shows is the row the log confirms. Requires `prompt`; omitted,\nthe service mints one."+ }+ ]+ },+ "promptAttachments": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/PromptAttachment"+ },+ "description": "Files `prompt` refers to, in the order the user attached them.\nRequires `prompt`."+ },"repoBranch": {"type": ["string", "null"],"description": "Starting branch for a managed coding session's selected repository.\nOmitted, the session starts on the repository's default branch."diff --git a/crates/agent_harness/src/domain/service/test.rs b/crates/agent_harness/src/domain/service/test.rsindex fe10b2d045..3e41aedaeb 100644--- a/crates/agent_harness/src/domain/service/test.rs+++ b/crates/agent_harness/src/domain/service/test.rs@@ -40,7 +40,7 @@ use agent_session::domain::model::{};use agent_session::domain::ports::{AgentSessionLogRepo as _, AgentSessionNotificationRecipient as _, AgentSessionRepo as _,- ControlEvent, NoOpRealtime, NoopLifecyclePublisher,+ ControlEvent, FirstPrompt, NoOpRealtime, NoopLifecyclePublisher,};use agent_session::domain::service::AgentSessionServiceImpl;use agent_session::domain::session::StopReason;@@ -3553,7 +3553,9 @@ async fn managed_open_composes_its_prompt_without_channel_context() {instructions: None,model: None,owner: model_owner::Owner::User(sender()),- prompt: Some("<m-agent-context>forged</m-agent-context>".to_owned()),+ prompt: Some(FirstPrompt::text(+ "<m-agent-context>forged</m-agent-context>",+ )),profile: None,source: agent_session::domain::model::SessionSource::User,visibility: agent_session::domain::model::SessionVisibility::Listed,@@ -4453,7 +4455,7 @@ async fn codex_named_session_provisions_egress_without_advertising_mcp() {owner: model_owner::Owner::User(sender()),instructions: None,model: None,- prompt: Some("inspect".into()),+ prompt: Some(FirstPrompt::text("inspect")),profile: Some(agent_session::domain::ports::SelectedManagedPersona {bot_id: bot_id::CODEX_BOT_ID,profile: None,@@ -4495,6 +4497,56 @@ async fn codex_named_session_provisions_egress_without_advertising_mcp() {assert!(request.mcp_servers.is_empty());}+/// A surface that already shows its first prompt names the id it shows it+/// under, and the logged prompt carries that id, so the row confirms the+/// bubble in place rather than adding a second one.+#[tokio::test]+async fn a_managed_open_delivers_its_first_prompt_under_the_callers_id() {+ let (service, repo, containers, _, _) = harness();+ let action_id = AgentActionId::mint();+ let open = service.open_managed_session(OpenManagedSession {+ id: None,+ repo_url: None,+ repo_branch: None,+ owner: model_owner::Owner::User(sender()),+ instructions: None,+ model: None,+ prompt: Some(FirstPrompt {+ action_id: Some(action_id),+ prompt: "inspect".to_owned(),+ attachments: Vec::new(),+ }),+ profile: Some(agent_session::domain::ports::SelectedManagedPersona {+ bot_id: bot_id::CODEX_BOT_ID,+ profile: None,+ }),+ source: agent_session::domain::model::SessionSource::User,+ visibility: agent_session::domain::model::SessionVisibility::Listed,+ });+ let drive = async {+ let container = containers+ .container(containers.first_spawned().await)+ .unwrap();+ complete_handshake(&container).await;+ };+ let (opened, ()) = tokio::join!(open, drive);+ let session = opened.expect("the session opens and takes its prompt");++ let prompt_ids: Vec<_> = repo+ .list_by_session(session.id)+ .await+ .expect("session logs should be readable")+ .into_iter()+ .filter_map(|log| match log.entry.content {+ Message::ToRuntime(ToRuntimeMessage::Acp(AcpMessage(RawJsonRpcMessage::Request(+ request,+ )))) if request.method.as_ref() == "session/prompt" => Some(request.id),+ _ => None,+ })+ .collect();+ assert_eq!(prompt_ids, vec![action_id.to_request_id()]);+}+#[tokio::test]async fn codex_channel_mention_provisions_egress_without_advertising_mcp() {let (service, repo, containers, announcer, _) = harness();diff --git a/crates/agent_harness/src/domain/service/test/warm.rs b/crates/agent_harness/src/domain/service/test/warm.rsindex 633fd0c3f0..0d256815de 100644--- a/crates/agent_harness/src/domain/service/test/warm.rs+++ b/crates/agent_harness/src/domain/service/test/warm.rs@@ -163,6 +163,72 @@ async fn warming_initializes_without_a_prompt_or_visible_created_event() {);}+/// A claimed warm session delivers the create's first prompt under the id the+/// caller already shows it under, like a cold open.+#[tokio::test]+async fn a_warm_claim_delivers_its_first_prompt_under_the_callers_id() {+ let (service, repo, containers, _, _) = harness();+ let service = service.with_warm_sessions(+ Arc::new(WarmLifecycleStub {+ claim: WarmClaim::Claimed,+ }),+ Arc::new(agent_session::domain::ports::NoOpToolCatalog),+ );+ let id = AgentSessionId::new();+ let warm = service.warm_session(model_owner::Owner::User(sender()), id);+ let drive = async {+ let container = containers+ .container(containers.first_spawned().await)+ .expect("warm runtime");+ complete_session_handshake(&container).await;+ };+ let (warmed, ()) = tokio::join!(warm, drive);+ assert_eq!(warmed.unwrap().unwrap().id, id);++ let action_id = AgentActionId::mint();+ service+ .open_managed_session(OpenManagedSession {+ id: Some(id),+ owner: model_owner::Owner::User(sender()),+ prompt: Some(FirstPrompt {+ action_id: Some(action_id),+ prompt: "inspect".to_owned(),+ attachments: Vec::new(),+ }),+ repo_url: None,+ repo_branch: None,+ instructions: None,+ model: None,+ profile: Some(agent_session::domain::ports::SelectedManagedPersona {+ bot_id: bot_id::MACRO_NEW_BOT_ID,+ profile: None,+ }),+ source: SessionSource::User,+ visibility: SessionVisibility::Listed,+ })+ .await+ .expect("claim prepared session");+ assert_eq!(+ containers.spawned(),+ 1,+ "claim must reuse the prepared runtime"+ );++ let prompt_ids: Vec<_> = repo+ .list_by_session(id)+ .await+ .expect("session logs should be readable")+ .into_iter()+ .filter_map(|log| match log.entry.content {+ Message::ToRuntime(ToRuntimeMessage::Acp(AcpMessage(RawJsonRpcMessage::Request(+ request,+ )))) if request.method.as_ref() == "session/prompt" => Some(request.id),+ _ => None,+ })+ .collect();+ assert_eq!(prompt_ids, vec![action_id.to_request_id()]);+}+fn span_exporter() -> (opentelemetry_sdk::trace::InMemorySpanExporter,opentelemetry_sdk::trace::SdkTracerProvider,diff --git a/crates/agent_harness/src/domain/service/warm.rs b/crates/agent_harness/src/domain/service/warm.rsindex 63db51e2ad..d0beb1e20d 100644--- a/crates/agent_harness/src/domain/service/warm.rs+++ b/crates/agent_harness/src/domain/service/warm.rs@@ -194,11 +194,12 @@ where).await;if let Some(prompt) = request.prompt {+ let (id, action) = prompt.into_action();self.execute(session_id,HarnessCommand::Deliver(DeliverAction {- id: AgentActionId::mint(),- action: AgentAction::prompt(prompt),+ id,+ action,actor: Some(owner_user),announce: None,context: None,@@ -361,12 +362,13 @@ where// Raw, through the session's own command worker: dispatch is where a// prompt is composed, and the worker is what serializes this first// prompt against any control prompt racing the session's birth.- if let Some(raw_prompt) = request.prompt {+ if let Some(prompt) = request.prompt {+ let (id, action) = prompt.into_action();self.execute_here(session.id,HarnessCommand::Deliver(DeliverAction {- id: AgentActionId::mint(),- action: AgentAction::prompt(raw_prompt),+ id,+ action,actor: Some(owner_user),announce: None,context: None,diff --git a/crates/agent_session/README.md b/crates/agent_session/README.mdindex f117ade0cb..68aecf3040 100644--- a/crates/agent_session/README.md+++ b/crates/agent_session/README.md@@ -99,7 +99,7 @@ join the same trace. Its `*_at_ms` attributes are milliseconds from the send:| Stage | Attribute | Where || --- | --- | --- || New session created, loaded, configured | `agent.prompt.created_at_ms`, `loaded_at_ms`, `configured_at_ms` | browser |-| Control POST answered, including dispatch to the runtime | `agent.prompt.accepted_at_ms` | browser |+| Prompt accepted, including dispatch to the runtime: the control POST answered, or the create for a first prompt that rode on it | `agent.prompt.accepted_at_ms` | browser || `session/prompt` → first model chunk, per call | `macro.genai.chat.time_to_first_chunk_ms` on `chat_streaming` | harness || `session/prompt` → first text at the session actor | `macro.genai.turn.time_to_first_text_ms` on `invoke_agent` | harness || First agent output of any kind folded | `agent.prompt.first_output_at_ms` | browser |diff --git a/crates/agent_session/src/domain/ports.rs b/crates/agent_session/src/domain/ports.rsindex 65a9662111..85772e253a 100644--- a/crates/agent_session/src/domain/ports.rs+++ b/crates/agent_session/src/domain/ports.rs@@ -7,7 +7,7 @@ use super::session::StopReason;use crate::domain::events::AgentSessionLifecycleEvent;use agent_client_protocol::schema::v1::{McpServer, SessionId};use agent_fold::domain::model::TurnSignal;-use agent_runtime_protocol::domain::action::{AgentAction, AgentActionId};+use agent_runtime_protocol::domain::action::{AgentAction, AgentActionId, PromptAttachment};use agent_runtime_protocol::domain::ports::Transport;use agent_runtime_protocol::domain::schema::v0::{ToRuntimeMessage, ToServerMessage};use bots::domain::models::BotId;@@ -318,7 +318,7 @@ pub struct OpenManagedSession {pub owner: Owner,/// First prompt to deliver once the sandbox is attached. `None` opens an/// idle session its owner prompts from the session's own surface.- pub prompt: Option<String>,+ pub prompt: Option<FirstPrompt>,/// A selected persona's authoritative runtime profile. `None` uses the/// deployment's default managed coding persona.pub profile: Option<SelectedManagedPersona>,@@ -334,6 +334,37 @@ pub struct OpenManagedSession {pub visibility: SessionVisibility,}+/// The prompt a managed session opens with, delivered as soon as it can run.+#[derive(Debug, Clone)]+pub struct FirstPrompt {+ /// The id the caller already shows the prompt under, so the logged row+ /// confirms it in place. `None` mints one.+ pub action_id: Option<AgentActionId>,+ /// What to tell the agent.+ pub prompt: String,+ /// Files the prompt refers to, in the order the user attached them.+ pub attachments: Vec<PromptAttachment>,+}++impl FirstPrompt {+ /// A plain text prompt under a minted id.+ pub fn text(prompt: impl Into<String>) -> Self {+ Self {+ action_id: None,+ prompt: prompt.into(),+ attachments: Vec::new(),+ }+ }++ /// The action this prompt delivers, under its id.+ pub fn into_action(self) -> (AgentActionId, AgentAction) {+ (+ self.action_id.unwrap_or_else(AgentActionId::mint),+ AgentAction::prompt_with_attachments(self.prompt, self.attachments),+ )+ }+}+/// Opens sessions, however they are served. Implemented by the harness, which/// owns the session-opening semantics.///diff --git a/crates/agent_session/src/inbound/axum_router.rs b/crates/agent_session/src/inbound/axum_router.rsindex f834413448..0e31f78c47 100644--- a/crates/agent_session/src/inbound/axum_router.rs+++ b/crates/agent_session/src/inbound/axum_router.rs@@ -19,7 +19,7 @@use std::sync::Arc;use agent_runtime_protocol::domain::{- action::{AgentAction, AgentActionId},+ action::{AgentAction, AgentActionId, PromptAttachment},schema::v0::SystemEvent,};use ai_billing::inbound::admission::AiAdmissionErrorBody;@@ -55,8 +55,9 @@ use crate::domain::model::{};use crate::domain::ports::{AgentSessionNotificationRecipient, BotDirectory, BotFacts, ControlDisposition, ControlEvent,- ExternalSessionRequester, ManagedPersonaError, OpenExternalAgentSession, OpenManagedSession,- RequestedExternalSession, SelectedPersona, SessionOpener, SessionThread, persona_for_owner,+ ExternalSessionRequester, FirstPrompt, ManagedPersonaError, OpenExternalAgentSession,+ OpenManagedSession, RequestedExternalSession, SelectedPersona, SessionOpener, SessionThread,+ persona_for_owner,};use crate::domain::service::AgentSessionService;use bots::domain::models::BotId;@@ -1855,6 +1856,15 @@ pub struct CreateAgentSessionRequest {/// only - an external runtime sends its own first prompt through the/// control endpoint. Omitted, the session opens idle.pub prompt: Option<String>,+ /// Id to deliver `prompt` under, minted by the caller so the prompt it+ /// already shows is the row the log confirms. Requires `prompt`; omitted,+ /// the service mints one.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub prompt_action_id: Option<AgentActionId>,+ /// Files `prompt` refers to, in the order the user attached them.+ /// Requires `prompt`.+ #[serde(default, skip_serializing_if = "Vec::is_empty")]+ pub prompt_attachments: Vec<PromptAttachment>,/// Explicit GitHub repository for a managed Cursor session, as one of the/// urls `GET /agent-repositories` lists for the caller. Access is checked/// for the session owner. For external sessions this is informational:@@ -1972,6 +1982,8 @@ pub enum CreateSessionApiError {MixedSessionShape,/// The thread named neither a parent nor a channel.ThreadParentRequired,+ /// A first prompt's id or files arrived without the prompt itself.+ PromptDetailsWithoutPrompt,/// A field the request cannot honour for a persona whose runtime is its/// operator's: they configure it, or the caller sends it separately.ExternalPersonaUnsupported(&'static str),@@ -2036,6 +2048,10 @@ impl IntoResponse for CreateSessionApiError {StatusCode::UNPROCESSABLE_ENTITY,"thread.parent is required".to_owned(),),+ Self::PromptDetailsWithoutPrompt => (+ StatusCode::UNPROCESSABLE_ENTITY,+ "promptActionId and promptAttachments require a prompt".to_owned(),+ ),Self::ExternalPersonaUnsupported(field) => (StatusCode::UNPROCESSABLE_ENTITY,format!("{field} is not supported for an agent that runs on its own machine"),@@ -2224,6 +2240,17 @@ pub async fn create_agent_session_handler<// the row, the response and every runtime see one representation of// absence, whichever shape the request turns out to be.let instructions = request.instructions.filter(|text| !text.trim().is_empty());+ let first_prompt = match request.prompt {+ Some(prompt) => Some(FirstPrompt {+ action_id: request.prompt_action_id,+ prompt,+ attachments: request.prompt_attachments,+ }),+ None if request.prompt_action_id.is_some() || !request.prompt_attachments.is_empty() => {+ return Err(CreateSessionApiError::PromptDetailsWithoutPrompt);+ }+ None => None,+ };// No workspace means the managed shape. A bot id selects a managed// persona; the domain resolver owns its user/team/channel authorization@@ -2269,7 +2296,7 @@ pub async fn create_agent_session_handler<// caller that sent one would otherwise never learn it was// ignored. A model is different - it is applied when the// session binds, like the persona's own.- if request.prompt.is_some() {+ if first_prompt.is_some() {return Err(CreateSessionApiError::ExternalPersonaUnsupported("prompt"));}let owner = owner@@ -2320,7 +2347,7 @@ pub async fn create_agent_session_handler<)})?,owner,- prompt: request.prompt,+ prompt: first_prompt,profile,instructions,model: request.model.filter(|model| !model.trim().is_empty()),@@ -2339,7 +2366,7 @@ pub async fn create_agent_session_handler<// An external runtime sends its own first prompt through the control// endpoint, so accepting one here would silently drop it, and it runs on// whatever model its operator configured, which is not ours to set.- if request.prompt.is_some() || request.repo_branch.is_some() || request.model.is_some() {+ if first_prompt.is_some() || request.repo_branch.is_some() || request.model.is_some() {return Err(CreateSessionApiError::MixedSessionShape);}let bot_id = resolve_bot(&caller.authorization, request.bot_id)?;diff --git a/crates/agent_session/src/inbound/axum_router/test.rs b/crates/agent_session/src/inbound/axum_router/test.rsindex bded5efcbb..97cf3ffd6d 100644--- a/crates/agent_session/src/inbound/axum_router/test.rs+++ b/crates/agent_session/src/inbound/axum_router/test.rs@@ -1084,6 +1084,58 @@ async fn a_managed_open_carries_its_instructions() {);}+/// The first prompt keeps the id the caller already shows it under and the+/// files attached to it, so creating and prompting take one round trip.+#[tokio::test]+async fn a_managed_open_carries_its_first_prompts_id_and_attachments() {+ let action_id = AgentActionId::mint();+ let opener = Arc::new(RecordingOpener::default());+ let request = as_user(+ OWNER,+ serde_json::json!({+ "prompt": "summarize this",+ "promptActionId": action_id,+ "promptAttachments": [{ "uri": "macro://sfs/report.pdf", "name": "report.pdf" }],+ })+ .to_string(),+ );++ let response = router(opener.clone()).oneshot(request).await.unwrap();++ assert_eq!(response.status(), StatusCode::CREATED);+ let managed = opener.managed.lock().unwrap();+ let [open] = managed.as_slice() else {+ panic!("expected one managed open, got {managed:?}");+ };+ let prompt = open.prompt.as_ref().expect("the first prompt is carried");+ assert_eq!(prompt.action_id, Some(action_id));+ assert_eq!(prompt.prompt, "summarize this");+ assert_eq!(+ prompt+ .attachments+ .iter()+ .map(|attachment| attachment.name.as_str())+ .collect::<Vec<_>>(),+ vec!["report.pdf"]+ );+}++/// A prompt's id or files mean nothing without the prompt, and dropping them+/// would leave the caller showing a prompt nobody sent.+#[tokio::test]+async fn a_first_prompts_details_without_a_prompt_are_refused() {+ let opener = Arc::new(RecordingOpener::default());+ let request = as_user(+ OWNER,+ serde_json::json!({ "promptActionId": AgentActionId::mint() }).to_string(),+ );++ let response = router(opener.clone()).oneshot(request).await.unwrap();++ assert_eq!(response.status(), StatusCode::UNPROCESSABLE_ENTITY);+ assert!(opener.managed.lock().unwrap().is_empty());+}+#[tokio::test]async fn an_owner_can_select_a_managed_persona() {let opener = Arc::new(RecordingOpener::default());diff --git a/crates/coding_agent_worker/src/dispatch.rs b/crates/coding_agent_worker/src/dispatch.rsindex 5351147901..eae2099386 100644--- a/crates/coding_agent_worker/src/dispatch.rs+++ b/crates/coding_agent_worker/src/dispatch.rs@@ -155,6 +155,8 @@ impl WorkExecutor for Dispatcher {// the runtime, and it delivers the mention itself through// the control endpoint. Sending one here is refused.prompt: None,+ prompt_action_id: None,+ prompt_attachments: Vec::new(),repo_url: self.workspace.repo_url.clone(),repo_branch: None,owner: Some(sender.as_ref().to_owned()),@@ -248,6 +250,8 @@ impl WorkExecutor for Dispatcher {bot_id: Some(bot.as_uuid()),workspace: Some(workspace),prompt: None,+ prompt_action_id: None,+ prompt_attachments: Vec::new(),repo_url: repo_url.or_else(|| self.workspace.repo_url.clone()),repo_branch: None,owner: Some(sender.as_ref().to_owned()),diff --git a/crates/coding_agent_worker/src/outbound/agent_session/test.rs b/crates/coding_agent_worker/src/outbound/agent_session/test.rsindex 72b5c3e0b1..230d766658 100644--- a/crates/coding_agent_worker/src/outbound/agent_session/test.rs+++ b/crates/coding_agent_worker/src/outbound/agent_session/test.rs@@ -51,6 +51,8 @@ async fn transient_create_retries_keep_identity_and_trigger_controls_keep_sourcebot_id: Some(bot_id::BotId::TEST_A.as_uuid()),workspace: Some("/workspace".into()),prompt: None,+ prompt_action_id: None,+ prompt_attachments: Vec::new(),repo_url: None,repo_branch: None,owner: Some(sender.to_string()),diff --git a/docs/agent-guide/ai-chat.md b/docs/agent-guide/ai-chat.mdindex 2a80f1be78..cd9415318d 100644--- a/docs/agent-guide/ai-chat.md+++ b/docs/agent-guide/ai-chat.md@@ -76,6 +76,10 @@ before the first prompt; settings the runtime already reports do not needanother control request.A model the user picks mid-session is a line between turns. Work from beforethe change stays above it; anything the agent says after appears below it.+With `enable-first-prompt-on-create` on, the default agent's first prompt rides+on the create (`prompt` + `promptActionId`) and no `/control` request follows;+a persona, effort, or speed keeps the control request. Either way the prompt+shows as one bubble that the logged row confirms in place.Macro's in-process agent opens each reply with a line from a fast model(`gpt-5.4-mini`), usually within half a second of Enter. Small talkdiff --git a/packages/sdk-docs/reference/generated/agent-harness/types.gen/type-aliases/CreateAgentSessionRequest.md b/packages/sdk-docs/reference/generated/agent-harness/types.gen/type-aliases/CreateAgentSessionRequest.mdindex 1fe6a114f4..7bc933d1c0 100644--- a/packages/sdk-docs/reference/generated/agent-harness/types.gen/type-aliases/CreateAgentSessionRequest.md+++ b/packages/sdk-docs/reference/generated/agent-harness/types.gen/type-aliases/CreateAgentSessionRequest.md@@ -1,6 +1,6 @@# Type Alias: CreateAgentSessionRequest-> **CreateAgentSessionRequest** = \{ `botId?`: `string` \| `null`; `id?`: `string` \| `null`; `instructions?`: `string` \| `null`; `model?`: `string` \| `null`; `owner?`: `string` \| `null`; `prompt?`: `string` \| `null`; `repoBranch?`: `string` \| `null`; `repoUrl?`: `string` \| `null`; `thread?`: `null` \| [`CreateSessionThread`](CreateSessionThread.md); `workspace?`: `string` \| `null`; \}+> **CreateAgentSessionRequest** = \{ `botId?`: `string` \| `null`; `id?`: `string` \| `null`; `instructions?`: `string` \| `null`; `model?`: `string` \| `null`; `owner?`: `string` \| `null`; `prompt?`: `string` \| `null`; `promptActionId?`: `null` \| [`AgentActionId`](AgentActionId.md); `promptAttachments?`: [`PromptAttachment`](PromptAttachment.md)[]; `repoBranch?`: `string` \| `null`; `repoUrl?`: `string` \| `null`; `thread?`: `null` \| [`CreateSessionThread`](CreateSessionThread.md); `workspace?`: `string` \| `null`; \}Request body for `POST /agent-sessions`.@@ -25,6 +25,8 @@ Clients serialize this, so both derives are used.| <a id="property-model"></a> `model?` | `string` \| `null` | Model the managed session runs on, overriding the persona's. Managed sessions only: an external runtime picks its own. The session's model from the moment it exists, which is what a caller choosing one before the first prompt means. Selecting a model *during* a session is a control action instead, and reads as one in its transcript. || <a id="property-owner"></a> `owner?` | `string` \| `null` | The user who owns the session. Ignored for user callers, who always own their own sessions, for harness callers, whose verified acting user owns the session, and for bots that already act for a verified user. A bot without one may name a user here. That claim is trusted for the bot's own sessions. With no claim, a team bot owns the session itself only while non-user owners are enabled. Every other bot still needs an owner. || <a id="property-prompt"></a> `prompt?` | `string` \| `null` | First prompt to deliver once the session is running. Managed sessions only - an external runtime sends its own first prompt through the control endpoint. Omitted, the session opens idle. |+| <a id="property-promptactionid"></a> `promptActionId?` | `null` \| [`AgentActionId`](AgentActionId.md) | - |+| <a id="property-promptattachments"></a> `promptAttachments?` | [`PromptAttachment`](PromptAttachment.md)[] | Files `prompt` refers to, in the order the user attached them. Requires `prompt`. || <a id="property-repobranch"></a> `repoBranch?` | `string` \| `null` | Starting branch for a managed coding session's selected repository. Omitted, the session starts on the repository's default branch. || <a id="property-repourl"></a> `repoUrl?` | `string` \| `null` | Explicit GitHub repository for a managed Cursor session, as one of the urls `GET /agent-repositories` lists for the caller. Access is checked for the session owner. For external sessions this is informational: cloning it is the runtime operator's job. || <a id="property-thread"></a> `thread?` | `null` \| [`CreateSessionThread`](CreateSessionThread.md) | - |diff --git a/packages/sdk/generated/agent-harness/types.gen.ts b/packages/sdk/generated/agent-harness/types.gen.tsindex cf75e7d5a1..17a1251085 100644--- a/packages/sdk/generated/agent-harness/types.gen.ts+++ b/packages/sdk/generated/agent-harness/types.gen.ts@@ -1078,6 +1078,12 @@ export type CreateAgentSessionRequest = {* control endpoint. Omitted, the session opens idle.*/prompt?: string | null;+ promptActionId?: null | AgentActionId;+ /**+ * Files `prompt` refers to, in the order the user attached them.+ * Requires `prompt`.+ */+ promptAttachments?: Array<PromptAttachment>;/*** Starting branch for a managed coding session's selected repository.* Omitted, the session starts on the repository's default branch.diff --git a/packages/sdk/specs/agent-harness.json b/packages/sdk/specs/agent-harness.jsonindex 76209f3395..950526eb1f 100644--- a/packages/sdk/specs/agent-harness.json+++ b/packages/sdk/specs/agent-harness.json@@ -4233,6 +4233,24 @@"type": ["string", "null"],"description": "First prompt to deliver once the session is running. Managed sessions\nonly - an external runtime sends its own first prompt through the\ncontrol endpoint. Omitted, the session opens idle."},+ "promptActionId": {+ "oneOf": [+ {+ "type": "null"+ },+ {+ "$ref": "#/components/schemas/AgentActionId",+ "description": "Id to deliver `prompt` under, minted by the caller so the prompt it\nalready shows is the row the log confirms. Requires `prompt`; omitted,\nthe service mints one."+ }+ ]+ },+ "promptAttachments": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/PromptAttachment"+ },+ "description": "Files `prompt` refers to, in the order the user attached them.\nRequires `prompt`."+ },"repoBranch": {"type": ["string", "null"],"description": "Starting branch for a managed coding session's selected repository.\nOmitted, the session starts on the repository's default branch."