feat: git init + GitHub remote setup on latest main#420
feat: git init + GitHub remote setup on latest main#420Dimillian merged 4 commits intoDimillian:mainfrom
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf31419657
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| } | ||
|
|
||
| if origin_url_before.is_none() { |
There was a problem hiding this comment.
Create the remote repo even when origin is already set
When origin is already configured to the requested GitHub slug, this guard skips gh repo create entirely and goes straight to git push. In the common case where users pre-add origin before the GitHub repo exists, push fails with repository not found and the flow can only return partial without ever creating the repository. The setup path should still verify/create the GitHub repo when origin exists but the remote repo is absent.
Useful? React with 👍 / 👎.
| ) -> Result<Value, String> { | ||
| let entry = workspace_entry_for_id(workspaces, &workspace_id).await?; | ||
| let repo_root = resolve_git_root(&entry)?; | ||
| let repo = normalize_repo_full_name(&validate_github_repo_name(&repo)?); |
There was a problem hiding this comment.
Reject empty repo names after normalization
This normalization step can turn syntactically accepted input into an empty slug (for example .git or a host-only URL), but the code does not revalidate afterward, so later commands run with malformed names like owner/ and surface opaque GitHub CLI failures instead of a direct validation error. Add a post-normalization non-empty check before building full_name.
Useful? React with 👍 / 👎.
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@Samigos don't worry about the conflict, I'll try to mege this one tomorrow but I need to properly manual test it, |
|
@Dimillian just merged upstream/main to this branch so i think it'll be ok |
|
@codex review + any regression compared to main? |
|
I'm gonna test it myself a bit more, probably later today |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6a95dd951
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!remoteResult.ok) { | ||
| setInitGitRepoPrompt((prev) => | ||
| prev ? { ...prev, error: remoteResult.error } : prev, | ||
| ); | ||
| return; |
There was a problem hiding this comment.
Refresh remote state after partial GitHub setup
When createGitHubRepo returns a partial result (for example pushError or defaultBranchError), this branch exits without calling refreshGitRemote(). In that case the backend may already have created the repo and/or added origin, but useGitRemote stays stale (remote: null) until the workspace changes, so GitHub links/state remain incorrect after a partially successful setup.
Useful? React with 👍 / 👎.
| let push_result = run_git_command(&repo_root, &["push", "-u", "origin", "HEAD"]).await; | ||
|
|
||
| let default_branch = if let Some(branch) = branch { | ||
| Some(validate_branch_name(&branch)?) | ||
| } else { |
There was a problem hiding this comment.
Validate requested branch before pushing to origin
The requested branch is validated only after git push -u origin HEAD is executed. If a caller sends an invalid branch value through RPC, this function can still create/update remote state and push before returning a validation error, which is a non-atomic failure mode that leaves side effects despite an error response.
Useful? React with 👍 / 👎.
Summary
rebuilt the Git init + optional GitHub remote setup flow on top of latest
main