Add branch information to repository context to prevent unwanted branch switching (#9833)

This commit is contained in:
Rohit Malhotra
2025-08-01 00:25:36 -04:00
committed by GitHub
parent 1cdc38eafb
commit 287c34b3f3
11 changed files with 44 additions and 7 deletions

View File

@@ -152,6 +152,7 @@ class AgentSession:
self.memory = await self._create_memory(
selected_repository=selected_repository,
repo_directory=repo_directory,
selected_branch=selected_branch,
conversation_instructions=conversation_instructions,
custom_secrets_descriptions=custom_secrets_handler.get_custom_secrets_descriptions(),
working_dir=config.workspace_mount_path_in_sandbox,
@@ -463,6 +464,7 @@ class AgentSession:
self,
selected_repository: str | None,
repo_directory: str | None,
selected_branch: str | None,
conversation_instructions: str | None,
custom_secrets_descriptions: dict[str, str],
working_dir: str,
@@ -488,7 +490,9 @@ class AgentSession:
memory.load_user_workspace_microagents(microagents)
if selected_repository and repo_directory:
memory.set_repository_info(selected_repository, repo_directory)
memory.set_repository_info(
selected_repository, repo_directory, selected_branch
)
return memory
def _maybe_restore_state(self) -> State | None: