Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/core/src/sessions/sessionEventResidency.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import type { AgentSession, SessionStatus } from "@posthog/shared";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { SessionService, type SessionServiceDeps } from "./sessionService";
import {
SESSION_EVENT_EVICT_GRACE_MS as GRACE_MS,
SessionService,
type SessionServiceDeps,
} from "./sessionService";
import { sessionStore, sessionStoreSetters } from "./sessionStore";

const RUN = "run-res";
const TASK = "task-res";
const GRACE_MS = 20_000;

const LOG_LINE = JSON.stringify({
type: "notification",
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/sessions/sessionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ const SESSION_EVENT_FLUSH_MS = 16;
* A backgrounded session's transcript is freed this long after it stops being
* viewed, and reloaded from disk on return. Only disconnected (idle, no live
* subscription) sessions are eligible, so no streamed event can append to an
* evicted transcript.
* evicted transcript. Generous on purpose: reloading means a full log read and
* re-parse, so flipping between tasks within a few minutes must stay free.
*/
const SESSION_EVENT_EVICT_GRACE_MS = 20_000;
export const SESSION_EVENT_EVICT_GRACE_MS = 180_000;
/**
* On open, paint the last this-many bytes of the log immediately so a big
* transcript shows its latest turns in tens of ms, while the authoritative
Expand Down
Loading