refactor(session): nuke dead sessionParams / sessionDisplayId pipeline (v43)

These columns and the messages that plumbed them existed for the CLI-
adapter era — Gemini's resume id and provider-specific session params
rode the run-finished envelope back onto the session row so the next
turn could resume. Pi Mono dispatches every provider through pi-ai and
emits neither value. The worker has been posting literal null on every
finish, finalizeRun has been writing null into task_sessions, and
rotateSession has been carrying null forward.

Remove the wire, the writer, the carry-forward, and the columns:

  - v43 migration rebuilds task_sessions without session_params_json /
    session_display_id, and runs without session_display_id. Follows
    the idempotent "create new, copy, swap, reindex" pattern used by
    v41. context_snapshot_json is preserved (also unreferenced today
    but outside this cleanup's scope).
  - RunJob / EnqueueRunPayload / ChildMessage / worker-types zod
    schema no longer carry the fields. finishRun() / createNewSession()
    signatures tighten in lockstep.
  - rotateSession starts the new session with fresh counters and no
    carry-forward.
  - turn-context resolveSession returns just the session id.
  - TaskSessionRecord / RunRecord lose the dead fields.

498/498 unit tests pass. typecheck + build clean.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-18 23:22:17 -04:00
1 parent 88a1f8b334
commit e0e43d6127
32 files changed
+167 -205

No files matched your search

@@ -134,7 +134,6 @@ describe("agent model switching", () => {
exitCode: 0,
signal: null,
model: "gpt-5.4",
sessionDisplayId: null,
unattributedCost: true,
});
@@ -80,7 +80,6 @@ describe("Step 7: Worker crash recovery (database layer)", () => {
exitCode: 1,
signal: null,
model: null,
sessionDisplayId: null,
unattributedCost: true,
});
@@ -40,7 +40,6 @@ describe("Step 6: Run failure escalation (database layer)", () => {
exitCode: 1,
signal: null,
model: "gpt-5-codex",
sessionDisplayId: null,
unattributedCost: false,
});
@@ -217,7 +217,6 @@ describe("Cross-Subsystem Pipeline (D-04)", () => {
exitCode: 0,
signal: null,
model: "gemini-2.5-pro",
sessionDisplayId: null,
unattributedCost: false,
});
@@ -226,8 +225,6 @@ describe("Cross-Subsystem Pipeline (D-04)", () => {
companyId: s.companyId,
agentId: s.agentId,
adapterType: "gemini-cli",
sessionParamsJson: null,
sessionDisplayId: null,
});
sessionService.accumulateTokenUsage(sessionId, 5000, 2000, runId);
@@ -344,7 +341,6 @@ describe("Cross-Subsystem Pipeline (D-04)", () => {
exitCode: 0,
signal: null,
model: "gemini-2.5-pro",
sessionDisplayId: null,
unattributedCost: false,
});
@@ -383,8 +379,6 @@ describe("Cross-Subsystem Pipeline (D-04)", () => {
companyId: s.companyId,
agentId: s.agentId,
adapterType: "gemini-cli",
sessionParamsJson: null,
sessionDisplayId: null,
});
// Run 1: create run and accumulate tokens
@@ -456,7 +450,6 @@ describe("Cross-Subsystem Pipeline (D-04)", () => {
exitCode: 0,
signal: null,
model: "gemini-2.5-pro",
sessionDisplayId: null,
unattributedCost: false,
});
@@ -498,7 +491,6 @@ describe("Cross-Subsystem Pipeline (D-04)", () => {
exitCode: 0,
signal: null,
model: "gemini-2.5-pro",
sessionDisplayId: null,
unattributedCost: false,
});
-1
View File
@@ -133,7 +133,6 @@ describe("AppDatabase", () => {
exitCode: 0,
signal: null,
model: "gpt-5-codex",
sessionDisplayId: "session-1",
unattributedCost: false,
});
@@ -444,8 +444,6 @@ describe("Process Recovery -- Context Preservation (D-02)", () => {
companyId: s.companyId,
agentId: s.agentId,
adapterType: "gemini-cli",
sessionParamsJson: null,
sessionDisplayId: null,
});
// Add token usage to simulate real work