ov add-resource fails to index GitLab repository with OAuth2 token in URL
Description
When adding a GitLab repository using ov add-resource with OAuth2 token embedded in the HTTPS URL, the indexing process appears to complete but does not properly index the repository content.
Steps to Reproduce
- Run
ov add-resource https://oauth2:<token>@gitlab.example.com/group/repo.git --to viking://resources/repo --timeout 300 - Wait for indexing to complete (queue shows all tasks processed)
- Run
ov tree viking://resources/repo -L 2to inspect the indexed content
Expected Behavior
The repository should be properly indexed with all files and directories accessible via ov ls or ov tree commands.
Actual Behavior
- Indexing process reports success with all queue tasks completed
ov treeonly shows a single.mdfile or incorrect content (e.g.,.htmlfile in temp path)- The actual repository content is not indexed
Workaround
Cloning the repository locally first, then adding the local path works:
git clone https://oauth2:<token>@gitlab.example.com/group/repo.git /tmp/repo
ov add-resource /tmp/repo --to viking://resources/repo --timeout 600
Environment
- OpenViking version: (please fill)
- OS: macOS/Linux
- GitLab version: (if known)
Additional Context
The issue may be related to how OpenViking handles authentication in URLs or processes the initial repository fetch when using embedded credentials.
💬 我也在做记忆系统相关的工作:CausaMem,可以来看看,说不定有能借鉴的地方 🙂
I've been looking into this — I want to follow the GitLab resource parsing path and pin down where OAuth-style URLs get rejected during indexing. Happy to send a fix.
I re-checked this report against current main (d14c0673) and the earlier implementation PR #1838 before choosing a disposition.
I do not think #1838 should be cherry-picked as-is:
- it bundled two unrelated fixes;
- its repository change applied a two-path-component trimming heuristic to every HTTP(S) repository URL;
- the automated review correctly identified that as a regression risk for forges with valid deeper paths.
Current main solves the URL-classification part differently:
- host matching uses
urlparse(...).hostname, sooauth2:<redacted>@hostuserinfo does not corrupt the GitLab hostname check; - configured self-hosted GitLab domains participate in repository detection;
- the normalized clone URL keeps the OAuth2 userinfo and
.gitpath intact.
I verified this locally with a credential-free placeholder URL:
https://oauth2:[email protected]/group/repo.git
With gitlab.example.com configured in code.gitlab_domains, current main reports it as a GitLab repository, resolves group/repo, and preserves the clone URL. The focused URL-helper suite also passes: 49 tests.
Could you retry on current main (or a release containing the current code-hosting URL helpers) and confirm that the self-hosted hostname is present in code.gitlab_domains? Please do not post a real token. If indexing still produces a temporary HTML/Markdown file, the most useful sanitized evidence would be:
- whether the failure happens during GitLab ZIP download or the fallback
git clone; - the first public-safe error line around that transition;
- the resulting
ov treeshape with credentials removed.
I am keeping the issue open pending that end-to-end validation rather than proposing another speculative normalization patch.