Multiplayer agent harness for work.
Use the request timezone for Claude limit notices (#2144)
Regan Bell3477b83388ff
diff --git a/src/core/orchestrator.ts b/src/core/orchestrator.tsindex 203c9564c..e63f8b1e5 100644--- a/src/core/orchestrator.ts+++ b/src/core/orchestrator.ts@@ -3641,6 +3641,7 @@ export function createOrchestrator(deps: OrchestratorDeps): Orchestrator {};return deps.harness.turns.runTurn({session,+ ...(turnTimezone ? { timezone: turnTimezone } : {}),prepareSteer: async (text, request) => {const refreshedInbox =input.surface === "web" &&diff --git a/src/harness/claude-harness.ts b/src/harness/claude-harness.tsindex cab73bd18..cdd42f95f 100644--- a/src/harness/claude-harness.ts+++ b/src/harness/claude-harness.ts@@ -443,10 +443,15 @@ export function createClaudeHarness(opts: ClaudeHarnessOptions = {}): Harness {options: {abortController: controller,cwd: jail,- env: perUserClaudeEnv(- claudeChildEnv(authEnv ? { ...opts.env, ...authEnv } : (opts.env ?? {}), jail),- turn.claudeOauthToken,- ),+ env: {+ ...perUserClaudeEnv(+ claudeChildEnv(authEnv ? { ...opts.env, ...authEnv } : (opts.env ?? {}), jail),+ turn.claudeOauthToken,+ ),+ ...(turn.timezone+ ? { TZ: new Intl.DateTimeFormat("en-US", { timeZone: turn.timezone }).resolvedOptions().timeZone }+ : {}),+ },tools: allowSubagents ? ["Agent"] : [],skills: [],settingSources: [],diff --git a/src/harness/harness.ts b/src/harness/harness.tsindex 941605f78..c573742cb 100644--- a/src/harness/harness.ts+++ b/src/harness/harness.ts@@ -109,6 +109,7 @@ export interface HarnessTurnInput {triggerTs?: string;entryTs?: string;environment?: string;+ timezone?: string;priorTurns?: ConversationTurn[];overheard?: OverheardEntryPayload[];attachments?: AttachmentMeta[];diff --git a/test/claude-harness-turn.test.ts b/test/claude-harness-turn.test.tsindex a473eafba..1ed59b209 100644--- a/test/claude-harness-turn.test.ts+++ b/test/claude-harness-turn.test.ts@@ -1,4 +1,5 @@import { readFile } from "node:fs/promises";+import { execFileSync } from "node:child_process";import { test, mock } from "node:test";import assert from "node:assert/strict";import { createMemoryRunSignalStore } from "../src/runs/run-signal-store.ts";@@ -116,6 +117,36 @@ function harnessTurn(overrides: Partial<HarnessTurnInput> = {}): {return { turn, entries, modelCalls, llmRequests };}+test("Claude notices use each turn's timezone without leaking it into later turns", async () => {+ currentScript = async function* (prompts) {+ await prompts[Symbol.asyncIterator]().next();+ yield resultMessage("done");+ };+ const harness = createClaudeHarness({});+ for (const [timezone, summer, winter] of [+ ["America/Los_Angeles", 14, 13],+ ["america/los_angeles", 14, 13],+ ["Asia/Kolkata", 2, 2],+ ] as const) {+ await harness.turns.runTurn(harnessTurn({ timezone }).turn);+ const env = capturedOptions.env as NodeJS.ProcessEnv;+ const actual = JSON.parse(+ execFileSync(+ process.execPath,+ [+ "-e",+ 'process.stdout.write(JSON.stringify({ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, hours: ["2026-10-09T21:00:00Z", "2026-12-09T21:00:00Z"].map(value => new Date(value).getHours()) }))',+ ],+ { env, encoding: "utf8" },+ ),+ );+ assert.equal(env.TZ, new Intl.DateTimeFormat("en-US", { timeZone: timezone }).resolvedOptions().timeZone);+ assert.deepEqual(actual.hours, [summer, winter]);+ }+ await harness.turns.runTurn(harnessTurn().turn);+ assert.equal((capturedOptions.env as NodeJS.ProcessEnv).TZ, undefined);+});+test("a steered turn persists every reply, not only the last result's", async () => {const signals = createMemoryRunSignalStore();const runId = "run-steer";