Skip to content

Settings → Add Project only submits path, so GitHub URLs fail there even though the API and sidebar support them #1108

@LocNguyenSGU

Description

@LocNguyenSGU

Summary

The web app currently has two different "Add Project" entry points with inconsistent behavior:

  • Sidebar add project supports both GitHub URLs and local paths
  • Settings → Projects → Add Project only submits { path }

This means adding a GitHub repository URL from the Settings page fails or is handled incorrectly, even though the API and the sidebar both support URL-based project registration.

Evidence

1) Docs/README say a project can be added via GitHub URL or local path

In README.md:

Register a project by clicking + next to "Project" in the chat sidebar - enter a GitHub URL or local path.

2) The server API explicitly supports either url or path

In packages/server/src/routes/schemas/codebase.schemas.ts:

/** POST /api/codebases request body. Exactly one of url or path must be provided. */

and:

{
  url?: string,
  path?: string,
  allowEnvKeys?: boolean
}

3) The server route branches correctly on url vs path

In packages/server/src/routes/api.ts:

const result = body.url
  ? await cloneRepository(body.url, body.allowEnvKeys)
  : await registerRepository(body.path ?? '', body.allowEnvKeys);

4) Sidebar add-project UI supports both

In packages/web/src/components/layout/Sidebar.tsx:

const isLocalPath =
  trimmed.startsWith('/') || trimmed.startsWith('~') || /^[A-Za-z]:[/\\]/.test(trimmed);
const input = isLocalPath ? { path: trimmed } : { url: trimmed };

Its input placeholder also says:

placeholder="GitHub URL or local path"

5) Settings page does not

In packages/web/src/routes/SettingsPage.tsx:

mutationFn: ({ path, allowEnvKeys }: { path: string; allowEnvKeys?: boolean }) =>
  addCodebase({ path, allowEnvKeys })

and:

addMutation.mutate({ path: addPath.trim(), allowEnvKeys: allowEnvKeys || undefined });

The placeholder is also path-only:

placeholder="/path/to/repository"

Why this matters

From a user perspective, both entry points are "Add Project" UI, so they should behave consistently.

Right now:

  • pasting a GitHub URL into the sidebar works
  • pasting the same GitHub URL into Settings can fail because it is sent as path

This creates a confusing UX and makes the Settings page appear broken for valid inputs supported elsewhere in the app.

Suggested Fix

Use the same input detection logic in SettingsPage.tsx as in the sidebar:

  • detect local paths (/, ~, Windows drive prefix)
  • otherwise send { url: trimmed }

Also update the Settings placeholder text to match actual supported behavior, e.g.:

placeholder="GitHub URL or local path"

Expected Behavior

Both "Add Project" entry points in the web UI should accept the same valid inputs and submit them the same way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priority - Nice to have, consider closing if stalearea: webWeb UI (packages/web) - React frontendbugSomething is brokeneffort/lowSingle file or function, one responsibility, isolated changegood first issueGood for newcomersuxUser experience improvements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions