Automations should not rename themselves
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Now that the automations view is using the session flat list, the name of the run is no longer controlled by the view. Agents typically name their session as they start a turn, so either we need some alternate way to correlate an automation with its run, or we should prevent agents from renaming a session when it detects its an automation.
When automations moves to the agent host there should be a flag that the agent host can check for when considering a rename. Until then, we may need some other fix around this.
## AI investigation
The current behavior spans two naming paths:
- [`AutomationRunner`](https://github.com/microsoft/vscode/blob/main/src/vs/sessions/contrib/automations/browser/automationRunner.ts) starts the background request with `title: automation.name`, then persists the returned session resource on the automation run.
- [`AutomationHistorySection`](https://github.com/microsoft/vscode/blob/main/src/vs/sessions/contrib/sessions/browser/views/automationsView.ts) resolves each run to an `ISession` and passes those sessions to `SessionsFlatList`.
- [`SessionsFlatList` / `SessionItemRenderer`](https://github.com/microsoft/vscode/blob/main/src/vs/sessions/contrib/sessions/browser/views/sessionsList.ts) renders the session's observable title. As a result, a later agent-driven chat rename becomes the visible run name instead of the automation name.
There is already an `ISession.isAutomation` observable, but for local Agent Host sessions it is currently populated by [`LocalAgentHostSessionsProvider`](https://github.com/microsoft/vscode/blob/main/src/vs/sessions/contrib/providers/agentHost/browser/localAgentHostSessionsProvider.ts) by matching session resources against persisted automation runs. That happens in the browser after the run has been linked to its created session, so it is not available early enough to suppress first-turn renaming inside Agent Host.
The Agent Host decision points are [`AgentHostSessionTitleController.seedTitleFromFirstMessage`](https://github.com/microsoft/vscode/blob/main/src/vs/platform/agentHost/node/agentHostSessionTitleController.ts) and `prepareInstructionForAgent`. The latter supplies the `rename_chat` reminder when active-agent title generation is enabled. Once automations are owned by Agent Host, an automation flag on `SessionState` could be checked at those points before seeding a title or asking the agent to rename the chat.
Until that flag exists in Agent Host, possible short-term options are:
1. Keep the history row correlated with its automation by having the Automations view provide the automation name when rendering the linked session.
2. Propagate an automation marker during programmatic session creation through [`ISessionsManagementService`](https://github.com/microsoft/vscode/blob/main/src/vs/sessions/services/sessions/browser/sessionsManagementService.ts) into Agent Host session state, then check it in the title controller.
Contributor guide
Assessment
This issue has not been assessed yet.