Skip to content

Comments

feat: git init + GitHub remote setup on latest main#420

Merged
Dimillian merged 4 commits intoDimillian:mainfrom
Samigos:restart/git-init-fresh-main
Feb 13, 2026
Merged

feat: git init + GitHub remote setup on latest main#420
Dimillian merged 4 commits intoDimillian:mainfrom
Samigos:restart/git-init-fresh-main

Conversation

@Samigos
Copy link
Contributor

@Samigos Samigos commented Feb 12, 2026

Summary

rebuilt the Git init + optional GitHub remote setup flow on top of latest main

@Samigos
Copy link
Contributor Author

Samigos commented Feb 12, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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)?);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge 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 👍 / 👎.

@Samigos
Copy link
Contributor Author

Samigos commented Feb 12, 2026

@codex review

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Dimillian
Copy link
Owner

@Samigos don't worry about the conflict, I'll try to mege this one tomorrow but I need to properly manual test it,

@Samigos
Copy link
Contributor Author

Samigos commented Feb 12, 2026

@Dimillian just merged upstream/main to this branch so i think it'll be ok

@Dimillian
Copy link
Owner

@codex review + any regression compared to main?

@Samigos
Copy link
Contributor Author

Samigos commented Feb 12, 2026

I'm gonna test it myself a bit more, probably later today

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +184 to +188
if (!remoteResult.ok) {
setInitGitRepoPrompt((prev) =>
prev ? { ...prev, error: remoteResult.error } : prev,
);
return;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +669 to +673
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 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge 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 👍 / 👎.

@Dimillian Dimillian changed the title Rebuild git init + GitHub remote setup on latest main feat: git init + GitHub remote setup on latest main Feb 13, 2026
@Dimillian Dimillian merged commit 08d28f5 into Dimillian:main Feb 13, 2026
9 checks passed
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