File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,10 +88,18 @@ export function isDashboardAgentConfigured(): boolean {
8888 return Boolean ( env . DASHBOARD_AGENT_SECRET_KEY ) ;
8989}
9090
91+ // With no agent worker available a turn's run would sit queued indefinitely and
92+ // could be dequeued much later with a stale token. Expire it instead — the turn
93+ // is long dead by then on the client.
94+ const DASHBOARD_AGENT_RUN_TTL = "2m" ;
95+
9196// Pins every agent session (and its continuation runs) to a deployed version
9297// when DASHBOARD_AGENT_VERSION is set; unset runs on the env's current version.
93- export function dashboardAgentTriggerConfig ( ) : { lockToVersion : string } | undefined {
94- return env . DASHBOARD_AGENT_VERSION ? { lockToVersion : env . DASHBOARD_AGENT_VERSION } : undefined ;
98+ export function dashboardAgentTriggerConfig ( ) : { ttl : string ; lockToVersion ?: string } {
99+ return {
100+ ttl : DASHBOARD_AGENT_RUN_TTL ,
101+ ...( env . DASHBOARD_AGENT_VERSION ? { lockToVersion : env . DASHBOARD_AGENT_VERSION } : { } ) ,
102+ } ;
95103}
96104
97105export async function startDashboardAgentSession ( params : {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments