File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
95103export 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