The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Saving a machine's settings keeps its Lent hours and last reading (#3075)
harness-for-autonomous[bot]1da94962a143
diff --git a/backend/src/superTabs/commands.test.ts b/backend/src/superTabs/commands.test.tsindex c3957e1af..21219f389 100644--- a/backend/src/superTabs/commands.test.ts+++ b/backend/src/superTabs/commands.test.ts@@ -14,6 +14,8 @@ import { INSTRUCTIONS_TEMPLATE } from './instructionsTemplate.js'import { DEFAULT_ROUTING_POLICY, effectivePolicy } from './routingPolicy.js'import { NOW, owner as richOwner, peer as richPeer, richSwarm } from './read/fixture.test-support.js'import { groupView } from './read/views.js'+import { weekStart } from './leaderboard/week.js'+import { lentIn, weekSpan } from './leaderboard/rolling.js'const owner: Extract<Actor, { kind: 'person' }> = { kind: 'person', userId: 'owner', email: '[email protected]' }/** What an older client's routing, policy, skill-set or role save answers (project instructions, phase 4). */@@ -1748,6 +1750,34 @@ it('keeps a paused machine paused when its owner saves other settings, until thef.run(save(3), owner, owners)expect(f.state.machines).toEqual([expect.objectContaining({ machineId: 'host', maxAgents: 3, paused: false })])})+describe('saving a machine again', () => {+ const owners = { contribution: { machineOwnerId: 'owner', contributorId: 'owner' } }+ const save = (maxAgents: number): Command => ({ type: 'machine.contribute', machineId: 'host', name: 'Studio', cwd: '/repo', engines: ['claude'], maxAgents })+ it('keeps its Lent hours, engine health and last reading when its owner saves other settings', () => {+ const f = fixture()+ f.run(save(2), owner, owners)+ const week = weekStart(NOW)+ const kept = {+ lent: [{ week, busyMs: 18_000_000 }],+ lentDays: [{ day: week, projectId: 'lead', busyMs: 18_000_000 }],+ engineFailures: { codex: 1 },+ engineSuspensions: { claude: { at: NOW, fine: false } },+ observation: { receivedAt: NOW, runningHarnessIds: ['h1'], stoppedHarnessIds: [] } as never,+ }+ Object.assign(f.state.machines![0]!, structuredClone(kept))+ const lentThisWeek = () => lentIn(f.state.machines![0]!, weekSpan(week), NOW, { projects: new Set(['lead']), unsplit: true })+ expect(lentThisWeek()).toBe(18_000_000)+ f.run(save(3), owner, owners)+ expect(f.state.machines).toEqual([expect.objectContaining({ machineId: 'host', maxAgents: 3, ...kept })])+ expect(lentThisWeek()).toBe(18_000_000)+ })+ it('gives a first-time contribution a clean record', () => {+ const f = fixture()+ f.run(save(2), owner, owners)+ const record = f.state.machines![0]!+ for (const key of ['lent', 'lentDays', 'engineFailures', 'engineSuspensions', 'observation']) expect(record).not.toHaveProperty(key)+ })+})it('restricts recording a legacy project to the owner or controlling lead', () => {const f = fixture(); f.invite()const command: Command = { type: 'tab.project', machineId: 'host', project: { cwd: '/repo', repositoryUrl: null } }diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.tsindex c9809edc6..a18646ee1 100644--- a/backend/src/superTabs/commands.ts+++ b/backend/src/superTabs/commands.ts@@ -1936,7 +1936,13 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,contributorId: actor.userId, membershipGeneration: contributor.generation, generation: operationId, paused,...(host ? { hostMachineId: host } : {}), ...(teamAccountOnly ? { teamAccountOnly: true as const } : {}), ...(projects && !host ? { projects } : {}),...(ownAccountChoice && !host ? { ownAccountChoice } : {}),- ...(othersToldWeek != null ? { othersToldWeek } : {}) })+ ...(othersToldWeek != null ? { othersToldWeek } : {}),+ // What its readings and starts recorded is not a setting: saving the settings keeps the Lent ledger, the engines'+ // failures and suspensions and the last reading (#3043). A machine not listed yet, or Buddy-only, starts clean.+ ...(previous?.lent ? { lent: previous.lent } : {}), ...(previous?.lentDays ? { lentDays: previous.lentDays } : {}),+ ...(previous?.engineFailures ? { engineFailures: previous.engineFailures } : {}),+ ...(previous?.engineSuspensions ? { engineSuspensions: previous.engineSuspensions } : {}),+ ...(previous?.observation ? { observation: previous.observation } : {}) })// A Mac given other slots or a new name gives its team account the same, and its pause; its own folder, engines and grant stay.const added = state.machines.at(-1)!for (const team of teamPoolsOf(state, added)) if (!team.removal) {