Summary
- What broke: Clone from Gitea places project in the wrong folder
- When it started (if known): Feature introduction
- Severity:
major
Steps to Reproduce
- Add a webhook to Archon in Gitea (or Gitlab).
- Open an issue and make a comment with
@archon which initiates repo clone.
Expected vs Actual
- Expected: Repo clones to
~/.archon/workspaces/owner/repo/source/
- Actual: Repo clones to
~/.archon/workspaces/owner/repo/ which breaks project structure worktrees/ etc.
The Bug
The Gitea adapter bypasses the proper clone flow entirely. Let's trace the two paths:
Correct path (via CLI /clone command)
In clone.ts, line 186-187:
const targetPath = getProjectSourcePath(ownerName, repoName);
getProjectSourcePath() returns ~/.archon/workspaces/owner/repo/source/. It also calls ensureProjectStructure() (line 242) which creates source/, worktrees/, artifacts/, logs/ as separate directories.
Buggy path (Gitea adapter)
In adapter.ts (gitea), line 611:
const canonicalPath = join(getArchonWorkspacesPath(), owner, repo);
This resolves to ~/.archon/workspaces/owner/repo/ — no /source suffix.
Then in ensureRepoReady() (line 527), it clones directly to repoPath (which is canonicalPath):
const cloneResult = await cloneRepository(repoUrl, toRepoPath(repoPath), {...});
So the repo gets cloned directly into owner/repo/ instead of owner/repo/source/. And since ensureProjectStructure() is never called, the worktrees/ directory ends up as a sibling subdirectory of the cloned repo content — inside the repo itself.
GitHub adapter has the same issue at line 585:
const canonicalPath = join(getArchonWorkspacesPath(), owner, repo);
GitLab adapter too line 549:
const canonicalPath = join(getArchonWorkspacesPath(), ...projectPath.split('/'));
The Fix
The adapters need to use getProjectSourcePath(owner, repo) instead of manually constructing the path, and call ensureProjectStructure(owner, repo) before cloning — matching what the CLI /clone command does. The canonicalPath should point to the source/ directory, since that's where the actual repo lives and where worktrees will be scoped.
Environment
- Platform: Web, Docker
- Database: PostgreSQL
- Running in worktree? Yes
- OS: Docker/Alpine
Logs
N/A
Impact
- Affected workflows/commands: Workflow authoring and activities dependent on project structure.
- Reproduction rate: Always
- Workaround available? If so, describe: Manual clone and register project first.
- Data loss risk? Maybe (Archon seems confused where workflows live).
Scope
- Package(s) likely involved:
adapters
- Module (if known):
adapters:gitea, adapters:gitlab
Summary
majorSteps to Reproduce
@archonwhich initiates repo clone.Expected vs Actual
~/.archon/workspaces/owner/repo/source/~/.archon/workspaces/owner/repo/which breaks project structureworktrees/etc.The Bug
The Gitea adapter bypasses the proper clone flow entirely. Let's trace the two paths:
Correct path (via CLI
/clonecommand)In
clone.ts, line 186-187:getProjectSourcePath()returns~/.archon/workspaces/owner/repo/source/. It also callsensureProjectStructure()(line 242) which createssource/,worktrees/,artifacts/,logs/as separate directories.Buggy path (Gitea adapter)
In
adapter.ts (gitea), line 611:This resolves to
~/.archon/workspaces/owner/repo/— no /source suffix.Then in
ensureRepoReady()(line 527), it clones directly torepoPath(which iscanonicalPath):So the repo gets cloned directly into
owner/repo/instead ofowner/repo/source/. And sinceensureProjectStructure()is never called, theworktrees/directory ends up as a sibling subdirectory of the cloned repo content — inside the repo itself.GitHub adapter has the same issue at line 585:
GitLab adapter too line 549:
The Fix
The adapters need to use
getProjectSourcePath(owner, repo)instead of manually constructing the path, and callensureProjectStructure(owner, repo)before cloning — matching what the CLI/clonecommand does. ThecanonicalPathshould point to thesource/directory, since that's where the actual repo lives and where worktrees will be scoped.Environment
Logs
N/A
Impact
Scope
adaptersadapters:gitea,adapters:gitlab