Skip to content

fix(init): push member registration via MR when main is protected - #677

Open
damenjs wants to merge 2 commits into
Tencent:mainfrom
damenjs:fix/init-push-via-mr-not-protected-main
Open

damenjs wants to merge 2 commits into
Tencent:mainfrom
damenjs:fix/init-push-via-mr-not-protected-main

Conversation

@damenjs

@damenjs damenjs commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

teamai init hard-pushed member registration directly to the default branch via pushRepoDirectly. When the team repo's main branch is protected (push: No one — common for team repos), this direct push is rejected by the server. Worse, simple-git's push has no timeout and no GIT_TERMINAL_PROMPT=0 guard, so when credentials are missing the push hangs indefinitely instead of throwing, stalling the entire init before the local config is ever written. Every new member running init would hit this and be stuck with no skills/config.

Switch the member-registration and reviewer-config pushes to autoPushViaMR (already used by other flows), which creates a branch, pushes it, and opens an MR — never touching the protected main directly. Wrap each push in withTimeout(30s) so a hung push can never block init; all failures are non-blocking (warn only), so init always completes and writes local config + skills even if the MR could not be created.

Summary

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature causing existing behavior to change)
  • Documentation only
  • Refactor / internal cleanup

Test Plan

  • npx tsc --noEmit passes
  • npx vitest run passes
  • Added/updated tests for the change

Related Issues

Notes for Reviewers

teamai init still has two direct pushes to the default branch that hang
or are rejected when main is protected (push: No one):

1. The reviewer-config push (teamai.yaml) uses pushRepoDirectly —
   rejected on protected main, and simple-git's push has no timeout /
   no GIT_TERMINAL_PROMPT=0 guard, so a missing-credential push hangs
   indefinitely instead of throwing, stalling init before local config
   is written. Switch this to autoPushViaMR (branch + MR, already used
   by other flows) wrapped in withTimeout(30s), non-blocking.

2. The empty-repo skeleton push also uses pushRepoDirectly with no
   timeout — wrap it in withTimeout(30s) so a hung push can never
   block init. (Member registration already moved to the teamai-reports
   orphan branch upstream, so it no longer touches main.)

All failures remain non-blocking (warn only): init always completes and
writes local config + skills even if a push/MR could not be created.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@damenjs
damenjs force-pushed the fix/init-push-via-mr-not-protected-main branch from 67455be to cae3759 Compare September 20, 2026 08:41
Add a Troubleshooting section to README explaining why `teamai init`
hangs after "Registered as team member" (protected default branch +
push with no timeout), with a no-code MR-based quick fix. Ship the
fix as patches/init-push-via-mr-and-timeout.patch so teams can apply
it locally before the PR lands.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@jeff-r2026 jeff-r2026 self-assigned this Sep 20, 2026
@github-actions

Copy link
Copy Markdown
  • [P1 blocking] Missing required test evidence. The PR body leaves the entire Test Plan unchecked and provides neither an end-to-end/real-CLI verification record nor results for the required agent/provider combinations. This must be documented before merge.
  • [P1 blocking] The timeout does not terminate the hanging Git operation. withTimeout(pushRepoDirectly(...)) in src/init.ts:1423 only stops awaiting the promise; it cannot cancel the already-running Git subprocess. A credential prompt can therefore continue holding the Node process open after 30 seconds, so the claimed “init can never stall” guarantee is not achieved.
  • [P1 blocking] The stated member-registration path is not fixed. The PR changes the skeleton push and reviewer-config push, but the member registration still awaits the unchanged updateReports(...) path without a timeout or MR conversion. Thus the PR does not implement its title/summary claim or demonstrate that the reported member-registration hang is resolved.
  • [P1 blocking] README translations are out of sync. README.md:319 adds substantial troubleshooting behavior documentation, but README.ja.md, README.ko.md, README.th.md, and README.zh-CN.md are unchanged, violating the explicit requirement to update every README language version consistently.
  • [P2 non-blocking] Remove the committed patch artifact. patches/init-push-via-mr-and-timeout.patch:1 duplicates the PR’s own source and README changes and tells users to apply a patch already present in the release. It is unnecessary packaging baggage and violates the surgical-change rule.

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