feat: input-source abstraction — local + GitLab repos (capability-gated) - #63
Merged
Conversation
Adds a RepoSource contract so --repo accepts a GitHub owner/name, a gitlab.com URL, or a local path (/abs, ./rel, ~, file://). RepoSpec classifies the source; sources.py declares per-source Capabilities (pull_requests / issues / commit_api) and each pipeline's required_capabilities. cmd_generate gates incompatible combos up front with a clear message — so pr_diff/pr_runtime/cve_patches are blocked on local/GitLab (PRs/CVEs don't exist in a bare clone), while the git/source pipelines (commit_runtime, code_instruct, equivalence_tests) run on any source. resolve_repo_token dispatches by source (local → no token + no `gh` shell-out; gitlab → GITLAB_TOKEN; github → unchanged chain), and auth_clone_url injects GitLab oauth2 tokens. The GitHub-API language pre-flight is skipped for non-GitHub sources (bootstrap detects locally). Fully backwards compatible: bare owner/name and github URLs resolve to GitHub with the full capability set, exactly as before. GitLab MR mining (pr_diff/pr_runtime on GitLab) is tracked in #62. Closes #59.
Make per-pipeline source support visible where users pick a pipeline: 'GitHub · GitLab · local' for the git/source pipelines, 'GitHub' for the PR/CVE ones that the capability gate restricts.
commit_runtime is allowed on local/GitLab sources, but it called the gh-based fetch_issue() unconditionally for any commit with a 'Closes #N' trailer — which would crash on a non-GitHub source (bogus owner/name). Gate the fetch on the ISSUES capability (GitHub-only) and wrap it defensively so a missing/private issue falls back to the commit message instead of aborting the run.
This was referenced Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #59. Foundation for #62 (GitLab MR mining).
Summary
Introduces a source contract so
--repois no longer GitHub-only:/abs/path,./rel,~/x, orfile://…(canonicalized tofile://<abspath>). Directly answers Repo2RLEnv on a Local Repository #59.https://gitlab.com/owner/name(clone + git today; MR mining is Add GitLab support via a source-provider abstraction #62).sources.pydefines aCapabilityset per source (pull_requests/issues/commit_api) and each pipeline declaresrequired_capabilities.cmd_generategates incompatible combos up front with a clear, actionable error instead of failing deep in a run:So:
commit_runtime,code_instruct,equivalence_testsrun on any source;pr_diff,pr_runtime,cve_patchesrequire GitHub (PRs/CVEs don't exist in a bare clone).Mechanics
RepoSpec.normalize_urlaccepts local paths + GitLab; addssource_kindand local-awareowner_name(('local', <dir>)).resolve_repo_tokendispatches by source: local →None(and noghshell-out, so local works withoutghinstalled); gitlab →$GITLAB_TOKEN; github → the existing chain.auth_clone_urlinjects GitLaboauth2:<token>@; local/public pass through.Backwards compatibility
Bare
owner/nameandgithub.comURLs resolve to GitHub with the full capability set — identical behavior to before. No version bump.Test plan
uv run pytest -q→ 669 passed (+14 new intests/test_sources.py), incl. a real local git-clone round-trip and the capability-gating contract. The lone unrelated failure (test_e2e_public_trl) fails identically onmain.generate --repo <local> --pipeline pr_diffis blocked with the message above; git-based pipelines accept the local path.ruff check+ruff format --checkclean.Out of scope
pr_diff/pr_runtime(Add GitLab support via a source-provider abstraction #62) — needs a GitLab MR API client.referencelinks for local repos point at a syntheticgithub.com/local/<dir>/…— cosmetic, can refine later.