Skip to content

fix(mcp): auto-detect git repo and branch when omitted from create_session#291

Open
Angfr95 wants to merge 1 commit into
google-labs-code:mainfrom
Angfr95:fix/repoless-session-285
Open

fix(mcp): auto-detect git repo and branch when omitted from create_session#291
Angfr95 wants to merge 1 commit into
google-labs-code:mainfrom
Angfr95:fix/repoless-session-285

Conversation

@Angfr95
Copy link
Copy Markdown

@Angfr95 Angfr95 commented May 2, 2026

Summary

create_session was silently creating repoless sessions when repo or branch were omitted, even when the MCP server was running inside a Git repository. This fix adds auto-detection so the tool behaves correctly by default.

Changes

  • Added detectGitRepo() and detectGitBranch() helpers in create-session.ts that read from git remote get-url origin and git branch --show-current
  • Detection only runs when the field is absent — explicit arguments always win
  • Non-GitHub remotes and all git failures fall back gracefully to repoless (existing behavior preserved)
  • Updated tool and field descriptions to document the new behavior
  • Added 8 new tests covering all detection paths and fallback cases

Testing

All 86 tests pass including 17 tests for create-session (9 existing + 8 new).

Fixes #285

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.

Jules MCP creates repoless sessions without asking

1 participant