Comp AI CRM is an open source, CRM designed for AI agents. Agentic-first CRM.
TypeScript
Update agent panel to use SETTLED_TTL_MS for archive stale time and enhance documentation
Lewis Carhart9a936fb60ddb
diff --git a/apps/app/components/crm/agent-panel.tsx b/apps/app/components/crm/agent-panel.tsxindex 61f2dee7..d03cd8b2 100644--- a/apps/app/components/crm/agent-panel.tsx+++ b/apps/app/components/crm/agent-panel.tsx@@ -146,7 +146,7 @@ function ThreadWithHistory({const archive = useQuery({...trpc.conversations.events.queryOptions({ id: conversation?.id ?? "" }),enabled: conversation !== null && offline,- staleTime: Number.POSITIVE_INFINITY,+ staleTime: SETTLED_TTL_MS,});if (conversation && (thread.isPending || (offline && archive.isPending)))diff --git a/docs/agent-panel.md b/docs/agent-panel.mdindex 49b3d876..91c2bbc9 100644--- a/docs/agent-panel.md+++ b/docs/agent-panel.md@@ -21,6 +21,15 @@ claim minted, the field a conversation is filed under, the empty-thread question- **The archive is fetched only when the snapshot fails.** It is the offline fallbackand nothing else, so loading it up front bought a serial round trip on every open.Nothing renders until it lands — `useEveAgent` reads `initialEvents` once, at mount.+- **It ages with the snapshot, and is never `staleTime: Infinity`.** A session's+ archive is not immutable: the agent appends to it every turn. Held forever, an+ agent that goes down, comes back, and goes down again renders the first outage's+ transcript and silently drops what happened in between. Both reads mirror the same+ session, so both expire at `SETTLED_TTL_MS`.+- **Never key the transcript on the archive.** A refetch that lands while it is+ mounted is ignored on purpose; remounting to pick it up would abort a live answer,+ which is the same failure `keepMounted` exists to prevent. Correcting a stale+ fallback is the next mount's job.- **The audit hook does not archive `reasoning.appended`.** Every delta carries`reasoningSoFar`, the whole reasoning to that point, so the archive grew as thesquare of the tokens — one insert per token, 90% of `AgentEvent`, for events the