Skip to content

fix: resolve relative Git origins against the repository directory - #115

Open
specetator wants to merge 1 commit into
supermemoryai:mainfrom
specetator:fix/relative-origin-directory-20261023
Open

specetator wants to merge 1 commit into
supermemoryai:mainfrom
specetator:fix/relative-origin-directory-20261023

Conversation

@specetator

Copy link
Copy Markdown

Summary

Resolve relative local Git origins against the repository directory instead of the OpenCode process's working directory.

getGitRepoInfo(directory) reads the origin with Git in that directory, but previously normalized a local path using resolve(raw) in the process directory. This caused:

  • relative and absolute origins pointing to the same local upstream to generate different project identities;
  • independent local upstreams configured with the same relative string (for example, ../upstream.git) to generate the same identity and canonical container tag.

The fix passes the repository directory into normalization. HTTPS, SSH, absolute-origin, and existing worktree-isolation behavior are unchanged.

Reproduction and tests

The regression tests create real temporary bare upstreams and working repositories. Each configured origin is checked with git ls-remote origin, then the production getProjectIdentity and getGeneratedProjectTag functions are exercised. No hosted memory API or model calls are needed.

On base 762137de375d3b1920ba91fbdc400a030df92513, the two new regression tests fail while the two existing tag tests pass. With this patch:

  • bun run test: 35 passed, 0 failed
  • bun run typecheck: passed
  • bun run build: passed
  • git diff --check: passed

Validated on Linux using Node 24.19.0, Bun 1.4.4, and TypeScript 5.9.3, with an isolated HOME. Dependencies were installed with bun install --frozen-lockfile. Windows/macOS and live hosted-service behavior were not tested.

Compatibility

Projects previously assigned a wrong launch-directory-derived tag for a relative local origin may receive a corrected container tag. The README explains that the old container is not automatically migrated or added as a read fallback, because it may have mixed unrelated projects. An explicit projectContainerTag override remains available after checking that the chosen container belongs to the project.

This is not a claim of complete historical memory isolation: existing legacy read-container behavior remains unchanged.

AI disclosure

The implementation, regression tests, and independent review were performed by OpenAI coding agents. No human line-by-line code review is claimed. The tests and checks listed above were actually run against the reviewed patch; the published three file blobs were verified against those exact local contents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant