Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
390 changes: 390 additions & 0 deletions layers/registry/server/data/skill-demos.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion scripts/lib/demo-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export async function runDemoAgent(input: { command: string, args: string[], cwd
const stderrLog = createWriteStream(join(input.cwd, 'codex-stderr.log'))
const execution = run(input.command, input.args, {
cwd: input.cwd,
env: input.env,
// Shell heredocs and renderers must keep temporary files in the writable sandbox.
env: { ...input.env, TMPDIR: input.cwd },
timeout: input.timeout,
maxBuffer: 64 * 1024 * 1024,
})
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/demo-agent-tmp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'

const folder = await mkdtemp(join(tmpdir(), 'shell-temp-'))
process.stdout.write(folder)
await rm(folder, { recursive: true })
10 changes: 10 additions & 0 deletions test/unit/demo-agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@ describe('runDemoAgent', () => {
expect(result.stdout).toBe('input closed')
})
})

describe('agent temporary files', () => {
it('creates temporary files inside the writable recording folder', async () => {
const cwd = await mkdtemp(join(tmpdir(), 'demo-agent-test-'))
const fixture = fileURLToPath(new URL('../fixtures/demo-agent-tmp.ts', import.meta.url))
const result = await runDemoAgent({ command: process.execPath, args: [fixture], cwd, env: { ...process.env, TMPDIR: tmpdir() }, timeout: 2000 })
.finally(() => rm(cwd, { recursive: true }))
expect(result.stdout.startsWith(join(cwd, 'shell-temp-'))).toBe(true)
})
})
Loading