fix: fallback to default branch in create commit tool
What does this merge request do and why?
Fixes Duo Chat getting stuck when committing to missing branches by implementing proper fallback to default branch.
The issue occurred when Duo tried to commit to a branch that didn't exist - it would attempt to fetch file content from the missing branch and fail. This MR adds branch existence checking and ensures that when fetching file content for partial edits, it falls back to the default branch (or start_branch/start_sha) if the target branch doesn't exist, preventing the tool from getting stuck.
Dependencies
This MR is blocked by Gitlab MR which allows fetching the branch information needed for the existence check.
How to set up and validate locally
- Run Duo Agent platform and GDK (ensure to have the latest version of GDK).
- Ask Duo to update some file and create commit to not existing branch.
- Ensure commit was successfully created.
Screen Recording 2025-10-31 at 16.02.33.mov
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed. -
If this change requires executor implementation: verified that issues/MRs exist for both Go executor and Node executor or confirmed that changes are backward-compatible and don't break existing executor functionality.
Related to: gitlab-org/gitlab#578773 (closed)
Edited by Eva Kadlecová