From c12f7ff609052b79155cb235fb68f43b2feca8ea Mon Sep 17 00:00:00 2001 From: LegGasai Date: Tue, 17 Nov 2026 01:14:19 +0800 Subject: [PATCH] test(terminal-bash): give Sessions without a header directory the sandbox root as their directory default The sandbox policy bounds a Session by `ctx.workingDirectory.get`. Two tests resolve the policy for a Session that records no directory and expect the configured sandbox root, while their directory fixture defaulted to the launch directory. The fixture now uses the same root, as a deployment that sets the sandbox `workspaceRoot` sets the directory service's `defaultDirectory`. --- packages/terminal/terminal-bash/tests/index.spec.ts | 3 ++- packages/terminal/terminal-bash/tests/local.spec.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/terminal/terminal-bash/tests/index.spec.ts b/packages/terminal/terminal-bash/tests/index.spec.ts index b081aa4fb2..f763114d3d 100644 --- a/packages/terminal/terminal-bash/tests/index.spec.ts +++ b/packages/terminal/terminal-bash/tests/index.spec.ts @@ -257,7 +257,8 @@ describe('BashTerminalBackend startup rollback', () => { it('wraps confined argv, scrubs the environment, and returns initialized sessions', async () => { const ctx = new Context() - provideWorkingDirectoryFixture(ctx) + // The Agent's Session records no directory, so the directory service's default bounds it. + provideWorkingDirectoryFixture(ctx, resolve('/workspace')) await ctx.plugin(RecordingSandbox) await ctx.plugin(SessionProjectionRegistry) await ctx.plugin(SandboxPolicyService, { mode: 'workspace-write', workspaceRoot: '/workspace' }) diff --git a/packages/terminal/terminal-bash/tests/local.spec.ts b/packages/terminal/terminal-bash/tests/local.spec.ts index 2feec7a9a7..227c160052 100644 --- a/packages/terminal/terminal-bash/tests/local.spec.ts +++ b/packages/terminal/terminal-bash/tests/local.spec.ts @@ -61,7 +61,8 @@ async function harness( const root = mkdtempSync(join(tmpdir(), 'dsh-pty-local-')) roots.push(root) const ctx = new Context() - provideWorkingDirectoryFixture(ctx) + // The Agents' Sessions record no directory, so the directory service's default is their workspace. + provideWorkingDirectoryFixture(ctx, root) contexts.push(ctx) await ctx.plugin(SessionProjectionRegistry) await ctx.plugin(AgentRegistry)