Skip to content

The agent that grows with you

chore(evals,desktop): drop literal /tmp from eval harnesses and desktop scripts

teknium1956732d4a8ce
diff --git a/apps/desktop/e2e/group-chat-code-block-and-media.spec.ts b/apps/desktop/e2e/group-chat-code-block-and-media.spec.ts
index c77e747b71d..945e52e913d 100644
--- a/apps/desktop/e2e/group-chat-code-block-and-media.spec.ts
+++ b/apps/desktop/e2e/group-chat-code-block-and-media.spec.ts
@@ -1,4 +1,5 @@
import fs from 'node:fs'
+import os from 'node:os'
import path from 'node:path'
import { type MockBackendFixture, setupMockBackend, waitForAppReady } from './fixtures'
@@ -12,7 +13,7 @@ import { expect, test } from './test'
// a plain path instead of an inline image/player (#93728). Group replies now
// go through the same message renderer as the 1:1 chat.
-const SHOT_DIR = '/tmp/batchbots/panes-layout-cron-tile/shots'
+const SHOT_DIR = path.join(os.tmpdir(), 'batchbots/panes-layout-cron-tile/shots')
// One unbroken 600+ char token: it cannot wrap, so it MUST overflow the
// message column — the probe asserts that overflow exists before asserting
// nothing clips it (a line that fits proves nothing about #91878).
diff --git a/apps/desktop/e2e/group-create-gate-remote-roster.spec.ts b/apps/desktop/e2e/group-create-gate-remote-roster.spec.ts
index 521f7ee0d20..917144f563b 100644
--- a/apps/desktop/e2e/group-create-gate-remote-roster.spec.ts
+++ b/apps/desktop/e2e/group-create-gate-remote-roster.spec.ts
@@ -10,8 +10,11 @@
import { type ChildProcess, spawn, spawnSync } from 'node:child_process'
import * as fs from 'node:fs'
import * as net from 'node:net'
+import * as os from 'node:os'
import * as path from 'node:path'
+import { startMockServer } from '../../../tests-js/scripts/mock-server'
+
import {
buildAppEnv,
createSandbox,
@@ -22,7 +25,6 @@ import {
writeEnvFile,
writeMockProviderConfig,
} from './fixtures'
-import { startMockServer } from '../../../tests-js/scripts/mock-server'
import { type ElectronApplication, expect, type Page, test } from './test'
const DESKTOP_ROOT = path.resolve(import.meta.dirname, '..')
@@ -30,7 +32,7 @@ const REPO_ROOT = path.resolve(DESKTOP_ROOT, '..', '..')
const REMOTE_LABEL = 'Homelab'
const REMOTE_ID = 'homelab'
const REMOTE_TOKEN = 'e2e-group-gate-homelab-token'
-const SHOTS = '/tmp/batchbots/group-identity-members/shots'
+const SHOTS = path.join(os.tmpdir(), 'batchbots/group-identity-members/shots')
interface RemoteGateway {
url: string
diff --git a/apps/desktop/e2e/group-room-member-editing.spec.ts b/apps/desktop/e2e/group-room-member-editing.spec.ts
index 4e0c4931685..2dad2a4213f 100644
--- a/apps/desktop/e2e/group-room-member-editing.spec.ts
+++ b/apps/desktop/e2e/group-room-member-editing.spec.ts
@@ -1,3 +1,6 @@
+import os from 'node:os'
+import path from 'node:path'
+
import { type MockBackendFixture, setupMockBackend, waitForAppReady } from './fixtures'
import { expect, test } from './test'
@@ -8,7 +11,7 @@ import { expect, test } from './test'
// exactly the saved roster — the removed Bot never takes a turn again.
const ROOM = 'Programmer, Reviewer'
-const SHOTS = '/tmp/batchbots/features-groups-ui/shots'
+const SHOTS = path.join(os.tmpdir(), 'batchbots/features-groups-ui/shots')
let fixture: MockBackendFixture | null = null
type Page = MockBackendFixture['page']
diff --git a/apps/desktop/e2e/group-transcript-mentions-reply-to.spec.ts b/apps/desktop/e2e/group-transcript-mentions-reply-to.spec.ts
index a6df70e366a..54225fe50ff 100644
--- a/apps/desktop/e2e/group-transcript-mentions-reply-to.spec.ts
+++ b/apps/desktop/e2e/group-transcript-mentions-reply-to.spec.ts
@@ -1,3 +1,6 @@
+import os from 'node:os'
+import path from 'node:path'
+
import { type MockBackendFixture, setupMockBackend, waitForAppReady } from './fixtures'
import { expect, test } from './test'
@@ -8,7 +11,7 @@ import { expect, test } from './test'
// room composer so the next send routes to that member only.
const ROOM = 'Programmer, Reviewer'
-const SHOTS = '/tmp/batchbots/features-groups-ui/shots'
+const SHOTS = path.join(os.tmpdir(), 'batchbots/features-groups-ui/shots')
let fixture: MockBackendFixture | null = null
type Page = MockBackendFixture['page']
diff --git a/apps/desktop/e2e/group-transcript-owner-meta.spec.ts b/apps/desktop/e2e/group-transcript-owner-meta.spec.ts
index fe03d1eb232..9743890622e 100644
--- a/apps/desktop/e2e/group-transcript-owner-meta.spec.ts
+++ b/apps/desktop/e2e/group-transcript-owner-meta.spec.ts
@@ -1,3 +1,6 @@
+import os from 'node:os'
+import path from 'node:path'
+
import { MOCK_REPLY } from '../../../tests-js/scripts/mock-server'
import { type MockBackendFixture, setupMockBackend, waitForAppReady } from './fixtures'
@@ -13,7 +16,7 @@ import { expect, test } from './test'
const ROOM = 'Ops Room'
const NEW_TITLE = 'Infra Ops'
-const SHOTS = '/tmp/batchbots/group-identity-members/shots'
+const SHOTS = path.join(os.tmpdir(), 'batchbots/group-identity-members/shots')
let fixture: MockBackendFixture | null = null
type Page = MockBackendFixture['page']
diff --git a/apps/desktop/e2e/group-turn-integrity.spec.ts b/apps/desktop/e2e/group-turn-integrity.spec.ts
index 5c3f2670647..439dc21b023 100644
--- a/apps/desktop/e2e/group-turn-integrity.spec.ts
+++ b/apps/desktop/e2e/group-turn-integrity.spec.ts
@@ -1,8 +1,12 @@
+import os from 'node:os'
+import path from 'node:path'
+
import { MOCK_REPLY } from '../../../tests-js/scripts/mock-server'
import { type MockBackendFixture, setupMockBackend, waitForAppReady } from './fixtures'
import { expect, test } from './test'
+const SHOTS = path.join(os.tmpdir(), 'botmode-campaign')
const FIRST_REPLY = 'FIRST_REPLY: initial work completed'
const FOLLOWUP_REPLY = 'FOLLOWUP_REPLY: subsequent work completed'
let fixture: MockBackendFixture | null = null
@@ -83,7 +87,7 @@ test('group follow-up waits for its active member and retains the reply', async
await groupComposer.press('Enter')
await fixture!.mock.waitForHeldCompletion()
console.log('PRODUCTION CLOCK: first inference held; no second submit before provider release.')
- await page.screenshot({ path: '/tmp/botmode-campaign/lane-a-held.png' })
+ await page.screenshot({ path: path.join(SHOTS, 'lane-a-held.png') })
await page.getByRole('button', { name: 'Reply in thread', exact: true }).click()
const replyComposer = page.getByRole('textbox', { name: 'Reply in thread', exact: true })
await replyComposer.fill('@programmer LANE_A_FOLLOWUP')
@@ -110,7 +114,7 @@ test('group follow-up waits for its active member and retains the reply', async
expect(fixture!.mock.receivedPrompts.filter(p => p.includes('LANE_A_FIRST'))).toHaveLength(1)
expect(fixture!.mock.receivedPrompts.filter(p => p.includes('LANE_A_FOLLOWUP'))).toHaveLength(1)
console.log('PRODUCTION CLOCK: released; exact public log', JSON.stringify(log))
- await page.screenshot({ path: '/tmp/botmode-campaign/lane-a-followup-after.png' })
+ await page.screenshot({ path: path.join(SHOTS, 'lane-a-followup-after.png') })
})
test('quiet group still harvests a late answer after sixty observation ticks', async () => {
@@ -150,7 +154,7 @@ test('quiet group still harvests a late answer after sixty observation ticks', a
await page.waitForTimeout(1000)
expect((await publicLog(page)).filter(entry => entry.from === 'programmer').map(entry => entry.text)).toEqual([FIRST_REPLY])
console.log('ACCELERATED DEADLINE/OBSERVATION CLOCK ONLY: exact late public log', JSON.stringify(await publicLog(page)))
- await page.screenshot({ path: '/tmp/botmode-campaign/lane-a-late-after.png' })
+ await page.screenshot({ path: path.join(SHOTS, 'lane-a-late-after.png') })
})
test('a rejected member turn stays visible when the room settles', async () => {
@@ -190,7 +194,7 @@ test('a rejected member turn stays visible when the room settles', async () => {
expect(await page.evaluate(() => (window as any).__rejected)).toBe(1)
expect((await publicLog(page)).filter(entry => entry.from !== 'You')).toEqual([])
await expect(page.getByRole('button', { name: /^Activity/ })).toContainText('Programmer hit an error')
- await page.screenshot({ path: '/tmp/botmode-campaign/lane-a-error-after.png' })
+ await page.screenshot({ path: path.join(SHOTS, 'lane-a-error-after.png') })
// One epoch: A fails, B waits, the user retries A, then B and A fail.
// The retry is explicit and after A's failure, unlike the prequeued sends above.
@@ -231,5 +235,5 @@ test('Stop clears a queued follow-up and a direct mention resumes the held membe
await groupComposer.press('Enter')
await expect.poll(() => fixture!.mock.receivedPrompts.some(p => p.includes('LANE_A_RESUME')), { timeout: 60000 }).toBe(true)
await expect(page.getByText(MOCK_REPLY, { exact: true }).first()).toBeVisible()
- await page.screenshot({ path: '/tmp/botmode-campaign/lane-a-stop-resume.png' })
+ await page.screenshot({ path: path.join(SHOTS, 'lane-a-stop-resume.png') })
})
diff --git a/apps/desktop/scripts/perf/gateway_attach_bench.py b/apps/desktop/scripts/perf/gateway_attach_bench.py
index 3e3c0e24e91..a8b1a87fb2f 100644
--- a/apps/desktop/scripts/perf/gateway_attach_bench.py
+++ b/apps/desktop/scripts/perf/gateway_attach_bench.py
@@ -114,7 +114,7 @@ def main() -> int:
content_b64 = base64.b64encode(png_bytes(args.kb)).decode("ascii")
scratch = home / "scratch.txt"
- scratch.write_text("hello from the bench\n")
+ scratch.write_text("hello from the bench\n", encoding="utf-8")
image_on_disk = home / "on-disk.png"
image_on_disk.write_bytes(png_bytes(args.kb))
@@ -153,7 +153,7 @@ def main() -> int:
),
(
"image.detach",
- lambda sid: {"session_id": sid, "path": "/tmp/nothing.png"},
+ lambda sid: {"session_id": sid, "path": "/nonexistent/nothing.png"},
),
(
"prompt.submit",
diff --git a/apps/desktop/scripts/perf/scenarios/multitab.mjs b/apps/desktop/scripts/perf/scenarios/multitab.mjs
index 9c5662253f1..dcc48bc8112 100644
--- a/apps/desktop/scripts/perf/scenarios/multitab.mjs
+++ b/apps/desktop/scripts/perf/scenarios/multitab.mjs
@@ -148,7 +148,7 @@ const setup = (tiles, seedTurns, streamSeed, zones, seedSessions, streaming, dea
id: 'perf-row-' + i, title: 'Seeded session ' + i, ended_at: null,
input_tokens: 1200, output_tokens: 800, is_active: false,
last_active: Date.now() - i * 60000, message_count: 12,
- model: 'hermes-4', preview: 'seeded row', cwd: '/tmp/proj-' + (i % 7)
+ model: 'hermes-4', preview: 'seeded row', cwd: '/home/perf/proj-' + (i % 7)
})
}
hook.seedSessions(rows)
diff --git a/apps/desktop/scripts/profile-model-picker.mjs b/apps/desktop/scripts/profile-model-picker.mjs
index 26e16d6e7c9..c474d2190a7 100644
--- a/apps/desktop/scripts/profile-model-picker.mjs
+++ b/apps/desktop/scripts/profile-model-picker.mjs
@@ -1,6 +1,8 @@
// CPU-profile one model-picker open.
// node scripts/profile-model-picker.mjs [--port 9222]
import { writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
import { CDP } from './perf/lib/cdp.mjs'
import { cpuProfileTopSelf } from './perf/lib/stats.mjs'
@@ -46,7 +48,7 @@ const openMs = await cdp.eval(OPEN)
const { profile } = await cdp.send('Profiler.stop')
console.log('openMs:', Math.round(openMs))
-const out = `/tmp/model-picker-open.cpuprofile`
+const out = join(tmpdir(), 'model-picker-open.cpuprofile')
writeFileSync(out, JSON.stringify(profile))
console.log('wrote', out)
console.log('top self-time (ms):')
diff --git a/apps/desktop/src/app/chat/short-session-hang-repro.tsx b/apps/desktop/src/app/chat/short-session-hang-repro.tsx
index af75555869f..c27ecb9cbfe 100644
--- a/apps/desktop/src/app/chat/short-session-hang-repro.tsx
+++ b/apps/desktop/src/app/chat/short-session-hang-repro.tsx
@@ -83,8 +83,8 @@ const fixtures: FixtureTurn[] = [
]),
turn(3, 'tools', [
{
- args: { path: '/tmp/hermes-short-session-fixture.txt' },
- argsText: '{"path":"/tmp/hermes-short-session-fixture.txt"}',
+ args: { path: '~/hermes-short-session-fixture.txt' },
+ argsText: '{"path":"~/hermes-short-session-fixture.txt"}',
result: { content: 'deterministic fixture output', ok: true },
toolCallId: 'short-session-tool-3',
toolName: 'read_file',
@@ -122,8 +122,8 @@ const fixtures: FixtureTurn[] = [
turn(8, 'mixed', [
text('Mixed response eight is the final checkpoint. `inline code` and **markdown** remain interactive.'),
{
- args: { path: '/tmp' },
- argsText: '{"path":"/tmp"}',
+ args: { path: '~' },
+ argsText: '{"path":"~"}',
result: { entries: ['hermes-short-session-fixture.txt'], ok: true },
toolCallId: 'short-session-tool-8',
toolName: 'list_directory',
diff --git a/evals/botmode-dm-delivery/probe-cron-root.spec.ts b/evals/botmode-dm-delivery/probe-cron-root.spec.ts
index d9a9757e329..b3de7c63617 100644
--- a/evals/botmode-dm-delivery/probe-cron-root.spec.ts
+++ b/evals/botmode-dm-delivery/probe-cron-root.spec.ts
@@ -1,5 +1,6 @@
import { execFileSync, spawn } from 'node:child_process'
import fs from 'node:fs'
+import os from 'node:os'
import path from 'node:path'
import { buildAppEnv, createSandbox, launchDesktop, waitForAppReady, writeEnvFile, writeMockProviderConfig, type MockBackendFixture } from './fixtures'
import { MOCK_REPLY, startMockServer } from '../../../tests-js/scripts/mock-server'
@@ -7,7 +8,7 @@ import { expect, test } from './test'
const repo = path.resolve(import.meta.dirname, '../../..')
const python = path.join(process.env.VIRTUAL_ENV || path.join(repo, '.venv'), 'bin', 'python')
-const evidence = process.env.BOT_DM_EVIDENCE || '/tmp/botmode-cron-root/native'
+const evidence = process.env.BOT_DM_EVIDENCE || path.join(os.tmpdir(), 'botmode-cron-root/native')
let fixture: MockBackendFixture
let env: Record<string, string>
diff --git a/evals/botmode-dm-delivery/probe-dm-delivery.spec.ts b/evals/botmode-dm-delivery/probe-dm-delivery.spec.ts
index 6b57e5a0273..f291ca23ed1 100644
--- a/evals/botmode-dm-delivery/probe-dm-delivery.spec.ts
+++ b/evals/botmode-dm-delivery/probe-dm-delivery.spec.ts
@@ -1,5 +1,6 @@
import { execFileSync, spawn } from 'node:child_process'
import fs from 'node:fs'
+import os from 'node:os'
import path from 'node:path'
import { buildAppEnv, createSandbox, launchDesktop, waitForAppReady, writeEnvFile, writeMockProviderConfig, type MockBackendFixture } from './fixtures'
import { MOCK_REPLY, startMockServer } from '../../../tests-js/scripts/mock-server'
@@ -9,7 +10,7 @@ const repo = path.resolve(import.meta.dirname, '../../..')
const python = path.join(process.env.VIRTUAL_ENV || path.join(repo, '.venv'), 'bin', 'python')
let fixture: MockBackendFixture
let env: Record<string, string>
-const evidence = process.env.BOT_DM_EVIDENCE || '/tmp/botmode-dm-review/native'
+const evidence = process.env.BOT_DM_EVIDENCE || path.join(os.tmpdir(), 'botmode-dm-review/native')
test.beforeAll(async () => {
fs.mkdirSync(evidence, { recursive: true })
diff --git a/evals/botmode-dm-matrix/probe-dm-matrix.spec.ts b/evals/botmode-dm-matrix/probe-dm-matrix.spec.ts
index af2ce2ac856..58698e21b0f 100644
--- a/evals/botmode-dm-matrix/probe-dm-matrix.spec.ts
+++ b/evals/botmode-dm-matrix/probe-dm-matrix.spec.ts
@@ -1,5 +1,6 @@
import { execFileSync, spawn } from 'node:child_process'
import fs from 'node:fs'
+import os from 'node:os'
import path from 'node:path'
import { buildAppEnv, createSandbox, launchDesktop, waitForAppReady, writeEnvFile, writeMockProviderConfig, type MockBackendFixture } from './fixtures'
import { MOCK_REPLY, startMockServer } from '../../../tests-js/scripts/mock-server'
@@ -9,7 +10,7 @@ const repo = path.resolve(import.meta.dirname, '../../..')
let python = path.join(process.env.VIRTUAL_ENV || path.join(repo, '.venv'), 'bin', 'python')
let fixture: MockBackendFixture
let env: Record<string, string>
-const evidence = process.env.BOT_DM_EVIDENCE || '/tmp/botmode-dm-matrix/native'
+const evidence = process.env.BOT_DM_EVIDENCE || path.join(os.tmpdir(), 'botmode-dm-matrix/native')
test.beforeAll(async () => {
fs.mkdirSync(evidence, { recursive: true })
diff --git a/evals/browser_use/orchestrate.py b/evals/browser_use/orchestrate.py
index b78f9c0a60d..efb3ebcb807 100644
--- a/evals/browser_use/orchestrate.py
+++ b/evals/browser_use/orchestrate.py
@@ -6,7 +6,7 @@ battery continues where it left off (same pattern as evals/toolperf_abeval).
Usage:
# start a headless Chrome first:
# google-chrome --headless=new --remote-debugging-port=9333 \
- # --user-data-dir=/tmp/bubench-chrome --no-first-run --disable-gpu about:blank
+ # --user-data-dir="$TMPDIR/bubench-chrome" --no-first-run --disable-gpu about:blank
BUBENCH_BASE_TREE=... BUBENCH_PR_TREE=... BENCH_CDP_URL=http://127.0.0.1:9333 \
python3 orchestrate.py [--tasks tasks/hard.json] [--models m1,m2] \
[--arms base,pr,prns] [--reps 3]
diff --git a/evals/delegation_group_schema/probe.py b/evals/delegation_group_schema/probe.py
index ba79fe54d5f..11bb1829fd3 100644
--- a/evals/delegation_group_schema/probe.py
+++ b/evals/delegation_group_schema/probe.py
@@ -1,6 +1,6 @@
"""Offline same-config schema probe. Run in a fresh interpreter for each tree/policy.
-python probe.py /path/to/tree /tmp/receipt.json [--independent]
+python probe.py /path/to/tree receipt.json [--independent]
Requires tiktoken; no model calls or model-quality claims.
"""
diff --git a/evals/heartbeat_idle_wire.py b/evals/heartbeat_idle_wire.py
index 8369dd5ad97..d1d97f00c73 100644
--- a/evals/heartbeat_idle_wire.py
+++ b/evals/heartbeat_idle_wire.py
@@ -2,7 +2,7 @@
Run from the repo with a clean environment and a temporary HERMES_HOME:
.venv/bin/python evals/heartbeat_idle_wire.py
-Pass --base-poller /tmp/run_goals_base.py to compare the old poller. No network.
+Pass --base-poller <path>/run_goals_base.py to compare the old poller. No network.
"""
import argparse
diff --git a/evals/memory/honcho_current_query.py b/evals/memory/honcho_current_query.py
index ec38c912944..ecd935a5b64 100644
--- a/evals/memory/honcho_current_query.py
+++ b/evals/memory/honcho_current_query.py
@@ -1,7 +1,7 @@
"""Honcho 2.2 SDK/local HTTP lifecycle probe; no hosted service or model inference.
Run with isolated HOME/HERMES_HOME and honcho-ai==2.2.0 installed (or on PYTHONPATH):
- .venv/bin/python evals/memory/honcho_current_query.py --out /tmp/honcho-proof.json
+ .venv/bin/python evals/memory/honcho_current_query.py --out honcho-proof.json
Prepared ongoing sessions bypass startup/migration. Message writes are disabled.
The fixture proves query routing, ownership and caller waiting, not memory quality.
"""
@@ -196,7 +196,7 @@ proof["checks"] = {"alignment": True, "default_unchanged": True, "single_flight"
"empty_omitted": True, "cadence_gap_empty": True, "no_duplicate_end_turn": True}
proof["events"] = events
args.out.parent.mkdir(parents=True, exist_ok=True)
-args.out.write_text(json.dumps(proof, indent=2))
+args.out.write_text(json.dumps(proof, indent=2), encoding="utf-8")
print(json.dumps({"checks": proof["checks"], "out": str(args.out),
"current_elapsed": [row["elapsed"] for row in rows],
"timeout_elapsed": blocked["elapsed"]}, indent=2))
diff --git a/evals/native_compaction/ab_checkpoint_preflight.py b/evals/native_compaction/ab_checkpoint_preflight.py
index dd178293794..d698994e54e 100644
--- a/evals/native_compaction/ab_checkpoint_preflight.py
+++ b/evals/native_compaction/ab_checkpoint_preflight.py
@@ -21,7 +21,7 @@ Scenarios (all deterministic, no network beyond 127.0.0.1):
Usage (from a checkout root, venv python)::
- python evals/native_compaction/ab_checkpoint_preflight.py --out /tmp/result.json
+ python evals/native_compaction/ab_checkpoint_preflight.py --out result.json
"""
from __future__ import annotations
@@ -245,7 +245,7 @@ def main() -> int:
(tmp / "home").mkdir(parents=True)
import subprocess
- head = subprocess.run(["git", "rev-parse", "HEAD"], cwd=ROOT, capture_output=True, text=True).stdout.strip()
+ head = subprocess.run(["git", "rev-parse", "HEAD"], cwd=ROOT, capture_output=True, text=True, encoding="utf-8", errors="replace").stdout.strip()
wire = _FakeResponses()
try:
result = {
diff --git a/evals/postmortem/live_ab/cache_concurrency_probe.py b/evals/postmortem/live_ab/cache_concurrency_probe.py
index a12ecebc5fa..f95997a0394 100644
--- a/evals/postmortem/live_ab/cache_concurrency_probe.py
+++ b/evals/postmortem/live_ab/cache_concurrency_probe.py
@@ -21,7 +21,7 @@ Fable 5.1, 20 sessions x 6 calls unless noted):
Usage:
python -m evals.postmortem.live_ab.cache_concurrency_probe --repo . --provider nous \
- --workers 20 --calls 6 --out /tmp/probe.jsonl [--wire chat|native] [--model ID] \
+ --workers 20 --calls 6 --out probe.jsonl [--wire chat|native] [--model ID] \
[--pin anthropic] [--settle 2] [--ttl 5m]
providers: nous (Portal creds from HERMES_HOME), openrouter (OPENROUTER_API_KEY or --api-key),
anthropic (ANTHROPIC_API_KEY or --api-key)
diff --git a/evals/postmortem/live_ab/cache_prefix_live.py b/evals/postmortem/live_ab/cache_prefix_live.py
index e5e35543023..cd64b8d530c 100644
--- a/evals/postmortem/live_ab/cache_prefix_live.py
+++ b/evals/postmortem/live_ab/cache_prefix_live.py
@@ -2,7 +2,7 @@
Fable 5.1 via Nous and prints per-call cache hit ratios from agent.log. ~10 calls, well under $1.
Arm A = current code. Arm B = HERMES_KEEP_ALL_THINKING=1 monkeypatch of _manage_thinking_signatures
that passes thinking blocks back unchanged for the Nous/Anthropic route."""
-import os, sys, re, time, subprocess, json
+import os, sys, re, tempfile, time, subprocess, json
# LIVE: real provider calls (cents). Usage: python cache_prefix_live.py <repo_root> <A|B>
os.environ.setdefault("HERMES_HOME", os.path.expanduser("~/.hermes"))
sys.path.insert(0, sys.argv[1])
@@ -31,9 +31,10 @@ ag = AIAgent(model="anthropic/claude-fable-5.1", provider="nous", base_url=rt.ge
api_mode=rt.get("api_mode"), session_id=sid, quiet_mode=True,
enabled_toolsets=["file", "terminal"], platform="cli", max_iterations=12,
skip_context_files=True, skip_memory=True, reasoning_config={"enabled": True, "effort": "medium"})
-task = ("In /tmp/f0ab_work (create it), do these steps ONE tool call at a time, no parallel calls: "
+work = os.path.join(tempfile.gettempdir(), "f0ab_work")
+task = (f"In {work} (create it), do these steps ONE tool call at a time, no parallel calls: "
"1) write a.txt with 'alpha', 2) write b.txt with 'beta', 3) read a.txt, 4) read b.txt, "
- "5) run `ls -la /tmp/f0ab_work`, 6) run `wc -c /tmp/f0ab_work/*`, 7) run `cat /tmp/f0ab_work/a.txt`, "
+ f"5) run `ls -la {work}`, 6) run `wc -c {work}/*`, 7) run `cat {work}/a.txt`, "
"then reply with one line: DONE.")
t0 = time.time()
r = ag.run_conversation(task)
diff --git a/evals/postmortem/live_ab/cache_prefix_wire.py b/evals/postmortem/live_ab/cache_prefix_wire.py
index 127350eab54..9415efb3c1a 100644
--- a/evals/postmortem/live_ab/cache_prefix_wire.py
+++ b/evals/postmortem/live_ab/cache_prefix_wire.py
@@ -2,7 +2,7 @@
message prefix between call N and N+1. If Hermes strips prior-turn thinking, call N+1's messages[:k]
will NOT equal call N's messages (prefix divergence) even though the conversation only grew.
Also reports cache hit per call. Cost: a handful of calls."""
-import os, sys, re, time, json, copy, subprocess
+import os, sys, re, tempfile, time, json, copy, subprocess
# LIVE: makes ~6 real calls to the configured provider (a few cents). Usage:
# python cache_prefix_wire.py <repo_root> <A|B> [--hermes-home DIR] (default HERMES_HOME: the real one, for credentials)
sys.path.insert(0, sys.argv[1])
@@ -50,9 +50,10 @@ ag = AIAgent(model="anthropic/claude-fable-5.1", provider="nous", base_url=rt.ge
api_mode=rt.get("api_mode"), session_id=sid, quiet_mode=True, enabled_toolsets=["file", "terminal"],
platform="cli", max_iterations=10, skip_context_files=True, skip_memory=True,
reasoning_config={"enabled": True, "effort": "medium"})
-task = ("Work in /tmp/f0wire (create it). Before EACH tool call, think carefully for a moment about edge cases. "
+work = os.path.join(tempfile.gettempdir(), "f0wire")
+task = (f"Work in {work} (create it). Before EACH tool call, think carefully for a moment about edge cases. "
"Steps, one tool call each: 1) write notes.md with a 5-line summary of what a Python context manager is; "
- "2) read it back; 3) run `wc -l /tmp/f0wire/notes.md`; 4) append one more line to notes.md explaining __exit__ return values; "
+ f"2) read it back; 3) run `wc -l {work}/notes.md`; 4) append one more line to notes.md explaining __exit__ return values; "
"5) read it back; then reply DONE.")
ag.run_conversation(task)
time.sleep(1)
diff --git a/evals/postmortem/review_probes/goal_repaste_probe.py b/evals/postmortem/review_probes/goal_repaste_probe.py
index 8614b8cbc59..1f1242a9488 100644
--- a/evals/postmortem/review_probes/goal_repaste_probe.py
+++ b/evals/postmortem/review_probes/goal_repaste_probe.py
@@ -16,6 +16,7 @@ import socket
import sqlite3
import sys
import tempfile
+import tempfile
import threading
from unittest.mock import patch
@@ -44,7 +45,8 @@ assert str(Path(goals.__file__).resolve()).startswith(repo)
server._hermes_home = Path(home.name)
goals._DB_CACHE.clear()
goals._get_session_db()
-source = sqlite3.connect('file:/tmp/rf/state_copy.db?mode=ro', uri=True)
+source_db = os.environ.get('RF_STATE_COPY') or str(Path(tempfile.gettempdir()) / 'rf' / 'state_copy.db')
+source = sqlite3.connect(f'file:{source_db}?mode=ro', uri=True)
source.row_factory = sqlite3.Row
original = source.execute('SELECT content FROM messages WHERE id=264820').fetchone()['content']
repeated = source.execute('SELECT content FROM messages WHERE id=267045').fetchone()['content']
diff --git a/evals/providers/reasoning_shapes.py b/evals/providers/reasoning_shapes.py
index 7d9851e4b81..02f220ac5ba 100644
--- a/evals/providers/reasoning_shapes.py
+++ b/evals/providers/reasoning_shapes.py
@@ -1,6 +1,6 @@
"""Local HTTP/SDK reasoning-shape probe; no vendor inference or credentials.
-Run: python evals/providers/reasoning_shapes.py --output /tmp/reasoning.json
+Run: python evals/providers/reasoning_shapes.py --output reasoning.json
Run the same file in a fresh interpreter on base and fix checkouts for A/B.
"""
from __future__ import annotations
diff --git a/evals/readtool/fixtures.py b/evals/readtool/fixtures.py
index bdb1f6ff0c4..6927639f1d9 100644
--- a/evals/readtool/fixtures.py
+++ b/evals/readtool/fixtures.py
@@ -12,6 +12,7 @@ from __future__ import annotations
import os
import random
+import tempfile
import unicodedata
from pathlib import Path
@@ -222,6 +223,6 @@ def _make_fifo(root: Path) -> None:
if __name__ == "__main__":
import sys
- target = sys.argv[1] if len(sys.argv) > 1 else "/tmp/readtool-ws"
+ target = sys.argv[1] if len(sys.argv) > 1 else os.path.join(tempfile.gettempdir(), "readtool-ws")
p = build_workspace(target)
print(f"workspace built at {p}")
diff --git a/evals/subagent_process_handoff/stress_handoff_live.py b/evals/subagent_process_handoff/stress_handoff_live.py
index e833d9c7476..2792c2a2809 100644
--- a/evals/subagent_process_handoff/stress_handoff_live.py
+++ b/evals/subagent_process_handoff/stress_handoff_live.py
@@ -9,6 +9,7 @@ import json
import os
import re
import sys
+import tempfile
import time
WORKTREE = os.environ["HERMES_WORKTREE"]
@@ -20,7 +21,7 @@ import tools.async_delegation as ad # noqa: E402
from run_agent import AIAgent # noqa: E402
MODEL = os.environ.get("LIVE_MODEL", "openai/gpt-5.6-terra")
-OUT = os.environ.get("STRESS_OUT", "/tmp/stress_handoff_results.jsonl")
+OUT = os.environ.get("STRESS_OUT", os.path.join(tempfile.gettempdir(), "stress_handoff_results.jsonl"))
def run_scenario(name, parent_prompt, *, wait_for_completions=0, timeout=420, max_iter=12, second_turn=None):
diff --git a/evals/token_accounting/ab_image_cost_calibration.py b/evals/token_accounting/ab_image_cost_calibration.py
index 080c32f4aee..36750cbf3ac 100644
--- a/evals/token_accounting/ab_image_cost_calibration.py
+++ b/evals/token_accounting/ab_image_cost_calibration.py
@@ -7,7 +7,7 @@ screenshot per turn on a small window; the question is whether compaction fires
prompt crosses the provider window (the fake returns a context-overflow 400 past it, like
llama.cpp), and what the estimator believes when it does.
- python evals/token_accounting/ab_image_cost_calibration.py --out /tmp/result.json
+ python evals/token_accounting/ab_image_cost_calibration.py --out result.json
"""
from __future__ import annotations
@@ -157,7 +157,7 @@ def run(out_path: str) -> dict:
tail = walk_history[cut:]
tail_real = _count_images(tail) * IMAGE_REAL + len(tail) * TEXT_PER_TURN // 2
result = {
- "head": subprocess.run(["git", "rev-parse", "HEAD"], cwd=ROOT, capture_output=True, text=True).stdout.strip(),
+ "head": subprocess.run(["git", "rev-parse", "HEAD"], cwd=ROOT, capture_output=True, text=True, encoding="utf-8", errors="replace").stdout.strip(),
"image_real_cost": IMAGE_REAL, "context_length": CONTEXT_LENGTH, "threshold": THRESHOLD,
"learned_image_cost_after": learned_image_token_cost("vision-local-ab", wire.base_url),
"provider_overflows": wire.overflows, "compress_calls": compress_calls, "per_turn": per_turn,
diff --git a/evals/token_accounting/replay_gates.py b/evals/token_accounting/replay_gates.py
index 277da9f9b22..66fa6a42d46 100644
--- a/evals/token_accounting/replay_gates.py
+++ b/evals/token_accounting/replay_gates.py
@@ -26,7 +26,7 @@ Scenarios per shape:
Usage (from a checkout root, venv python)::
- python evals/token_accounting/replay_gates.py --out /tmp/result.json
+ python evals/token_accounting/replay_gates.py --out result.json
"""
from __future__ import annotations
@@ -276,7 +276,7 @@ def main() -> int:
tmp = Path(tempfile.mkdtemp(prefix="ab-token-accounting-"))
os.environ["HERMES_HOME"] = str(tmp / "home")
(tmp / "home").mkdir(parents=True)
- head = subprocess.run(["git", "rev-parse", "HEAD"], cwd=ROOT, capture_output=True, text=True).stdout.strip()
+ head = subprocess.run(["git", "rev-parse", "HEAD"], cwd=ROOT, capture_output=True, text=True, encoding="utf-8", errors="replace").stdout.strip()
wire = _FakeChat()
result: dict = {"checkout": str(ROOT), "head": head,
"compressor_sha256": hashlib.sha256(
diff --git a/evals/tool_search/tool_search_livetest.py b/evals/tool_search/tool_search_livetest.py
index 13157015e99..166ef0a8439 100644
--- a/evals/tool_search/tool_search_livetest.py
+++ b/evals/tool_search/tool_search_livetest.py
@@ -32,6 +32,9 @@ import traceback
from pathlib import Path
from typing import Any, Dict, List, Tuple
+# Scenario D reads this file back; lives in the temp dir, never a hard-coded /tmp.
+FIXTURE_NOTES = Path(tempfile.gettempdir()) / "livetest" / "notes.txt"
+
# Force-isolate the test environment BEFORE any hermes imports.
ORIGINAL_HOME = os.environ.get("HERMES_HOME")
ORIGINAL_AUTH = Path.home() / ".hermes" / "auth.json"
@@ -228,7 +231,7 @@ SCENARIOS: List[Dict[str, Any]] = [
"id": "D_core_plus_deferred",
"description": "Task uses BOTH a core tool (read_file) and a deferred tool",
"prompt": (
- "Read the file at /tmp/livetest/notes.txt (it exists, just read it) "
+ f"Read the file at {FIXTURE_NOTES} (it exists, just read it) "
"and then post its contents to the #random Slack channel. Tell me you're done."
),
"expected_underlying_tools": ["read_file", "slack_send_message"],
@@ -360,8 +363,8 @@ def run_one_scenario(scenario: Dict[str, Any], enabled: bool, out_dir: Path) ->
os.environ["HERMES_HOME"] = str(home)
# Pre-create the test file used by scenario D.
- Path("/tmp/livetest").mkdir(exist_ok=True)
- Path("/tmp/livetest/notes.txt").write_text("Hello from the test fixture.\n", encoding="utf-8")
+ FIXTURE_NOTES.parent.mkdir(parents=True, exist_ok=True)
+ FIXTURE_NOTES.write_text("Hello from the test fixture.\n", encoding="utf-8")
n_registered = register_fake_tools()
diff --git a/evals/tool_search/tool_search_livetest2.py b/evals/tool_search/tool_search_livetest2.py
index 94cf5ea8965..a3d0a27b8c0 100644
--- a/evals/tool_search/tool_search_livetest2.py
+++ b/evals/tool_search/tool_search_livetest2.py
@@ -64,8 +64,8 @@ def run_one(scenario: Dict[str, Any], mode: str, rep: int, out_dir: Path) -> Dic
base.reset_module_state()
n_registered = base.register_fake_tools()
- Path("/tmp/livetest").mkdir(exist_ok=True)
- (Path("/tmp/livetest/notes.txt")).write_text("Hello from the test fixture.\n", encoding="utf-8")
+ base.FIXTURE_NOTES.parent.mkdir(parents=True, exist_ok=True)
+ base.FIXTURE_NOTES.write_text("Hello from the test fixture.\n", encoding="utf-8")
from tools.registry import registry
original_dispatch = registry.dispatch
diff --git a/evals/tool_search/tool_search_livetest_ue.py b/evals/tool_search/tool_search_livetest_ue.py
index 65870c83e59..e0ea8a1aecd 100644
--- a/evals/tool_search/tool_search_livetest_ue.py
+++ b/evals/tool_search/tool_search_livetest_ue.py
@@ -18,7 +18,7 @@ Env: TS_BENCH_REPS (default 2), TS_UE_MODES, TS_UE_SCALE, TS_UE_SUMMARY.
"""
from __future__ import annotations
-import json, os, re, shutil, sys, time, traceback
+import json, os, re, shutil, sys, tempfile, time, traceback
from pathlib import Path
from typing import Any, Dict, List
@@ -29,7 +29,7 @@ sys.path.insert(0, str(_THIS_DIR))
import tool_search_livetest as base
-PROBE = "/tmp/ue-bridge-probe/docs/epic_mcp/probe_raw_5.8.0_alltoolsets.json"
+PROBE = os.environ.get("UE_BRIDGE_PROBE", os.path.join(tempfile.gettempdir(), "ue-bridge-probe/docs/epic_mcp/probe_raw_5.8.0_alltoolsets.json"))
N_REPS = int(os.environ.get("TS_BENCH_REPS", "2"))
EDITOR_TOOLSETS = (
@@ -49,7 +49,7 @@ def _mock_result(tool_name: str) -> str:
return json.dumps({"result": [{"name": "Cube_1", "path": "/Game/Level:PersistentLevel.Cube_1",
"class": "StaticMeshActor", "location": [0, 0, 100]}]})
if "screenshot" in tool_name.lower() or "capture" in tool_name.lower():
- return json.dumps({"result": {"image_path": "/tmp/ue_viewport_0001.png", "width": 1280, "height": 720}})
+ return json.dumps({"result": {"image_path": "/nonexistent/ue_viewport_0001.png", "width": 1280, "height": 720}})
return json.dumps({"result": {"ok": True, "op": short, "actor": "/Game/Level:PersistentLevel.Cube_1"}})
diff --git a/evals/tool_search/tool_search_livetest_ue_hard.py b/evals/tool_search/tool_search_livetest_ue_hard.py
index 7d45b09a0d9..ddecc4be85e 100644
--- a/evals/tool_search/tool_search_livetest_ue_hard.py
+++ b/evals/tool_search/tool_search_livetest_ue_hard.py
@@ -115,7 +115,7 @@ def make_mock(sanitized_name: str):
if any(v in n for v in ("get", "list", "find", "search", "has_", "is_", "can_")):
return json.dumps({"result": [{"name": "Entry_0", "value": 1.0}]})
if "capture" in n or "screenshot" in n:
- return json.dumps({"result": {"image_path": "/tmp/ue_capture_0001.png"}})
+ return json.dumps({"result": {"image_path": "/nonexistent/ue_capture_0001.png"}})
return json.dumps({"result": {"ok": True}})
return _h
diff --git a/evals/update_pipeline/post_swap_handoff_ab.sh b/evals/update_pipeline/post_swap_handoff_ab.sh
index 1e7606d5161..887cfc45caa 100755
--- a/evals/update_pipeline/post_swap_handoff_ab.sh
+++ b/evals/update_pipeline/post_swap_handoff_ab.sh
@@ -16,7 +16,7 @@
# on PATH (skips Node/web/Desktop work) and --no-gateway-restart (never touches your fleet).
set -euo pipefail
REPO=$1; SHA=$2; LABEL=$3
-ROOT=$(mktemp -d /tmp/hermes-post-swap-ab.XXXXXX)
+ROOT=$(mktemp -d -t hermes-post-swap-ab.XXXXXX)
echo "== [$LABEL] scratch: $ROOT (installed at ${SHA:0:10})"
git clone -q --bare --shared "$REPO" "$ROOT/origin.git"
git --git-dir="$ROOT/origin.git" update-ref refs/heads/main "$SHA"