Skip to content

fix(issues): send fork project issues to the fork by default - #755

Merged
lastobelus merged 6 commits into
lastcode/mainfrom
lastcode/issue-tools-fork-target
Nov 19, 2026
Merged

lastobelus merged 6 commits into
lastcode/mainfrom
lastcode/issue-tools-fork-target

Conversation

@lastobelus

@lastobelus lastobelus commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Problem

When a fork project records upstream as its canonical repository and the fork as origin, the issue tools used upstream for reads and writes. A default create_issue published an issue to the public parent tracker. Web and mobile also listed upstream issues and treated upstream links as belonging to the fork project.

Fix

The fork-owned code selects the issue repository and supplies two small server hooks.

  • Selector: a fork-owned selector picks the issue repository from the project's existing normalized origin and the shared forge definitions.
  • Server: the issue service receives the selector through its layer. Project discovery runs the existing forge refinement independently for origin and publishes its resolved provider and web URL. When two HTTP remotes use different web addresses but collapse to the same repository key, the project reports no Git-host issue scope.
  • Web and mobile: the shared client code in packages/client-runtime calls the same selector for links, filter scopes, and list errors.
  • Tool schemas: unchanged. The existing project and URL arguments cover every case below.

Why the selector skips GitHub's PR resolver

GitHub's PR resolver honors PR-specific defaults such as GH_REPO and gh repo set-default. The issue selector reads project origin data and forge rules directly, so those PR settings cannot redirect issue writes. This PR was opened with lastobelus/lastCode as the explicit target because the checkout's gh-resolved mark points upstream.

Behavior in a fork project

Surface Behavior
create_issue, comment_on_issue, set_issue_state The project default and bare keys target the fork. An explicit parent URL through the fork project is read-only.
read_issue, list_issues Bare keys and repository lists use the fork. Explicit URLs keep the existing repository and host checks.
link_issue, unlink_issue, list_thread_issues Bare keys resolve in the fork. Explicit URLs and saved thread links keep their repository and issue key.
Web and desktop The Issues list and the label and assignee filters use the fork. Pasted fork links prefer the fork project. The issue detail service enforces write access.
Mobile The same list scope, filters, link targets, and server write checks apply.

Edge cases

  • Standalone tracker: a saved project binding to a tracker such as Linear keeps precedence when a tool asks for one default tracker. Git-host scopes come from the repository identity, so the binding never overrides a GitHub repository.
  • Ordinary checkout: a checkout with no distinct origin keeps its existing target.
  • Disabled fork tracker: the host's empty result or error stays scoped to the fork.
  • Local, unknown, or ambiguous origin: Git-host operations are unavailable until the project has an identifiable fork tracker. Discovery records that a local origin exists while keeping its path on the server.
  • Parent writes: the issue tools require a separately registered parent project, selected explicitly or matched by a supplied parent issue URL.

Upstream-owned files (7)

File Lines added / removed Where a future upstream change could overlap
apps/server/src/issue/IssueService.ts +11 / −6 The Git-host binding call, layer factory, and repository-identity input.
apps/server/src/project/RepositoryIdentityResolver.ts +20 / −11 Fetch-remote filtering and the check that determines whether discovery retains the origin.
apps/server/src/server.ts +4 / −3 The issue service and repository resolver imports and composition.
packages/client-runtime/src/issueLinks.ts +14 / −5 The project binding and host-specific URL parser call.
packages/client-runtime/src/issueList.ts +12 / −7 The identity used for filter scopes and list errors.
packages/contracts/src/environment.ts +4 / −0 The optional provider, web URL, and local-origin marker in the identity schema.
packages/source-control-core/src/shared/definition.ts +5 / −0 The shared exports for issue repository selection and retaining distinct remote addresses.

Verification

  • Fixtures: on the base they reproduced the upstream scope and the disabled-tracker create attempt. The final fixtures cover create and comment on the fork, rejected parent writes, local paths and file URLs, unknown and ambiguous origins, ordinary checkouts, and self-hosted provider discovery.
  • Tests: all 62 focused issue, project discovery, toolkit, and client tests passed. Server, shared client, source-control core, and Forgejo typechecks and targeted lint passed.
  • Browser: an isolated web session with both remotes listed LastCode issues and opened a detail with lastobelus/lastCode as its scope. The browser did only GitHub issue reads and made no writes.
  • Quick CI: the final head passed local Quick CI against lastcode/main.

Local review: 4 rounds with gpt-6.1-terra (xhigh), not clean. The last finding was fixed and reproduced with a failing-first local Git fixture. Opus reviewed the scope and recommended cutting the broader issue transport changes, which are follow-up work.

Implemented with GPT-6.2 Sol (xhigh), Codex through LastCode.

A project can carry the upstream repository as its canonical identity even when developers work in the fork. Select the recorded origin for issue operations and share that choice with web and mobile issue navigation.

Implemented with GPT-6.2 Sol (xhigh), Codex through LastCode.

Carry-Group: incubator
Carry-Observation: LastCode treats the checkout origin as the default issue repository even when the project identity is keyed to upstream.
A fork can use a self-hosted provider or a different web address from its SSH remote. Reuse project discovery for the origin and pass that result to the shared issue router.

Implemented with GPT-6.2 Sol (xhigh), Codex through LastCode.

Carry-Group: incubator
Carry-Observation: The issue repository needs independent origin provider and web-host refinement for self-hosted forks.
Keep distinct web remotes even when the normalized repository keys agree. Resolve issue URLs through a project on the exact web authority and use the discovered web path for a mounted Forgejo fork.

Implemented with GPT-6.2 Sol (xhigh), Codex through LastCode.

Carry-Group: incubator
Carry-Observation: An issue URL names the exact host and port of its tracker.
Separate HTTP and HTTPS issue servers and keep the port on ordinary self-hosted repositories. Pass the selected Forgejo origin through credential selection.

Implemented with GPT-6.2 Sol (xhigh), Codex through LastCode.

Carry-Group: incubator
Carry-Observation: Exact issue targets include the scheme and effective web port.
Remove the tracker transport changes. Keep origin discovery and decline an issue scope when distinct web endpoints share one repository key. Cover create, comment, and unavailable origins with offline fixtures.

Implemented with GPT-6.2 Sol (xhigh), Codex through LastCode.

Carry-Group: incubator
Carry-Observation: Issue routing has no safe default when web remotes share a normalized repository key.
Keep a local-origin marker when discovery filters out local paths. The issue selector refuses the parent scope, without putting the local remote path in the project identity.

Implemented with GPT-6.2 Sol (xhigh), Codex through LastCode.

Carry-Group: incubator
Carry-Observation: A configured local origin must not be treated as an absent origin for issue writes.
@lastobelus lastobelus changed the title fix(issues): route project issues to the fork fix(issues): send fork project issues to the fork by default Nov 19, 2026
@lastobelus
lastobelus marked this pull request as ready for review November 19, 2026 22:40
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T22:43:49.303498Z 4591a09 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 4591a0996d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lastobelus
lastobelus merged commit f7d71e4 into lastcode/main Nov 19, 2026
47 of 69 checks passed
@lastobelus
lastobelus deleted the lastcode/issue-tools-fork-target branch November 19, 2026 23:26
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