Skip to content

fix(session): checkout claimed PR branch#2579

Open
GautamSharma99 wants to merge 1 commit into
AgentWrapper:mainfrom
GautamSharma99:fix/claim-pr-checkout-branch
Open

fix(session): checkout claimed PR branch#2579
GautamSharma99 wants to merge 1 commit into
AgentWrapper:mainfrom
GautamSharma99:fix/claim-pr-checkout-branch

Conversation

@GautamSharma99

Copy link
Copy Markdown

Summary

  • Switch a session workspace to the claimed PR source branch during claim-pr.
  • Return branchChanged: true when checkout actually changes the workspace branch.
  • Persist updated session branch metadata after a successful checkout.
  • Surface typed errors for dirty worktrees, missing branches, invalid branches, and branches checked out elsewhere.

Why

ClaimPR previously persisted PR ownership and facts but always returned BranchChanged: false. The session workspace could
remain on its old AO branch even after claiming an existing PR, which made the CLI/API checkout status misleading and left
the worker in the wrong branch.

Implementation Notes

  • Added Workspace.CheckoutBranch.
  • Implemented gitworktree checkout via git switch.
  • Refuses dirty worktrees before switching branches to avoid carrying unrelated local edits across branches.
  • Uses existing branch sentinel errors where possible.

Tests

  • go test ./internal/service/session
  • go test ./internal/adapters/workspace/gitworktree
  • go test ./internal/httpd/controllers
  • go test ./internal/session_manager ./internal/integration
  • npm run lint
  • git diff --check

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.

1 participant