Stop shipping megabytes of skill prompts in every snapshot refresh

The whole app turned to molasses because snapshot.load() shipped the
entire skill_runtime_snapshots table - unbounded, compiled_prompt
included - over IPC on every refresh. A real profile carried 142 rows
totaling 144MB (1.1MB each from the pre-cap CEO compile-all era), so
every coalesced refresh serialized ~144MB of JSON. The forced-humanizer
rework made it worse by adding a row per run for every agent.

- Drop skillRuntimeSnapshots, skillRevisions, skillTests, and
  skillBindings from the renderer snapshot: no renderer surface reads
  them; skill internals are main-process state. Only the lightweight
  skillDefinitions catalogue still ships.
- Project provider_requests without raw_response_json (4.1MB across the
  newest 100 rows; RunsPage only reads responseText)
- Migration 051 purges the bug-era compiled prompts from existing DBs
- resolveRuntimeSnapshot is now idempotent per run: a run re-queued by
  startup recovery reuses its frozen snapshot instead of dying on the
  uniqueness guard and burning real retry budget
- Regression test pins the contract: a 2MB database row must not add
  bytes to the snapshot (payload asserted under 400KB)
This commit is contained in:
ZacharyZhang-NY committed 2026-07-08 23:20:56 -04:00
1 parent 4ab20e679c
commit 1f89ea7089
10 files changed
+117 -34

No files matched your search

+5 -2
View File
@@ -106,12 +106,15 @@ describe("collaboration integration flow", () => {
const state = snapshot.load();
const evalRun = state.evalRuns.find((run) => run.id === evalRunId);
const snapshotRecord = state.skillRuntimeSnapshots[0];
// Compiled runtime snapshots live in the database only - the renderer
// snapshot must not carry per-run compiled prompts.
const snapshotRecord = connection.db.prepare("select compiled_prompt from skill_runtime_snapshots limit 1")
.get() as { compiled_prompt: string } | undefined;
if (!evalRun) throw new Error("Integration eval run was not created.");
if (!snapshotRecord) throw new Error("Skill runtime snapshot was not created.");
expect(state.approvals.find((approval) => approval.id === approvalId)?.state).toBe(APPROVAL_STATE.APPROVED);
expect(state.approvalAssignments.some((assignment) => assignment.approvalId === approvalId)).toBe(true);
expect(snapshotRecord.compiledPrompt).toContain("Release Gate");
expect(snapshotRecord.compiled_prompt).toContain("Release Gate");
expect(evalRun).toMatchObject({ state: SDLC_RUN_STATE.PASSED, failedCount: 0 });
expect(state.operationalEvents.some((event) => event.signalKey === "skill_resolve_success")).toBe(true);
connection.close();