feat(v0.1): add mgr session PVC lifecycle for true session state persistence
PR B for #770: mgr/session-pvc.ts + server endpoints + selftest. - 新模块 src/mgr/session-pvc.ts: createSessionPvc / getSessionPvcSummary / deleteSessionPvc / refreshSessionPvcSummary / runSessionStorageGc / startSessionStorageGcLoop - Server 增量 4 个 endpoint: * POST /api/v1/sessions: 创建 session 同步创建 PVC * GET /api/v1/sessions/:id/storage: 查询 PVC 摘要 * DELETE /api/v1/sessions/:id/storage: 删 PVC + storage_kind=evicted * POST /api/v1/sessions/:id/storage/refresh: runner 上报 PVC 摘要 * POST /api/v1/sessions/storage/gc: 手动触发 GC - mgr SA RBAC 已在 PR A 增加;manager server 不直连 Kubernetes API(kubectl 由 mgr 容器内执行) - SessionRecord 增量 storageKind / storagePvcName / storageNamespace / storageSizeBytes / storageFilesCount / storageSha256 / storageUpdatedAt / storagePvcPhase / storageEvictedAt / codexRolloutSubdir - kubernetes-runner-job 短路:run 引用 evicted session 时直接返回 session-store-evicted,不创建 runner Job - KubectlHandler 可注入,selftest 覆盖 create / summary / refresh / eviction / gc / REST 路径 - GC loop 默认 5min(AGENTRUN_SESSION_GC_INTERVAL_MS 可调) runner / backend / HWLAB adapter 在 PR C / PR D 落地。
This commit is contained in:
@@ -198,8 +198,48 @@ export interface SessionRecord extends JsonRecord {
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
expiresAt: string | null;
|
||||
storageKind?: SessionStorageKind;
|
||||
storagePvcName?: string | null;
|
||||
storageNamespace?: string | null;
|
||||
storageSizeBytes?: number | null;
|
||||
storageFilesCount?: number | null;
|
||||
storageSha256?: string | null;
|
||||
storagePvcPhase?: string | null;
|
||||
storageUpdatedAt?: string | null;
|
||||
storageEvictedAt?: string | null;
|
||||
codexRolloutSubdir?: string;
|
||||
}
|
||||
|
||||
export type SessionStorageKind = "none" | "pvc" | "evicted";
|
||||
|
||||
export interface UpsertSessionInput extends JsonRecord {
|
||||
sessionId: string;
|
||||
tenantId: string;
|
||||
projectId: string;
|
||||
backendProfile: BackendProfile;
|
||||
conversationId: string | null;
|
||||
threadId: string | null;
|
||||
metadata: JsonRecord;
|
||||
expiresAt: string | null;
|
||||
codexRolloutSubdir: string;
|
||||
}
|
||||
|
||||
export interface SessionStoragePatch extends JsonRecord {
|
||||
sessionId: string;
|
||||
storageKind: SessionStorageKind;
|
||||
pvcName?: string | null;
|
||||
storageNamespace?: string | null;
|
||||
pvcPhase?: string | null;
|
||||
storageSizeBytes?: number | null;
|
||||
storageFilesCount?: number | null;
|
||||
storageSha256?: string | null;
|
||||
codexRolloutSubdir?: string;
|
||||
}
|
||||
|
||||
export interface ListGcExpiredSessionsInput extends JsonRecord {
|
||||
now: number;
|
||||
limit: number;
|
||||
}
|
||||
export interface SessionReadCursorRecord extends JsonRecord {
|
||||
sessionId: string;
|
||||
readerId: string;
|
||||
|
||||
Reference in New Issue
Block a user