Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
bc8b39a
Source control actions start chats and terminals on their saved model
brennanb2025 Oct 18, 2026
268f78c
Merge remote-tracking branch 'origin/main' into brennan/sta-11102-cha…
brennanb2025 Oct 18, 2026
d3f1a6e
Name the model in the repository override note
brennanb2025 Oct 18, 2026
b3de904
Type the dialog's model hand-off; keep Agent in English in Japanese copy
brennanb2025 Oct 18, 2026
58a03f2
fix: preserve action chat model choices through launch
brennanb2025 Oct 19, 2026
67e02bc
Preserve action selection ownership across chat launches
brennanb2025 Oct 19, 2026
27d7e93
Keep terminal host contract fixtures aligned with preflight
brennanb2025 Oct 19, 2026
b1ec857
fix: wait for action Settings agent inventory
brennanb2025 Oct 19, 2026
990f0ba
Merge main into action chat launch fixes
brennanb2025 Oct 19, 2026
ef198aa
fix: consolidate direct agent routing imports
brennanb2025 Oct 19, 2026
b2d6aa1
fix: use standard action option labels
brennanb2025 Oct 19, 2026
b9c66df
fix: align action launch contracts with shared types
brennanb2025 Oct 19, 2026
9841b88
fix: sync action option localization metadata
brennanb2025 Oct 19, 2026
c3dc7bf
test: provide action Settings inventory in mounted fixtures
brennanb2025 Oct 19, 2026
4cbe2e6
Keep action options row height stable while loading
brennanb2025 Oct 19, 2026
efe329d
Merge remote-tracking branch 'origin/main' into brennan/sta-11102-cha…
brennanb2025 Oct 19, 2026
6c7a7d9
Let each Source Control action choose its chat permission mode
brennanb2025 Oct 19, 2026
3cadfcf
Merge remote-tracking branch 'origin/main' into brennan/sta-11102-cha…
brennanb2025 Oct 19, 2026
ec6b407
fix(native-chat): leave older hosts their own permission mode and kee…
brennanb2025 Oct 19, 2026
663ce7f
fix(settings): reserve one options row while loading an action with n…
brennanb2025 Oct 19, 2026
96d88d6
fix(native-chat): keep the create options mode a checked literal type
brennanb2025 Oct 19, 2026
0e81f75
fix(settings): share verified action option fields
brennanb2025 Oct 20, 2026
773d306
Merge current main into action options fix
brennanb2025 Oct 20, 2026
f05ba6c
fix(settings): keep action selectors on standard typography
brennanb2025 Oct 20, 2026
ad8ce46
Merge current main into action launch options
brennanb2025 Oct 20, 2026
e93fdfc
Merge remote-tracking branch 'origin/main' into brennan/sta-11102-cha…
brennanb2025 Oct 20, 2026
5a914f5
Keep the launch files under their length limits after the main merge
brennanb2025 Oct 20, 2026
ea5c913
One action settings section for chat and terminal launches
brennanb2025 Oct 21, 2026
eee1ff5
Merge remote-tracking branch 'origin/main' into brennan/sta-11102-cha…
brennanb2025 Oct 21, 2026
9509c76
fix(source-control-ai): one terminal projection for saved action choices
brennanb2025 Oct 21, 2026
3f7de64
fix(source-control-ai): an edited repository action saves complete
brennanb2025 Oct 21, 2026
d91a0eb
fix(settings): style the Extra CLI arguments toggle through Button's …
brennanb2025 Oct 21, 2026
877891f
fix: keep saved action and restart launch recipes consistent
brennanb2025 Oct 21, 2026
0b7df87
fix: describe inherited arguments and chat-only permissions accurately
brennanb2025 Oct 21, 2026
57f0d06
Merge remote-tracking branch 'origin/main' into brennan/sta-11102-cha…
brennanb2025 Oct 21, 2026
505317a
test: check repository action settings fixture type
brennanb2025 Oct 21, 2026
d91139d
test: map saved action options into terminal compiler inputs
brennanb2025 Oct 21, 2026
36572cc
fix: retain saved action controls during agent detection
brennanb2025 Oct 22, 2026
cb256a4
Merge pinned main into action launch preferences
brennanb2025 Oct 22, 2026
5720cdd
fix(i18n): retire obsolete Portuguese action labels
brennanb2025 Oct 22, 2026
5cf3ada
test: align folder launch fallback mock with outcome export
brennanb2025 Oct 22, 2026
3cb6845
Merge main into saved action launch preferences
brennanb2025 Oct 22, 2026
aaeafd2
Merge origin/main into saved action launch preferences
brennanb2025 Oct 22, 2026
fdf410a
Merge origin/main into sta-11102 chat launch model branch
brennanb2025 Oct 23, 2026
2c22172
fix: carry resolved connector launch intent and mode together
brennanb2025 Oct 23, 2026
f44a2e2
test: pin shared action launch branches to recorded agent output
brennanb2025 Oct 23, 2026
97093ab
test: preserve saved source control choices through detection and mig…
brennanb2025 Oct 23, 2026
235430a
Merge main into saved agent launch preferences
brennanb2025 Oct 24, 2026
93fbd53
test: align launch fixtures with integrated result contract
brennanb2025 Oct 24, 2026
3300d51
Merge main to clear final integration conflict
brennanb2025 Oct 24, 2026
978c60a
test: retain recipe and restart contracts after main integration
brennanb2025 Oct 24, 2026
f997db4
Merge main while preserving saved agent launch choices
brennanb2025 Oct 25, 2026
660243e
Merge main and preserve action launch permission precedence
brennanb2025 Oct 25, 2026
abe3fa2
Unify Source Control action permission settings
brennanb2025 Oct 26, 2026
b7fde11
Keep native Ask copy with its owning change
brennanb2025 Oct 26, 2026
556ff0d
Merge main into Source Control launch settings
brennanb2025 Oct 26, 2026
a6896a5
Preserve action drafts and old-host permission intent
brennanb2025 Oct 26, 2026
7805b18
Consume rejected Source Control action saves
brennanb2025 Oct 26, 2026
6a9667d
Merge main to resolve Settings test conflicts
brennanb2025 Oct 26, 2026
e89a051
Follow the moved Settings persistence fixture
brennanb2025 Oct 26, 2026
4b1e5fe
Keep permission integration contracts in the cross-version test project
brennanb2025 Oct 26, 2026
03d298d
Include the action permission inheritance label in English catalogs
brennanb2025 Oct 26, 2026
5f39eae
Align launch contracts with shared permission recipes
brennanb2025 Oct 26, 2026
b3db16d
Merge main and preserve compiled terminal resume inputs
brennanb2025 Oct 26, 2026
1d78cad
Keep Source Control action controls within their Settings columns
brennanb2025 Oct 26, 2026
cfbcc5b
Use primitive variants for compact action settings controls
brennanb2025 Oct 26, 2026
654bfa5
Show action arguments only for terminal defaults and widen recipe rows
brennanb2025 Oct 26, 2026
31f5a68
Merge main and preserve explicit Source Control chat choices
brennanb2025 Oct 26, 2026
00bd1fb
Apply terminal-only action arguments visibility to repository overrides
brennanb2025 Oct 26, 2026
be14df4
Align action permission control with model controls
brennanb2025 Oct 26, 2026
2acf269
Use shared settings label for action permissions
brennanb2025 Oct 26, 2026
ea508af
Hide action model controls until argument migration ships
brennanb2025 Oct 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions mobile/src/session/mobile-existing-agent-launch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,34 @@ describe('launchAgentInExistingWorkspace', () => {
})

