fix: reduce activity history disk writes during streaming

Save only changed activity records instead of rewriting the entire history snapshot. Migrate existing history to schema 44 while preserving order and duplicate IDs.

Run unit tests with up to four workers and keep the configured integration phase serial. Include activity-history I/O, storage-upgrade, settings, and OpenCode isolation regression coverage.

Validation: 4 related test files / 123 tests passed; typecheck and lint passed.

Release note: Reduce disk writes while agent activity updates stream in, preserving existing activity history.
This commit is contained in:
mesalogo
2026-09-23 14:54:21 +08:00
parent 7d487f9326
commit 984f16f178
7 changed files with 452 additions and 22 deletions
+29 -2
View File
@@ -1,5 +1,12 @@
import { availableParallelism } from 'node:os'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vitest/config'
import { configDefaults, defineConfig } from 'vitest/config'
const serialTests = [
...configDefaults.include.map((pattern) => `tests/${pattern}`),
'src/main/agent/**/*runtime*.test.ts',
'src/agent-daemon/private-endpoint.test.ts'
]
export default defineConfig({
plugins: [react()],
@@ -14,7 +21,27 @@ export default defineConfig({
'**/build-server/**',
'**/.git/**'
],
maxWorkers: 1,
maxWorkers: Math.min(4, availableParallelism()),
projects: [
{
extends: true,
test: {
name: 'unit',
exclude: serialTests,
sequence: { groupOrder: 0 }
}
},
{
extends: true,
test: {
name: 'integration',
include: serialTests,
maxWorkers: 1,
// Keep process/socket tests separate from the parallel unit phase.
sequence: { groupOrder: 1 }
}
}
],
coverage: {
reporter: ['text', 'html']
}