Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/fast-automation-session-model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'roomote': patch
---

Honor custom automation model and reasoning overrides for the Fast session across initial and resumed turns, without applying them to delegated coding tasks.
5 changes: 3 additions & 2 deletions apps/docs/automations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ Create arbitrary scheduled agent runs with:
- an optional **preferred environment**: a named environment or **All
repositories**, offered to the run as a hint for delegated work; leave it
as **Let Roomote decide** to route normally
- an optional **model** override for the runs; the default follows the
deployment task model
- an optional **model** override for the automation's Fast session, including
later turns; without an override, it uses the deployment orchestration default.
Delegated coding tasks use their own model selection or deployment coding default
- an optional **effort** override (`low`, `medium`, `high`, `extra high`, or
`max`) when the selected model supports configurable reasoning
- an optional **report destination**: a direct message to the automation owner,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
ACP_ENVELOPE_EVENT_TYPES,
fastAgentConversationSchema,
type FastAgentConversationOwner,
type ReasoningEffort,
} from '@roomote/types';

import { FAST_RESPONDING_LEASE_MS } from './fast-agent-constants';
Expand All @@ -41,6 +42,8 @@ export type FastAgentConversationRecord = {
userId: string | null;
owner: FastAgentConversationOwner;
title: string | null;
model: string | null;
reasoningEffort: ReasoningEffort | null;
conversation: FastAgentConversation;
/**
* Durable visible history for cold starts and provider retries. OpenCode,
Expand Down Expand Up @@ -776,6 +779,8 @@ export interface FastAgentConversationRepository {
sessionId?: string;
/** Title to seed only when this call creates the conversation. */
initialTitle?: string;
initialModel?: string;
initialReasoningEffort?: ReasoningEffort;
}): Promise<FastAgentConversationGetOrCreateResult>;
findById(input: {
id: string;
Expand Down Expand Up @@ -916,6 +921,8 @@ async function loadConversationRecord(
userId: record.userId,
owner,
title: record.title,
model: record.model,
reasoningEffort: record.reasoningEffort,
conversation,
compatibilityMessages: record.compatibilityMessages as ModelMessage[],
openCodeSessionId: record.openCodeSessionId,
Expand All @@ -930,6 +937,8 @@ export const fastAgentConversationRepository: FastAgentConversationRepository =
conversation,
sessionId,
initialTitle,
initialModel,
initialReasoningEffort,
}) {
const resolvedOwner =
owner ?? (userId ? { kind: 'user' as const, userId } : null);
Expand Down Expand Up @@ -987,6 +996,8 @@ export const fastAgentConversationRepository: FastAgentConversationRepository =
? resolvedOwner.automationKey
: null,
title: initialTitle?.trim() || null,
model: initialModel,
reasoningEffort: initialReasoningEffort,
surface: conversation.surface,
workspaceId: conversation.workspaceId,
conversationId: conversation.conversationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1618,8 +1618,8 @@ export async function answerFastAgentQuestion({
activeTasks?: FastAgentActiveTask[];
adapter: FastAgentTurnAdapter;
signal?: AbortSignal;
/** Explicit model override for this turn; defaults to the deployment's
* orchestration model. */
/** Explicit turn overrides; undefined uses stored session settings,
* while null uses deployment defaults. */
model?: string | null;
reasoningEffort?: ReasoningEffort | null;
turnSource?: FastAgentTurnSource;
Expand Down Expand Up @@ -2860,6 +2860,9 @@ export async function answerFastAgentQuestion({
return false;
}),
]);
if (model === undefined) model = session.model;
if (reasoningEffort === undefined)
reasoningEffort = session.reasoningEffort;
const availableIntegrations = selectFastRoomoteChannelTools({
integrations: discoveredIntegrations,
conversation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import {
taskRuns,
tasks,
} from '@roomote/db/server';
import type { FastAgentConversationOwner, RunStatus } from '@roomote/types';
import type {
FastAgentConversationOwner,
ReasoningEffort,
RunStatus,
} from '@roomote/types';
import type { FastAgentConversation } from './fast-agent-conversation';
import { fastAgentConversationRepository } from './fast-agent-conversation-repository';
import type {
Expand All @@ -23,6 +27,8 @@ type FastAgentSessionRecord = {
userId: string | null;
owner: FastAgentConversationOwner;
title: string | null;
model: string | null;
reasoningEffort: ReasoningEffort | null;
conversation: FastAgentConversation;
compatibilityMessages: ModelMessage[];
openCodeSessionId: string | null;
Expand All @@ -41,6 +47,8 @@ export async function getOrCreateFastAgentSession({
conversation,
sessionId,
initialTitle,
initialModel,
initialReasoningEffort,
}: {
owner?: FastAgentConversationOwner;
userId?: string;
Expand All @@ -49,13 +57,17 @@ export async function getOrCreateFastAgentSession({
sessionId?: string;
/** Title to seed only when this call creates the conversation. */
initialTitle?: string;
initialModel?: string;
initialReasoningEffort?: ReasoningEffort;
}): Promise<FastAgentSessionRecord> {
return fastAgentConversationRepository.getOrCreate({
...(owner ? { owner } : {}),
...(userId ? { userId } : {}),
conversation,
...(sessionId ? { sessionId } : {}),
...(initialTitle ? { initialTitle } : {}),
...(initialModel !== undefined ? { initialModel } : {}),
...(initialReasoningEffort !== undefined ? { initialReasoningEffort } : {}),
});
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions packages/sdk/src/server/automations/custom-automations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ async function runFastCustomAutomation(params: {
const session = await getOrCreateFastAgentSession({
userId: params.automation.createdByUserId,
conversation,
initialModel: params.automation.model ?? undefined,
initialReasoningEffort: params.automation.reasoningEffort ?? undefined,
});
if (rootMessageId) {
await recordFastAgentConversationMessage({
Expand All @@ -360,14 +362,6 @@ async function runFastCustomAutomation(params: {
launchClaimedAt: params.launchClaimedAt.toISOString(),
prompt: params.automation.prompt,
trigger: params.trigger,
...(params.automation.model
? { defaultTaskModel: params.automation.model }
: {}),
...(params.automation.reasoningEffort
? {
defaultTaskReasoningEffort: params.automation.reasoningEffort,
}
: {}),
...(params.preferredEnvironmentId
? { preferredEnvironmentId: params.preferredEnvironmentId }
: {}),
Expand Down
Loading
Loading