fix(kimi-cli): isolate context by running CLI in /tmp to prevent session resume
This commit is contained in:
@@ -77,7 +77,11 @@ func (g *KimiCLIGateway) ForwardChatCompletions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4. Run CLI (CLI manages its own OAuth auth via `kimi login`)
|
// 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 := exec.CommandContext(ctx, g.cliPath, args...)
|
||||||
|
cmd.Dir = "/tmp"
|
||||||
cmd.Stdin = strings.NewReader(ndjsonInput)
|
cmd.Stdin = strings.NewReader(ndjsonInput)
|
||||||
|
|
||||||
stdout, err := cmd.StdoutPipe()
|
stdout, err := cmd.StdoutPipe()
|
||||||
|
|||||||
Reference in New Issue
Block a user