Skip to content

fix(shell): pass explicit origin and branch to git pull --rebase#182

Merged
skulidropek merged 4 commits intoProverCoderAI:mainfrom
konard:issue-181-09bf075a5254
Mar 23, 2026
Merged

fix(shell): pass explicit origin and branch to git pull --rebase#182
skulidropek merged 4 commits intoProverCoderAI:mainfrom
konard:issue-181-09bf075a5254

Conversation

@konard
Copy link
Contributor

@konard konard commented Mar 23, 2026

Fixes #181

Previously `git pull --rebase` was called without explicit `origin ` parameters in both `statePullInternal` (used by `autoPullState` at startup) and `statePull` (used by the manual pull command). This can fail or pull the wrong branch in certain git configurations.

Changes

  • `statePullInternal` (`state-repo.ts`): resolve the current branch via `git rev-parse --abbrev-ref HEAD` and call `git pull --rebase origin ` instead of bare `git pull --rebase`
  • `statePull` (`pull-push.ts`): same fix applied to the manual pull command
  • Both places fall back to `"main"` when HEAD is detached (`rev-parse` returns `"HEAD"`) or on error (using `Effect.orElse` instead of `Effect.catchAll` to comply with lint rules)
  • `autoPullState` (`state-repo.ts`): added `Effect.tapError` to run `git rebase --abort` when pull fails, preventing conflict markers from being left in the working tree when the rebase encounters merge commits in the local history

Mathematical guarantees

Invariant: `∀ pull ∈ PullOperations: explicit_remote(pull) ∧ explicit_branch(pull) → deterministic_target(pull)`
Invariant: `∀ pull_failure ∈ RebaseFailures: rebase_aborted(failure) → clean_working_tree(root)`
Precondition: `git repo with origin remote exists`
Postcondition: `git pull --rebase origin ` is called with the resolved branch name; on failure the rebase is cleanly aborted

Test plan

  • All existing tests pass (`npm test`)
  • Lint Effect-TS passes with 0 errors (`pnpm --filter @effect-template/lib lint:effect`)
  • TypeScript builds cleanly (`pnpm --filter @effect-template/lib build`)
  • `autoPullState` integration tests continue to pass
  • Branch resolution falls back to `"main"` on detached HEAD or error
  • CI: E2E (Login context) ✓, E2E (Clone cache) ✓, Lint Effect-TS ✓

konard and others added 2 commits March 23, 2026 15:52
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: ProverCoderAI#181
Resolve current branch via `git rev-parse --abbrev-ref HEAD` and
pass `origin <branch>` explicitly so that `git pull --rebase origin main`
(or the tracked branch) is called instead of the bare `git pull --rebase`,
which can fail or pull the wrong branch in some git configurations.

- Fix statePullInternal in state-repo.ts (used by autoPullState)
- Fix statePull in pull-push.ts (used by the manual pull command)
- Falls back to "main" when HEAD is detached

Fixes: ProverCoderAI#181

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] Сделай что бы правильные параметры передавались fix(shell): pass explicit origin and branch to git pull --rebase Mar 23, 2026
@konard konard marked this pull request as ready for review March 23, 2026 15:59
@konard
Copy link
Contributor Author

konard commented Mar 23, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $0.671248
  • Calculated by Anthropic: $0.752274 USD
  • Difference: $0.081026 (+12.07%)

🤖 Models used:

  • Tool: Claude
  • Requested: sonnet
  • Model: Claude Sonnet 4.6 (claude-sonnet-4-6)

📎 Log file uploaded as Gist (731KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Contributor Author

konard commented Mar 23, 2026

🔄 Auto-restart triggered (iteration 1)

Reason: CI failures detected

Starting new session to address the issues.


Auto-restart-until-mergeable mode is active. Will continue until PR becomes mergeable.

…se on pull failure

- Replace Effect.catchAll with Effect.orElse in state-repo.ts and pull-push.ts
  to comply with no-restricted-syntax lint rule that forbids catchAll
- Add Effect.tapError in autoPullState to run git rebase --abort when pull fails,
  preventing conflict markers from being left in the working tree when
  git pull --rebase encounters merge commits in the local history

INVARIANT: ∀ pull_failure ∈ RebaseFailures: rebase_aborted(failure) → clean_working_tree(root)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@konard
Copy link
Contributor Author

konard commented Mar 23, 2026

🔄 Auto-restart-until-mergeable Log (iteration 1)

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $2.732898
  • Calculated by Anthropic: $1.955080 USD
  • Difference: $-0.777818 (-28.46%)

🤖 Models used:

  • Tool: Claude
  • Requested: sonnet
  • Model: Claude Sonnet 4.6 (claude-sonnet-4-6)

📎 Log file uploaded as Gist (2040KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Contributor Author

konard commented Mar 23, 2026

🔄 Auto-restart triggered (iteration 2)

Reason: Uncommitted changes detected

Starting new session to address the issues.


Auto-restart-until-mergeable mode is active. Will continue until PR becomes mergeable.

@konard
Copy link
Contributor Author

konard commented Mar 23, 2026

🔄 Auto-restart-until-mergeable Log (iteration 2)

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $0.242514
  • Calculated by Anthropic: $0.271120 USD
  • Difference: $0.028605 (+11.80%)

🤖 Models used:

  • Tool: Claude
  • Requested: sonnet
  • Model: Claude Sonnet 4.6 (claude-sonnet-4-6)

📎 Log file uploaded as Gist (2274KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Contributor Author

konard commented Mar 23, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@skulidropek skulidropek merged commit b26465c into ProverCoderAI:main Mar 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Сделай что бы правильные параметры передавались

2 participants