fix: require session scoped AgentRun PVC (#1906)
This commit is contained in:
@@ -2937,12 +2937,18 @@ function withAgentRunRunnerJobCount(mapping = {}) {
|
||||
return mapping;
|
||||
}
|
||||
|
||||
function hwlabSessionIdForParams(params = {}, traceId) {
|
||||
return safeSessionId(params.sessionId) || agentRunSessionId(traceId);
|
||||
function hwlabSessionIdForParams(params = {}) {
|
||||
return safeSessionId(params.sessionId) || null;
|
||||
}
|
||||
|
||||
function scopedAgentRunSessionIdForParams(params = {}, traceId, backendProfile) {
|
||||
const baseSessionId = hwlabSessionIdForParams(params, traceId);
|
||||
if (!safeSessionId(baseSessionId)) {
|
||||
throw adapterError(
|
||||
"agentrun_session_id_required",
|
||||
"AgentRun persistent session/PVC requires params.sessionId; refusing to derive sessionRef.sessionId from traceId because that would create a new PVC per turn."
|
||||
);
|
||||
}
|
||||
const profile = agentRunSessionProfileToken(backendProfile);
|
||||
const base = String(baseSessionId).replace(/^ses_/u, "").replace(/[^A-Za-z0-9_]+/gu, "_").replace(/^_+|_+$/gu, "") || "session";
|
||||
return `ses_agentrun_${profile}_${base}`;
|
||||
|
||||
Reference in New Issue
Block a user