Skip to content

Commit 432f17b

Browse files
committed
fix(webapp): expire dashboard agent turn runs that are never dequeued
1 parent b72c6c3 commit 432f17b

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

apps/webapp/app/services/dashboardAgent.server.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,18 @@ export function isDashboardAgentConfigured(): boolean {
8686
return Boolean(env.DASHBOARD_AGENT_SECRET_KEY);
8787
}
8888

89+
// With no agent worker available a turn's run would sit queued indefinitely and
90+
// could be dequeued much later with a stale token. Expire it instead — the turn
91+
// is long dead by then on the client.
92+
const DASHBOARD_AGENT_RUN_TTL = "2m";
93+
8994
// Pins every agent session (and its continuation runs) to a deployed version
9095
// when DASHBOARD_AGENT_VERSION is set; unset runs on the env's current version.
91-
export function dashboardAgentTriggerConfig(): { lockToVersion: string } | undefined {
92-
return env.DASHBOARD_AGENT_VERSION ? { lockToVersion: env.DASHBOARD_AGENT_VERSION } : undefined;
96+
export function dashboardAgentTriggerConfig(): { ttl: string; lockToVersion?: string } {
97+
return {
98+
ttl: DASHBOARD_AGENT_RUN_TTL,
99+
...(env.DASHBOARD_AGENT_VERSION ? { lockToVersion: env.DASHBOARD_AGENT_VERSION } : {}),
100+
};
93101
}
94102

95103
export async function startDashboardAgentSession(params: {

apps/webapp/app/services/realtime/sessionRunManager.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ async function triggerSessionRun(params: {
310310
...(config.maxDuration !== undefined ? { maxDuration: config.maxDuration } : {}),
311311
...(config.lockToVersion ? { lockToVersion: config.lockToVersion } : {}),
312312
...(config.region ? { region: config.region } : {}),
313+
...(config.ttl !== undefined ? { ttl: config.ttl } : {}),
313314
},
314315
};
315316

0 commit comments

Comments
 (0)