Handle @ in local marketplace paths (#34959)

## Why

Relative local marketplace paths can contain `@`, but source parsing treated it as a Git ref separator.

## What changed

- Skip `@` ref parsing when the marketplace source has local path syntax.
- Cover adding a local marketplace from `./alice@example.com/marketplace` through the app-server API.

GitOrigin-RevId: aa55c8cd9838908e15b6a17f8d6058e95aa13ba5
This commit is contained in:
Philipp Spiess
2026-07-23 15:32:36 +00:00
committed by copyberry
parent 34b935e3e5
commit 7d748d3bbc
2 changed files with 4 additions and 3 deletions
@@ -13,7 +13,7 @@ const DEFAULT_TIMEOUT: Duration = Duration::from_secs(10);
#[tokio::test]
async fn marketplace_add_local_directory_source() -> Result<()> {
let codex_home = TempDir::new()?;
let source = codex_home.path().join("marketplace");
let source = codex_home.path().join("alice@example.com/marketplace");
std::fs::create_dir_all(source.join(".agents/plugins"))?;
std::fs::create_dir_all(source.join("plugins/sample/.codex-plugin"))?;
std::fs::write(
@@ -33,7 +33,7 @@ async fn marketplace_add_local_directory_source() -> Result<()> {
let request_id = mcp
.send_marketplace_add_request(MarketplaceAddParams {
source: "./marketplace".to_string(),
source: "./alice@example.com/marketplace".to_string(),
ref_name: None,
sparse_paths: None,
})
@@ -101,7 +101,8 @@ fn split_source_ref(source: &str) -> (String, Option<String>) {
if let Some((base, ref_name)) = source.rsplit_once('#') {
return (base.to_string(), non_empty_ref(ref_name));
}
if !source.contains("://")
if !looks_like_local_path(source)
&& !source.contains("://")
&& !is_ssh_git_url(source)
&& let Some((base, ref_name)) = source.rsplit_once('@')
{