Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(door): build the effect session's Git env in the call so the env guard sees it is scrubbed (#7742)
garrytan478f5be4ce36
diff --git a/src/core/persistence/effect-git.ts b/src/core/persistence/effect-git.tsindex 8050915185..ee40f9c1a4 100644--- a/src/core/persistence/effect-git.ts+++ b/src/core/persistence/effect-git.ts@@ -65,15 +65,15 @@ export interface GitSession { root: string; hooks: string; signal?: AbortSignal;const gitArgs = (session: GitSession, args: string[], literal: boolean) =>[...(literal ? ['--literal-pathspecs'] : []), '-C', session.root, '-c', `core.hooksPath=${session.hooks}`, '-c', 'commit.gpgsign=false', ...args];const gitOptions = (session: GitSession) => ({ timeout: session.timeoutMs, termGraceMs: GIT_TERM_GRACE_MS, maxBuffer: 1024 * 1024, signal: session.signal });-const gitEnv = (session: GitSession) => gitChildEnv(session.indexFile ? { ...GIT_ENV, GIT_INDEX_FILE: session.indexFile } : GIT_ENV);+const sessionEnv = (session: GitSession) => session.indexFile ? { ...GIT_ENV, GIT_INDEX_FILE: session.indexFile } : GIT_ENV;function run(session: GitSession, args: string[], literal = true) {- return execFileBounded('git', gitArgs(session, args, literal), { ...gitOptions(session), env: gitEnv(session) });+ return execFileBounded('git', gitArgs(session, args, literal), { ...gitOptions(session), env: gitChildEnv(sessionEnv(session)) });}/** A read-only git step whose stdout is raw bytes (a tree object); null when git exits non-zero. */export async function gitBytes(session: GitSession, args: string[]): Promise<Buffer | null> {- const { error, stdout } = await execFileBounded('git', gitArgs(session, args, true), { ...gitOptions(session), env: gitEnv(session), maxBuffer: 256 * 1024 * 1024, encoding: 'buffer' });+ const { error, stdout } = await execFileBounded('git', gitArgs(session, args, true), { ...gitOptions(session), env: gitChildEnv(sessionEnv(session)), maxBuffer: 256 * 1024 * 1024, encoding: 'buffer' });if (error && (error.killed || typeof error.code !== 'number')) throw gitFailure('Git execution did not finish within its bounded attempt.',`A git command in the canonical checkout did not finish within ${Math.round(session.timeoutMs / 1000)} seconds or could not start.`);return error ? null : stdout;