fix(kimi-cli): isolate context by running CLI in /tmp to prevent session resume
Some checks failed
CI / test (push) Has been cancelled
CI / frontend (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
Security Scan / backend-security (push) Has been cancelled
Security Scan / frontend-security (push) Has been cancelled

This commit is contained in:
openclaw
2026-04-24 20:24:23 +08:00
parent 55ca0ad687
commit 88d687715d

View File

@@ -77,7 +77,11 @@ func (g *KimiCLIGateway) ForwardChatCompletions(
}
// 4. Run CLI (CLI manages its own OAuth auth via `kimi login`)
// Use a temp working directory to prevent kimi-cli from auto-resuming
// the last session associated with the backend's working directory.
// This ensures each request is stateless and context-isolated.
cmd := exec.CommandContext(ctx, g.cliPath, args...)
cmd.Dir = "/tmp"
cmd.Stdin = strings.NewReader(ndjsonInput)
stdout, err := cmd.StdoutPipe()