fix(panel): harden SQLite ledger concurrency, LRU sizing, and recovery

- Preserve step detail_json and peer-appended rows during cold metadata flushes, slim-step spreads, and mixed-case UUID re-keying without triggering case-insensitive self-deletion
- Raise default hot session LRU limit to 64 and prime stepSigs during on-demand hydration to avoid cyclic read thrashing across 30-session quick stats plus active subagents
- Quarantine corrupt SQLite images to .corrupt.<ts> with automatic .json.bak recovery and defer latching loadedOnce until initial hydration succeeds
- Flush pending throttled endpoint caches on worker/standalone stop, isolate unscoped node --test runs from live user data, and transitively retain nested subagents and side questions on cache rebuilds
This commit is contained in:
fish
2026-11-24 15:04:14 +09:00
parent 030d894988
commit 173e21c607
8 changed files with 381 additions and 49 deletions
+11 -3
View File
@@ -418,14 +418,22 @@ export function computeRuntimeCodeVersion(options = {}) {
/**
* 本机内存态轨迹步骤缓存容器(委托 `createTrajectoryCacheStore`,首次读取时惰性加载历史缓存)。
*/
const isUnscopedHostTestRunner = Boolean(
typeof process !== 'undefined' &&
process?.env?.NODE_TEST_CONTEXT &&
!process?.env?.USAGE_MONITOR_APP_DATA_DIR &&
!process?.env?.ANTIGRAVITY_APP_DATA_DIR &&
!process?.env?.ANTIGRAVITY_GEMINI_DIR
);
const localTrajectoryCacheStore = createTrajectoryCacheStore({
cacheFilePath: CACHE_FILE,
sqliteFilePath: TRAJECTORY_DB_FILE,
cacheFilePath: isUnscopedHostTestRunner ? '' : CACHE_FILE,
sqliteFilePath: isUnscopedHostTestRunner ? '' : TRAJECTORY_DB_FILE,
loadJsonFn: loadJson,
writeCacheFn: (targetPath, dataObj) => saveJson(targetPath, dataObj),
shouldBypassThrottleFn: (allowThrottleInTest) =>
lsRuntimeEndpoint.addr === 'test.invalid' && !allowThrottleInTest,
registerExitHook: true,
registerExitHook: !isUnscopedHostTestRunner,
});
export function getLocalTrajectoryCacheStore() {