mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-14 18:18:37 +00:00
fix(claude-cli): preserve CLAUDE_CODE_OAUTH_TOKEN in env filter
filterCLIEnv was stripping all CLAUDE* env vars including the OAuth token needed for CLI subprocess authentication. Closes #541
This commit is contained in:
1 parent
dbc93aae8e
commit
fe163eca30
1 file changed
+5
-3
@@ -272,7 +272,8 @@ func ResetCLISession(baseWorkDir, sessionKey string) {
|
||||
}
|
||||
}
|
||||
|
||||
// filterCLIEnv removes CLAUDE* env vars to prevent nested session conflicts.
|
||||
// filterCLIEnv removes CLAUDE* env vars to prevent nested session conflicts,
|
||||
// but preserves CLAUDE_CODE_OAUTH_TOKEN for authentication.
|
||||
func filterCLIEnv(environ []string) []string {
|
||||
var filtered []string
|
||||
for _, e := range environ {
|
||||
@@ -280,8 +281,9 @@ func filterCLIEnv(environ []string) []string {
|
||||
if before, _, ok := strings.Cut(e, "="); ok {
|
||||
key = before
|
||||
}
|
||||
// Filter out variables that could cause nested CLI conflicts
|
||||
if strings.HasPrefix(key, "CLAUDE") {
|
||||
// Filter out variables that could cause nested CLI conflicts,
|
||||
// but preserve auth token needed by the subprocess.
|
||||
if strings.HasPrefix(key, "CLAUDE") && key != "CLAUDE_CODE_OAUTH_TOKEN" {
|
||||
continue
|
||||
}
|
||||
filtered = append(filtered, e)
|
||||
|
||||
Reference in new issue
Block a user