The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
Merge public-gh/master into paperclip-subissues
Dotta6ebfd3ccf182
diff --cc server/src/__tests__/heartbeat-workspace-session.test.tsindex fc21ab9ea2,a7189fcad7..1be5cbb775--- a/server/src/__tests__/heartbeat-workspace-session.test.ts+++ b/server/src/__tests__/heartbeat-workspace-session.test.ts@@@ -1,7 -1,8 +1,9 @@@import { describe, expect, it } from "vitest";+ import type { agents } from "@paperclipai/db";import { resolveDefaultAgentWorkspaceDir } from "../home-paths.js";import {+ prioritizeProjectWorkspaceCandidatesForRun,+ parseSessionCompactionPolicy,resolveRuntimeSessionParamsForWorkspace,shouldResetTaskSessionForWake,type ResolvedWorkspaceForRun,@@@ -153,38 -180,54 +181,90 @@@ describe("shouldResetTaskSessionForWake});});+describe("prioritizeProjectWorkspaceCandidatesForRun", () => {+ it("moves the explicitly selected workspace to the front", () => {+ const rows = [+ { id: "workspace-1", cwd: "/tmp/one" },+ { id: "workspace-2", cwd: "/tmp/two" },+ { id: "workspace-3", cwd: "/tmp/three" },+ ];++ expect(+ prioritizeProjectWorkspaceCandidatesForRun(rows, "workspace-2").map((row) => row.id),+ ).toEqual(["workspace-2", "workspace-1", "workspace-3"]);+ });++ it("keeps the original order when no preferred workspace is selected", () => {+ const rows = [+ { id: "workspace-1" },+ { id: "workspace-2" },+ ];++ expect(+ prioritizeProjectWorkspaceCandidatesForRun(rows, null).map((row) => row.id),+ ).toEqual(["workspace-1", "workspace-2"]);+ });++ it("keeps the original order when the selected workspace is missing", () => {+ const rows = [+ { id: "workspace-1" },+ { id: "workspace-2" },+ ];++ expect(+ prioritizeProjectWorkspaceCandidatesForRun(rows, "workspace-9").map((row) => row.id),+ ).toEqual(["workspace-1", "workspace-2"]);+ });+});+++ describe("parseSessionCompactionPolicy", () => {+ it("disables Paperclip-managed rotation by default for codex and claude local", () => {+ expect(parseSessionCompactionPolicy(buildAgent("codex_local"))).toEqual({+ enabled: true,+ maxSessionRuns: 0,+ maxRawInputTokens: 0,+ maxSessionAgeHours: 0,+ });+ expect(parseSessionCompactionPolicy(buildAgent("claude_local"))).toEqual({+ enabled: true,+ maxSessionRuns: 0,+ maxRawInputTokens: 0,+ maxSessionAgeHours: 0,+ });+ });++ it("keeps conservative defaults for adapters without confirmed native compaction", () => {+ expect(parseSessionCompactionPolicy(buildAgent("cursor"))).toEqual({+ enabled: true,+ maxSessionRuns: 200,+ maxRawInputTokens: 2_000_000,+ maxSessionAgeHours: 72,+ });+ expect(parseSessionCompactionPolicy(buildAgent("opencode_local"))).toEqual({+ enabled: true,+ maxSessionRuns: 200,+ maxRawInputTokens: 2_000_000,+ maxSessionAgeHours: 72,+ });+ });++ it("lets explicit agent overrides win over adapter defaults", () => {+ expect(+ parseSessionCompactionPolicy(+ buildAgent("codex_local", {+ heartbeat: {+ sessionCompaction: {+ maxSessionRuns: 25,+ maxRawInputTokens: 500_000,+ },+ },+ }),+ ),+ ).toEqual({+ enabled: true,+ maxSessionRuns: 25,+ maxRawInputTokens: 500_000,+ maxSessionAgeHours: 0,+ });+ });+ });diff --cc server/src/services/heartbeat.tsindex d19aaa78a1,fa3753d0fc..76bac35c6e--- a/server/src/services/heartbeat.ts+++ b/server/src/services/heartbeat.ts@@@ -46,8 -41,12 +46,13 @@@ importparseProjectExecutionWorkspacePolicy,resolveExecutionWorkspaceMode,} from "./execution-workspace-policy.js";+import { instanceSettingsService } from "./instance-settings.js";import { redactCurrentUserText, redactCurrentUserValue } from "../log-redaction.js";+ import {+ hasSessionCompactionThresholds,+ resolveSessionCompactionPolicy,+ type SessionCompactionPolicy,+ } from "@paperclipai/adapter-utils";const MAX_LIVE_LOG_CHUNK_BYTES = 8 * 1024;const HEARTBEAT_MAX_CONCURRENT_RUNS_DEFAULT = 1;diff --cc ui/src/pages/ProjectDetail.tsxindex daa791c7c7,8727e80b27..0691d93a55--- a/ui/src/pages/ProjectDetail.tsx+++ b/ui/src/pages/ProjectDetail.tsx@@@ -286,21 -286,16 +286,22 @@@ export function ProjectDetail(){ archivedAt: archived ? new Date().toISOString() : null },resolvedCompanyId ?? lookupCompanyId,),- onSuccess: (_, archived) => {+ onSuccess: (updatedProject, archived) => {invalidateProject();+ const name = updatedProject?.name ?? project?.name ?? "Project";if (archived) {- pushToast({ title: "Project archived", tone: "success" });+ pushToast({ title: `"${name}" has been archived`, tone: "success" });navigate("/dashboard");} else {- pushToast({ title: "Project unarchived", tone: "success" });+ pushToast({ title: `"${name}" has been unarchived`, tone: "success" });}},+ onError: (_, archived) => {+ pushToast({+ title: archived ? "Failed to archive project" : "Failed to unarchive project",+ tone: "error",+ });+ },});const uploadImage = useMutation({