it('treats a refusal of the first send as an unsupported host', async () => {
const { client } = scriptedClient(refused('agent_launch_replay_unsupported'))
await expect(launch(client)).resolves.toEqual({ kind: 'unsupported' })
const { client, sendRequest } = scriptedClient(refused('agent_launch_replay_unsupported'))
await expect(
launch(client, { chatOptions: { model: 'opus', fastMode: 'false' } })
).resolves.toEqual({ kind: 'unsupported' })
expect(sendRequest.mock.calls[0]?.[1]).not.toHaveProperty('chatOptions')
})

it('never reads a refusal after a replay as unsupported: the first attempt may have run', async () => {
const { client, sendRequest } = scriptedClient(
{ throws: markRpcDeliveryUnknown(new Error('Connection interrupted')) },
refused('agent_launch_replay_unsupported')
)
await expect(launch(client)).resolves.toEqual({
const chatOptions = { model: 'opus', fastMode: 'false' }
const capabilities = [...LAUNCH_CAPABILITIES, 'agent.launch.chat-options.v1']
const pending = launch(client, { hostCapabilities: capabilities, chatOptions })
chatOptions.model = 'changed-after-send'
capabilities.length = 0
await expect(pending).resolves.toEqual({
kind: 'unknown',
message: AGENT_LAUNCH_UNCONFIRMED_MESSAGE
})
expect(sendRequest.mock.calls.map(([, params]) => requestParam(params, 'chatOptions'))).toEqual(
[
{ model: 'opus', fastMode: 'false' },
{ model: 'opus', fastMode: 'false' }
]
)
expect(sendRequest.mock.calls[0]?.[1]).toBe(sendRequest.mock.calls[1]?.[1])
// The replay reuses the same operation id.
expect(sendRequest.mock.calls.map(([, params]) => requestParam(params, 'operationId'))).toEqual(
['op-1', 'op-1']
Expand Down
9 changes: 9 additions & 0 deletions mobile/src/session/mobile-existing-agent-launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* every outcome is unit-testable.
*/

import { AGENT_LAUNCH_CHAT_OPTIONS_RUNTIME_CAPABILITY } from '../../../src/shared/agent-launch-runtime-capability'
import type {
AgentLaunchPlacement,
AgentLaunchPrompt,
Expand Down Expand Up @@ -96,6 +97,9 @@ export async function launchAgentInExistingWorkspace(args: {
worktreeId: string
agent: TuiAgent
prompt?: AgentLaunchPrompt
/** Model and effort the host applies on whichever route it picks. */
sessionOptions?: Readonly<Record<string, string>>
chatOptions?: Readonly<Record<string, string>>
launchSource?: string
reservation?: MobileAgentLaunchReservation
placement?: AgentLaunchPlacement
Expand All @@ -110,6 +114,11 @@ export async function launchAgentInExistingWorkspace(args: {
worktreeId: args.worktreeId,
operationId: (args.mintOperationId ?? structuredSessionOperationId)(),
...(args.prompt ? { prompt: args.prompt } : {}),
...(args.sessionOptions ? { sessionOptions: args.sessionOptions } : {}),
...(args.chatOptions &&
args.hostCapabilities?.includes(AGENT_LAUNCH_CHAT_OPTIONS_RUNTIME_CAPABILITY)
? { chatOptions: args.chatOptions }
: {}),
Comment thread
brennanb2025 marked this conversation as resolved.
Resolved
...(args.launchSource ? { launchSource: args.launchSource } : {}),
...(args.placement ? { placement: args.placement } : {}),
...(args.reservation
Expand Down
5 changes: 5 additions & 0 deletions mobile/src/session/pr-ai-triage-launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
loadMobileAgentLaunchContext
} from './mobile-new-tab-agent-loader'
import { resolveMobileSourceControlLaunchAgent } from './mobile-source-control-launch-agent'
import { resolveSourceControlActionSessionOptions } from '../../../src/shared/source-control-action-launch-preferences'

// Launch path for the phone's AI buttons ("Fix checks with AI", "Resolve conflicts with AI", commit
// recovery, review notes). The host starts the agent and delivers the prompt; the phone never
Expand Down Expand Up @@ -71,11 +72,15 @@ export async function launchAgentWithPrompt(args: {
"This action's saved prompt is empty. Update Source Control AI settings on your computer."
}
}
const sessionOptions = recipe
? resolveSourceControlActionSessionOptions(recipe, resolved.agent)
: undefined
const launched = await launchAgentInExistingWorkspace({
client: args.client,
hostCapabilities: args.hostCapabilities,
worktreeId: args.worktreeId,
agent: resolved.agent,
...(sessionOptions ? { chatOptions: sessionOptions } : {}),
// Why no saved agent arguments: whether they apply depends on the route and shell the host picks
// after this request, so the phone leaves them out and the agent's default arguments apply.
prompt: { text, delivery: 'submit' },
Expand Down
18 changes: 18 additions & 0 deletions mobile/src/tasks/agent-launch-request.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describe, expect, it } from 'vitest'
import {
agentLaunchCreateParams,
agentLaunchExistingParams,
isAgentLaunchUnsupportedRefusal,
readAgentLaunchCreateOutcome
} from './agent-launch-request'
Expand Down Expand Up @@ -37,6 +38,23 @@ describe('agentLaunchCreateParams', () => {
})
})

describe('agentLaunchExistingParams', () => {
const launch = { agent: 'codex', worktreeId: 'wt-1', operationId: 'op-1' } as const

it("sends an action's model and effort as session options", () => {
expect(
agentLaunchExistingParams({
...launch,
sessionOptions: { model: 'gpt-5.6-terra', effort: 'high' }
}).sessionOptions
).toEqual({ model: 'gpt-5.6-terra', effort: 'high' })
})

it('omits session options when the action saved no model', () => {
expect(agentLaunchExistingParams(launch)).not.toHaveProperty('sessionOptions')
})
})

describe('readAgentLaunchCreateOutcome', () => {
it.each([
{
Expand Down
4 changes: 4 additions & 0 deletions mobile/src/tasks/agent-launch-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,16 @@ export function agentLaunchExistingParams(args: {
paneKey?: string
sessionId?: string
placement?: AgentLaunchPlacement
sessionOptions?: Readonly<Record<string, string>>
chatOptions?: Readonly<Record<string, string>>
}): RpcSendParams<'agent.launchReplay'> {
return {
agent: args.agent,
operationId: args.operationId,
target: { kind: 'existing', worktree: `id:${args.worktreeId}` },
...(args.prompt ? { prompt: args.prompt } : {}),
...(args.sessionOptions ? { sessionOptions: { ...args.sessionOptions } } : {}),
...(args.chatOptions ? { chatOptions: { ...args.chatOptions } } : {}),
...(args.launchSource ? { launchSource: args.launchSource } : {}),
...(args.paneKey ? { paneKey: args.paneKey } : {}),
...(args.sessionId ? { sessionId: args.sessionId } : {}),
Expand Down
17 changes: 15 additions & 2 deletions src/main/agent-launch/agent-launch-executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,17 @@ describe("a caller's chat default in place of the host's", () => {
describe('a launch into a workspace that already exists', () => {
it('opens a session without creating anything', async () => {
const h = harness({})
const result = await h.run({ agent: 'codex', target: { kind: 'existing', worktree: 'wt-7' } })
const result = await h.run({
agent: 'codex',
target: { kind: 'existing', worktree: 'wt-7' },
chatOptions: { model: 'action-model', fastMode: 'false' }
})
expect(h.calls).toEqual(['createSupport', 'createStructuredSession'])
expect(h.createWorktree).not.toHaveBeenCalled()
expect(result.worktreeId).toBe('wt-7')
expect(h.createStructuredSession).toHaveBeenCalledWith(
expect.objectContaining({ chatOptions: { model: 'action-model', fastMode: 'false' } })
)
})

it.each(['claude', 'grok'] as const)(
Expand All @@ -418,7 +425,13 @@ describe('a launch into a workspace that already exists', () => {
describe('an agent with no structured session', () => {
it('stays a terminal without asking the host', async () => {
const h = harness({})
const result = await h.run({ agent: 'gemini', target: { kind: 'existing', worktree: 'wt-7' } })
const result = await h.run({
agent: 'gemini',
target: { kind: 'existing', worktree: 'wt-7' },
chatOptions: { model: 'action-model', fastMode: 'false' }
})
expect(h.createTerminalAgent.mock.calls[0]?.[0]).not.toHaveProperty('chatOptions')
expect(h.createTerminalAgent.mock.calls[0]?.[0]).not.toHaveProperty('options')
expect(h.calls).toEqual(['createTerminalAgent'])
expect(result.receipt).toMatchObject({ reason: 'agent_without_structured_session' })
})
Expand Down
1 change: 1 addition & 0 deletions src/main/agent-launch/agent-launch-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ async function createSurface(
worktreeId: workspace.worktreeId,
agent: intent.agent,
...(intent.sessionOptions ? { options: intent.sessionOptions } : {}),
...(intent.chatOptions ? { chatOptions: intent.chatOptions } : {}),
...(intent.sessionId ? { sessionId: intent.sessionId } : {}),
...(reservedTabId ? { tabId: reservedTabId } : {})
})
Expand Down
1 change: 1 addition & 0 deletions src/main/agent-launch/agent-launch-surface-factories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type AgentLaunchSurfaceFactory = {
worktreeId: string
/** An agent this host registered as structured; the launch mode already checked it. */
agent: StructuredAgentId
chatOptions?: Readonly<Record<string, string>>
options?: Readonly<Record<string, unknown>>
/** The caller-minted session id; refused with `AgentLaunchSessionAlreadyExistsError` if taken. */
sessionId?: string
Expand Down
17 changes: 17 additions & 0 deletions src/main/preflight/workspace-agent-detection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from '../../shared/protocol-version'
import {
resolveWorkspaceAgentDetectionHost,
detectProjectLaunchContext,
type WorkspaceAgentDetectionStore
} from './workspace-agent-detection'
import { _resetWslCachesForTests, _setWslCachesForTests } from '../wsl'
Expand Down Expand Up @@ -142,6 +143,22 @@ describe('resolveWorkspaceAgentDetectionHost on a Windows host', () => {
_resetWslCachesForTests()
})

it('prospective detection owns the project runtime before a workspace exists', async () => {
detectInstalledMock.mockResolvedValueOnce(['codex'])
const target = repo({ id: 'prospective', path: WSL_REPO_PATH })
const result = await detectProjectLaunchContext(store({ repos: [target] }), target)
expect(result).toMatchObject({
workspaceKind: 'git-worktree',
executionContext: {
kind: 'host',
projectRuntime: { status: 'resolved', runtime: { kind: 'wsl' } }
}
})
expect(detectInstalledMock).toHaveBeenCalledWith(
wslContext('Ubuntu-24.04', 'prospective', 'project-override')
)
})

it('keeps the host default for a workspace no repo row owns', () => {
const s = store({ repos: [repo({ id: 'r1', path: 'C:\\r1' })] })
expect(resolveFor(s, 'missing::C:\\x')).toEqual({ kind: 'local' })
Expand Down
27 changes: 27 additions & 0 deletions src/main/preflight/workspace-agent-detection.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { isFolderRepo } from '../../shared/repo-kind'
import type { ProjectLaunchContext } from '../../shared/rpc-contract/preflight-params'
import { isTuiAgent } from '../../shared/tui-agent-config'
import { WORKSPACE_ON_OTHER_RUNTIME } from '../../shared/protocol-version'
import {
getRepoExecutionHostId,
Expand Down Expand Up @@ -143,3 +146,27 @@ export async function refreshAgentsOnHost(host: AgentDetectionHost): Promise<Ref
}
return refreshShellPathAndDetectAgents(host.context)
}

/** A prospective workspace uses the create route's resolved repo, never a client host guess. */
export async function detectProjectLaunchContext(
store: WorkspaceAgentDetectionStore,
repo: Repo
): Promise<ProjectLaunchContext> {
const host = getRepoExecutionHostId(repo)
const ssh = getSshTargetIdForExecutionHost(host)
if (parseExecutionHostId(host)?.kind === 'runtime') {
throw new Error(WORKSPACE_ON_OTHER_RUNTIME)
}
const projectRuntime = ssh ? undefined : resolveLocalWorkspaceRuntime(store, repo, repo.path)
if (!ssh && !projectRuntime) {
throw new Error('worktree_execution_host_unresolved')
}
const agents = await detectAgentsOnHost(
ssh ? { kind: 'ssh', connectionId: ssh } : { kind: 'local', context: { projectRuntime } }
)
return {
agents: agents.filter(isTuiAgent),
workspaceKind: isFolderRepo(repo) ? 'folder' : 'git-worktree',
executionContext: projectRuntime ? { kind: 'host', projectRuntime } : { kind: 'ssh' }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ async function agentLaunchIntent(
target: await agentLaunchTarget(params, runtime),
...(params.prompt ? { prompt: params.prompt } : {}),
...(params.sessionOptions ? { sessionOptions: params.sessionOptions } : {}),
...(params.chatOptions ? { chatOptions: params.chatOptions } : {}),
...(params.reuseTerminal ? { reuseTerminal: params.reuseTerminal } : {}),
// `null` means "no arguments" and must survive; only absence falls back to the settings default.
...(params.agentArgs !== undefined ? { agentArgs: params.agentArgs } : {}),
Expand Down
4 changes: 3 additions & 1 deletion src/main/runtime/rpc/methods/agent-launch-surfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ export function agentLaunchSurfaceFactory(
worktreeId,
agent,
options,
chatOptions,
sessionId: requested,
tabId
}) => {
const sessionId = requested ?? createStructuredAgentSessionId(agent, randomUUID)
const seeded = narrowStructuredLaunchSeedOptions(options)
const seeded = chatOptions ?? narrowStructuredLaunchSeedOptions(options)
const created = await createStructuredAgentSessionForWorktree({
runtime: context.runtime,
ensureHost: async () => {
Expand All @@ -89,6 +90,7 @@ export function agentLaunchSurfaceFactory(
},
worktree: `id:${worktreeId}`,
agent,
...(chatOptions ? { optionsMode: 'replace-model-selection' as const } : {}),
...(seeded ? { options: seeded } : {}),
...(tabId ? { tabId } : {}),
activate:
Expand Down
7 changes: 5 additions & 2 deletions src/main/runtime/rpc/methods/preflight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '../../../preflight/workspace-agent-detection'
import {
PreflightAgentDetection,
PreflightProjectAgentDetection,
PreflightCheck,
PreflightDetectRemoteAgents,
PreflightDetectRemoteWindowsTerminalCapabilities
Expand All @@ -24,10 +25,12 @@ export const PREFLIGHT_METHODS = [
defineMethod({
name: 'preflight.detectAgents',
permission: 'workspace',
params: PreflightAgentDetection,
params: PreflightProjectAgentDetection,
// Why the host resolves: only it knows the workspace's project runtime, including WSL.
handler: async (params, { runtime }) =>
detectAgentsOnHost(await runtime.resolveAgentDetectionHost(params.worktreeId))
params.project
? runtime.detectProjectLaunchContext(params.project.repo)
: detectAgentsOnHost(await runtime.resolveAgentDetectionHost(params.worktreeId))
}),
defineMethod({
name: 'preflight.detectRemoteAgents',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export async function handleStructuredAgentSessionCreate(
structuredAgentCliSourceEvidence: ctx.structuredAgentCliSourceEvidence,
...(params.resumeFrom ? { resumeFrom: params.resumeFrom } : {}),
...(params.tabId ? { tabId: params.tabId } : {}),
...(params.optionsMode ? { optionsMode: params.optionsMode } : {}),
...(params.options ? { options: params.options } : {}),
...(params.firstMessage ? { firstMessage: params.firstMessage } : {}),
atRest: Boolean(
Expand Down
Loading