Skip to content

[Bug]: Issue URLs with an unconfigured port resolve to the wrong server #38009

Open

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Start T3 Code with no projects added.
  2. Point the hostname gitea.test at a computer you control. Run one Gitea or Forgejo at https://gitea.test with a repository acme/web whose issue 3 is titled Default port. Run a second, separate Gitea or Forgejo at https://gitea.test:8443 with a repository acme/web whose issue 3 is titled Port 8443.
  3. In T3 Code's source control settings, sign in to the server at https://gitea.test only. Leave https://gitea.test:8443 with no account and no project.
  4. Add a project from a git checkout whose origin remote is https://gitea.test/acme/web.git.
  5. Open a new thread in that project.
  6. Ask the agent to read https://gitea.test:8443/acme/web/issues/3.
  7. Ask the agent to comment on that same address with the text posted from T3.

Expected behavior

T3 refuses the address, because no project is signed in for gitea.test on port 8443. The thread does not show Default port, and neither issue receives the comment.

Actual behavior

The thread's Read an issue result shows the title Default port and that issue's body, from the server at https://gitea.test. The comment posted from T3 appears on that issue. Issue 3 at https://gitea.test:8443 still has the title Port 8443 and does not have the comment.

Impact

Minor bug or occasional failure. Anyone using an issue URL on an unconfigured port of a configured Forgejo hostname can read or modify a different server’s same-numbered issue every time.

Version or commit

main at bb29ee3e71. The cause is at apps/server/src/issue/IssueService.ts:640.

Environment

Linux x64, the repository's own tests.

Logs or stack traces

expected { Object (success) } to match object
Automated repro

Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.

diff --git a/apps/server/src/issue/IssueService.test.ts b/apps/server/src/issue/IssueService.test.ts
--- a/apps/server/src/issue/IssueService.test.ts
+++ b/apps/server/src/issue/IssueService.test.ts
@@ -258,6 +258,21 @@
         host: "gitea.test",
       });
 
+      const defaultPortOnly = yield* makeService({
+        projects: [
+          project({ id: "plain", repository: "acme/web", provider: "forgejo", host: "gitea.test" }),
+        ],
+        trackers: [fakeTracker({ kind: IssueTrackerKind.make("forgejo") })],
+      });
+      expect(
+        yield* defaultPortOnly
+          .resolveUrl("https://gitea.test:8443/acme/web/issues/3")
+          .pipe(Effect.result),
+      ).toMatchObject({
+        _tag: "Failure",
+        failure: { _tag: "IssueUnavailableError", reason: "tracker-unsupported" },
+      });
+
       // Another host is not reachable through this project's credentials at all.
       const elsewhere = yield* Effect.flip(service.detail({ ...own, host: "ghe.example.test" }));
       expect(elsewhere).toMatchObject({
cd apps/server && pnpm exec vp test run src/issue/IssueService.test.ts -t 'reads another repository'

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions