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:
@@ -76,7 +76,9 @@ export async function spawnClaude(params: ClaudeSpawnParams): Promise<ClaudeCode
|
|||||||
}
|
}
|
||||||
|
|
||||||
const spawnCmd = isSuperAdmin ? claudeArgs : [...buildSandboxArgs(email), ...claudeArgs];
|
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, {
|
const proc = Bun.spawn(spawnCmd, {
|
||||||
stdin: 'pipe',
|
stdin: 'pipe',
|
||||||
@@ -173,7 +175,9 @@ export async function spawnClaudeStreaming(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const spawnCmd = isSuperAdmin ? claudeArgs : [...buildSandboxArgs(email), ...claudeArgs];
|
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, {
|
const proc = Bun.spawn(spawnCmd, {
|
||||||
stdin: 'ignore',
|
stdin: 'ignore',
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ export type ClaudeSpawnParams = {
|
|||||||
sessionKey: string;
|
sessionKey: string;
|
||||||
model?: string;
|
model?: string;
|
||||||
role?: string;
|
role?: string;
|
||||||
|
cwd?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ClaudeSpawnStreamingParams = {
|
export type ClaudeSpawnStreamingParams = {
|
||||||
|
|||||||
Reference in New Issue
Block a user