Skip to content

Comments

Detect and warn on #456 git config corruption (user.name = literal us…#472

Draft
peyton-alt wants to merge 2 commits intomainfrom
fix/456-git-config-integrity-guard
Draft

Detect and warn on #456 git config corruption (user.name = literal us…#472
peyton-alt wants to merge 2 commits intomainfrom
fix/456-git-config-integrity-guard

Conversation

@peyton-alt
Copy link
Contributor

…er.email)

Copilot AI review requested due to automatic review settings February 24, 2026 04:13
@cursor
Copy link

cursor bot commented Feb 24, 2026

PR Summary

Medium Risk
Adds new git config --local subprocess calls and emits stderr warnings during lifecycle/hook operations; low functional impact but touches core session/strategy save paths and could affect UX or performance in hook-heavy flows.

Overview
Adds a new git-config integrity guard that snapshots local .git/config (user.name/user.email) and warns if these values change during key operations, with a specific detection for issue #456 where user.name becomes the literal string "user.email".

Wires these checks into session lifecycle and hook flows (e.g., turn-start, turn-end SaveStep, subagent/task step saves, post-commit, pre-push, and Claude Code post-todo) to catch corruption both at session start and immediately after strategy save calls.

Adds unit tests for the guard logic plus new integration tests asserting a full session does not mutate local git config and regressing against the #456 pattern; includes small test/bench cleanups (e.g., errors.New, strconv.Itoa, parallel loop capture removals).

Written by Cursor Bugbot for commit 6fefc1c. Configure here.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds runtime detection and warnings for the #456 local git config corruption pattern (user.name == "user.email") and guards key lifecycle/hook operations to surface unexpected .git/config mutations.

Changes:

  • Introduces a local git config snapshot/compare guard with targeted #456 detection and user-facing warnings.
  • Wraps lifecycle step saving and selected git hooks with before/after integrity checks.
  • Adds unit + integration regression coverage for config integrity, plus small test/bench cleanups.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
cmd/entire/cli/config_guard.go New helper to snapshot local user.name/user.email, detect changes, and warn on #456 pattern.
cmd/entire/cli/config_guard_test.go Unit tests for snapshotting and warning behavior.
cmd/entire/cli/lifecycle.go Adds pre-flight corruption check at turn start and integrity checks around SaveStep/SaveTaskStep.
cmd/entire/cli/hooks_git_cmd.go Adds integrity checks around post-commit / pre-push hook handling.
cmd/entire/cli/hooks_claudecode_posttodo.go Adds integrity check around incremental SaveTaskStep in the post-todo hook.
cmd/entire/cli/integration_test/git_config_integrity_test.go New integration regression tests ensuring sessions don’t mutate local config and user.name never becomes literal user.email.
cmd/entire/cli/integration_test/testenv.go Removes loop-variable rebinds but leaves “capture for parallel” comments.
cmd/entire/cli/integration_test/rewind_test.go Same subtest-loop comment cleanup mismatch.
cmd/entire/cli/integration_test/interactive.go Uses errors.New for a fixed timeout error.
cmd/entire/cli/integration_test/hook_bench_test.go Uses strconv.Itoa for benchmark names.
cmd/entire/cli/integration_test/agent_test.go Whitespace cleanup only.
Comments suppressed due to low confidence (3)

cmd/entire/cli/integration_test/testenv.go:245

  • Same issue: the "capture for parallel" comment is now misleading because there's no loop-variable rebind. Either remove the comment or rebind strat to make the intent explicit.
	for _, strat := range AllStrategies() {
		// capture for parallel
		t.Run(strat, func(t *testing.T) {
			t.Parallel()
			env := NewRepoEnv(t, strat)
			testFn(t, env, strat)
		})

cmd/entire/cli/integration_test/testenv.go:214

  • The comment says "capture for parallel" but the loop variable is no longer re-bound. With Go 1.22+ this is safe, but the comment is now misleading—either remove the comment or reintroduce the explicit rebind to match the intent.
	for _, strat := range AllStrategies() {
		// capture for parallel
		t.Run(strat, func(t *testing.T) {
			t.Parallel()
			env := NewFeatureBranchEnv(t, strat)
			testFn(t, env, strat)

cmd/entire/cli/integration_test/testenv.go:230

  • Same issue here: the "capture for parallel" comment is now misleading because there's no loop-variable rebind. Either remove the comment or rebind strat to make the intent explicit.
	for _, strat := range AllStrategies() {
		// capture for parallel
		t.Run(strat, func(t *testing.T) {
			t.Parallel()
			env := NewRepoWithCommit(t, strat)
			testFn(t, env, strat)
		})

@peyton-alt
Copy link
Contributor Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants