chat: honor the per-session cwd for Super Admin (was hardcoded to home)

claude-manager pinned the spawn cwd to HOST_HOME for Super Admin, ignoring the
cwd passed from the chat handler — so /chat sessions ran in /home/pastilhas
regardless. Now it uses params.cwd when provided (falling back to HOST_HOME),
so /chat actually runs from the dedicated claude_sessions directory.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-24 10:04:17 +00:00
co-authored by Claude Opus 4.8
parent add5351dc7
commit bea3d0a487
2 changed files with 7 additions and 2 deletions
+6 -2
View File
@@ -76,7 +76,9 @@ export async function spawnClaude(params: ClaudeSpawnParams): Promise<ClaudeCode
}
const spawnCmd = isSuperAdmin ? claudeArgs : [...buildSandboxArgs(email), ...claudeArgs];
const spawnCwd = isSuperAdmin ? HOST_HOME : undefined;
// Honor a caller-provided working directory (e.g. /chat runs from a dedicated claude_sessions dir);
// fall back to the host home for Super Admin, or the sandbox default otherwise.
const spawnCwd = isSuperAdmin ? (params.cwd ?? HOST_HOME) : undefined;
const proc = Bun.spawn(spawnCmd, {
stdin: 'pipe',
@@ -173,7 +175,9 @@ export async function spawnClaudeStreaming(
}
const spawnCmd = isSuperAdmin ? claudeArgs : [...buildSandboxArgs(email), ...claudeArgs];
const spawnCwd = isSuperAdmin ? HOST_HOME : undefined;
// Honor a caller-provided working directory (e.g. /chat runs from a dedicated claude_sessions dir);
// fall back to the host home for Super Admin, or the sandbox default otherwise.
const spawnCwd = isSuperAdmin ? (params.cwd ?? HOST_HOME) : undefined;
const proc = Bun.spawn(spawnCmd, {
stdin: 'ignore',
+1
View File
@@ -61,6 +61,7 @@ export type ClaudeSpawnParams = {
sessionKey: string;
model?: string;
role?: string;
cwd?: string;
};
export type ClaudeSpawnStreamingParams = {