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`.
This commit is contained in:
LegGasai committed 2026-11-17 01:14:19 +08:00
1 parent efd4c8e44c
commit c12f7ff609
2 files changed
+4 -2

No files matched your search

@@ -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' })
@@ -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)