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:
1 parent
88a1f8b334
commit
e0e43d6127
32 files changed
+167
-205
No files matched your search
@@ -118,8 +118,6 @@ describe("Edge Case: Session Rotation During Execution (D-05.3)", () => {
|
||||
companyId,
|
||||
agentId,
|
||||
adapterType: "gemini-cli",
|
||||
sessionParamsJson: null,
|
||||
sessionDisplayId: null,
|
||||
});
|
||||
|
||||
// Simulate runs until we reach the maxRuns threshold (20)
|
||||
@@ -146,8 +144,6 @@ describe("Edge Case: Session Rotation During Execution (D-05.3)", () => {
|
||||
companyId,
|
||||
agentId,
|
||||
adapterType: "gemini-cli",
|
||||
sessionParamsJson: null,
|
||||
sessionDisplayId: null,
|
||||
});
|
||||
|
||||
// Accumulate tokens past the threshold in one big call
|
||||
@@ -172,8 +168,6 @@ describe("Edge Case: Session Rotation During Execution (D-05.3)", () => {
|
||||
companyId,
|
||||
agentId,
|
||||
adapterType: "gemini-cli",
|
||||
sessionParamsJson: null,
|
||||
sessionDisplayId: null,
|
||||
});
|
||||
|
||||
// Accumulate enough to trigger rotation
|
||||
@@ -197,7 +191,6 @@ describe("Edge Case: Session Rotation During Execution (D-05.3)", () => {
|
||||
exitCode: 0,
|
||||
signal: null,
|
||||
model: "gemini-pro",
|
||||
sessionDisplayId: null,
|
||||
unattributedCost: false,
|
||||
});
|
||||
|
||||
@@ -229,8 +222,6 @@ describe("Edge Case: Session Rotation During Execution (D-05.3)", () => {
|
||||
companyId,
|
||||
agentId,
|
||||
adapterType: "gemini-cli",
|
||||
sessionParamsJson: JSON.stringify({ resumeKey: "abc" }),
|
||||
sessionDisplayId: "gemini-session-1",
|
||||
});
|
||||
|
||||
// Add usage to the old session
|
||||
@@ -244,8 +235,6 @@ describe("Edge Case: Session Rotation During Execution (D-05.3)", () => {
|
||||
companyId,
|
||||
agentId,
|
||||
adapterType: "gemini-cli",
|
||||
sessionParamsJson: JSON.stringify({ resumeKey: "abc" }),
|
||||
sessionDisplayId: "gemini-session-2",
|
||||
});
|
||||
|
||||
// Get the new active session
|
||||
@@ -268,8 +257,6 @@ describe("Edge Case: Session Rotation During Execution (D-05.3)", () => {
|
||||
companyId,
|
||||
agentId,
|
||||
adapterType: "claude-pro",
|
||||
sessionParamsJson: null,
|
||||
sessionDisplayId: null,
|
||||
});
|
||||
|
||||
// Accumulate way past all thresholds
|
||||
@@ -292,8 +279,6 @@ describe("Edge Case: Session Rotation During Execution (D-05.3)", () => {
|
||||
companyId,
|
||||
agentId,
|
||||
adapterType: "openai-codex",
|
||||
sessionParamsJson: null,
|
||||
sessionDisplayId: null,
|
||||
});
|
||||
|
||||
// Accumulate way past all thresholds
|
||||
@@ -317,8 +302,6 @@ describe("Edge Case: Session Rotation During Execution (D-05.3)", () => {
|
||||
companyId,
|
||||
agentId,
|
||||
adapterType: "gemini-cli",
|
||||
sessionParamsJson: null,
|
||||
sessionDisplayId: null,
|
||||
});
|
||||
db.incrementSessionUsage(sessionId, 300000, 200000, "run-1");
|
||||
|
||||
@@ -338,7 +321,6 @@ describe("Edge Case: Session Rotation During Execution (D-05.3)", () => {
|
||||
exitCode: 0,
|
||||
signal: null,
|
||||
model: "gemini-pro",
|
||||
sessionDisplayId: null,
|
||||
unattributedCost: false,
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user