Automations PR 2 (Runner)#323810
Merged
Merged
Conversation
…a sessions layer Implements AutomationRunner: - Creates sessions with configured prompt, mode, model, and permission level - Dispatches via createAndSendNewChatRequest (background session) - Tracks run lifecycle: recordRunStart/updateRun on IAutomationService - Error notification on run failure - Cancellation handling for mid-flight stops - Sessions titled with automation name via renameChat Supporting changes: - ICreateNewSessionOptions: added modelId, modeId, permissionLevel, isolationMode, branch - ISessionsProvider: added optional setMode/setPermissionLevel/setIsolationMode/setBranch - ISendRequestOptions: added optional source field - createAndSendNewChatRequest now returns ISession | undefined - Implementation applies createOptions to provider before sending Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds the sessions-layer execution engine for Chat Automations by introducing an AutomationRunner that creates and configures a new chat session via ISessionsManagementService, sends the automation prompt in the background, and records run outcomes. It also extends the sessions management/provider APIs to support programmatic session configuration (model/mode/permission/isolation/branch) and pre-titling sessions for better UX during launch.
Changes:
- Add
AutomationRunner(sessions layer) plus unit tests; wire it into the automations contribution. - Extend
ISessionsManagementService.createAndSendNewChatRequestto return the startedISession | undefinedand accept richerICreateNewSessionOptionsfor session configuration. - Extend
ISessionsProviderrequest options with an optionaltitle, and add optional provider setters (setMode,setPermissionLevel,setIsolationMode,setBranch).
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/services/sessions/test/browser/sessionNavigation.test.ts | Updates mock signature for createAndSendNewChatRequest return type. |
| src/vs/sessions/services/sessions/common/sessionsProvider.ts | Adds ISendRequestOptions.title and optional provider configuration setter APIs. |
| src/vs/sessions/services/sessions/common/sessionsManagement.ts | Extends ICreateNewSessionOptions and updates createAndSendNewChatRequest return type. |
| src/vs/sessions/services/sessions/browser/sessionsManagementService.ts | Implements configuration application before send; returns committed session (or undefined). |
| src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.ts | Uses options.title when setting initial session title. |
| src/vs/sessions/contrib/automations/test/browser/automationRunner.test.ts | Adds coverage for runner success/failure/cancellation and option pass-through. |
| src/vs/sessions/contrib/automations/browser/automations.contribution.ts | Registers the real AutomationRunner instead of a stub. |
| src/vs/sessions/contrib/automations/browser/automationRunner.ts | New runner implementation bridging automations to sessions + telemetry/notifications. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 9
- Review effort level: Low
benvillalobos
force-pushed
the
bv/automations-2-runner
branch
from
July 1, 2026 00:52
1df880f to
a8349ca
Compare
benvillalobos
force-pushed
the
bv/automations-2-runner
branch
from
July 1, 2026 01:23
a8349ca to
103288d
Compare
benvillalobos
force-pushed
the
bv/automations-2-runner
branch
2 times, most recently
from
July 1, 2026 05:18
339bef7 to
ec62d82
Compare
benvillalobos
force-pushed
the
bv/automations-2-runner
branch
3 times, most recently
from
July 1, 2026 16:14
9238578 to
d93331d
Compare
benvillalobos
marked this pull request as ready for review
July 1, 2026 16:31
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @sandy081Matched files:
@lszomoruMatched files:
|
Thread an optional title through ISendRequestOptions and apply it in _sendFirstChat before sending, falling back to the query's first line. The automation runner passes the automation name, so launch-time prompts (e.g. worktree file transfer) show the automation name instead of the prompt text. The post-send renameChat still sets the committed CLI title.
benvillalobos
force-pushed
the
bv/automations-2-runner
branch
from
July 1, 2026 16:35
d93331d to
6cbac8f
Compare
benvillalobos
enabled auto-merge (squash)
July 1, 2026 16:39
pwang347
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Second PR in the 4-part Automations stack. Builds on PR 1 (Foundation) which has been merged to main.
This PR implements the AutomationRunner, the execution engine that bridges the automation data layer (PR 1) to the sessions layer. When the scheduler decides an automation is due, the runner creates a chat session, configures it, sends the prompt, and records the outcome.
Architecture
classDiagram class AutomationRunner { +runOnce(automation, trigger, windowId, token) -_runOnceInner() -_markCancelled() } class ISessionsManagementService { +createAndSendNewChatRequest(folderUri, options, createOptions) -_resolveProviderForNewSession() -_sendNewChatRequestInBackground() } class ISessionsProvider { +createNewSession(folderUri, sessionTypeId) +setModel(sessionId, modelId) +setMode?(sessionId, modeId) +setPermissionLevel?(sessionId, level) +setIsolationMode?(sessionId, mode) +setBranch?(sessionId, branch) +sendRequest(sessionId, chatResource, options) } class AutomationService { +recordRunStart() +updateRun() Data layer (from PR 1) } AutomationRunner --> ISessionsManagementService : creates session + sends prompt AutomationRunner --> AutomationService : records run start/completion/failure ISessionsManagementService --> ISessionsProvider : configures + dispatchesExecution Flow
sequenceDiagram participant Sch as Scheduler participant R as AutomationRunner participant AS as AutomationService participant SM as SessionsManagementService participant P as Provider Sch->>R: runOnce(automation, trigger, token) R->>AS: recordRunStart(automationId, trigger) R->>SM: createAndSendNewChatRequest(folderUri, options, createOptions) SM->>P: createNewSession(folderUri, sessionTypeId) SM->>P: setModel / setMode / setPermissionLevel / setIsolationMode / setBranch SM->>P: sendRequest(sessionId, chatResource, options) P-->>SM: session SM-->>R: session alt cancelled mid-flight R->>AS: updateRun(failed, "Cancelled") else success R->>AS: updateRun(completed, sessionId) else error R->>AS: updateRun(failed, errorMessage) R->>Notification: show error to user endWhat's New
New file:
src/vs/sessions/contrib/automations/browser/automationRunner.tsIAutomationRunner(interface from PR 1).createAndSendNewChatRequest.Sessions layer extensions:
ISessionsManagementService.createAndSendNewChatRequest()for programmatic session creation without the composer UI. Cleans up stranded sessions on failure.ISessionsProvidergains 4 optional setters:setMode?,setPermissionLevel?,setIsolationMode?,setBranch?. These were previously only callable through the concrete provider class from UI widgets.ISendRequestOptions.titlelets callers pre-name the session so it shows a meaningful title during launch.Telemetry: Refactored to report actual enum values (permissionLevel, isolationMode) instead of boolean flags.