Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(github): accept the GitHub logins that exist, consecutive and trailing hyphens included

reviewf853f891d831
diff --git a/src/core/github/github-issue-ref.config-agreement.test.ts b/src/core/github/github-issue-ref.config-agreement.test.ts
index 5c2d317d4..9e18fcd50 100644
--- a/src/core/github/github-issue-ref.config-agreement.test.ts
+++ b/src/core/github/github-issue-ref.config-agreement.test.ts
@@ -17,7 +17,8 @@ const CORPUS = [
'o/-r',
'-o/r',
'o-/r',
- 'a--b/r',
+ 'hello--world/a',
+ 'john-/x',
'a-b-c/r',
'o/r;rm',
'o/r`id`',
@@ -32,10 +33,12 @@ const CORPUS = [
]
describe('issue-reference grammar agrees with the board repository parser', () => {
- it('both refuse an owner with consecutive hyphens (GitHub allows only single inner ones)', () => {
- expect(parseGitHubRepository('a--b/r')).toBeNull()
- expect(parseGitHubRepository('https://github.com/a--b/r.git')).toBeNull()
- expect(parseGitHubRepository('a-b-c/r')).toBe('a-b-c/r')
+ it('both accept the logins GitHub has issued, consecutive and trailing hyphens included', () => {
+ // Real accounts (`hello--world`, `john-`); a board synced with one must keep syncing.
+ expect(parseGitHubRepository('https://github.com/hello--world/a.git')).toBe('hello--world/a')
+ expect(parseGitHubRepository('[email protected]:john-/x.git')).toBe('john-/x')
+ expect(resolveIssueArg('#1', 'hello--world/a').ok).toBe(true)
+ expect(parseGitHubRepository('-foo/r')).toBeNull()
})
it.each(CORPUS)('%j', (slug) => {
diff --git a/src/core/github/project-avatar.test.ts b/src/core/github/project-avatar.test.ts
index 99e2d605c..a826b7187 100644
--- a/src/core/github/project-avatar.test.ts
+++ b/src/core/github/project-avatar.test.ts
@@ -94,7 +94,7 @@ describe('resolveProjectAvatarDataUrl', () => {
it('refuses an owner GitHub could not have issued, before any request', async () => {
let fetched = false
- for (const owner of ['a--b', '-acme', 'acme-', '../x']) {
+ for (const owner of ['-acme', 'x'.repeat(40), '../x', 'a/b', 'a?b']) {
expect(await resolveProjectAvatarDataUrl({
owner,
fetchImpl: async () => { fetched = true; return userJson(AVATAR) }
diff --git a/src/renderer/state/workspace.test.ts b/src/renderer/state/workspace.test.ts
index 1e29a70d2..9c5e7e34b 100644
--- a/src/renderer/state/workspace.test.ts
+++ b/src/renderer/state/workspace.test.ts
@@ -720,6 +720,17 @@ describe('issueRef serialization (GitHub issue binding)', () => {
expect(nodeStatesToFlow(states)[0].data.issueRef).toEqual(ref)
})
+ it('keeps a binding whose owner GitHub issued with consecutive or trailing hyphens', () => {
+ // `hello--world` and `john-` are real accounts. A grammar that refused them dropped the
+ // binding on load, and the next save wrote it out of project.json for good.
+ for (const owner of ['hello--world', 'john-']) {
+ const kept = { owner, repo: 'a', number: 1 }
+ const loaded = nodeStatesToFlow([stateWithIssue(kept) as never])
+ expect(loaded[0].data.issueRef).toEqual(kept)
+ expect(flowToNodeStates(loaded)[0].issueRef).toEqual(kept)
+ }
+ })
+
it('tolerates its absence: a node saved before the feature hydrates with no binding', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { issueRef: _omit, ...legacy } = stateWithIssue(undefined) as any
diff --git a/src/shared/github-issue-ref.test.ts b/src/shared/github-issue-ref.test.ts
index 2f546ba92..e2bdc8608 100644
--- a/src/shared/github-issue-ref.test.ts
+++ b/src/shared/github-issue-ref.test.ts
@@ -41,9 +41,7 @@ const HOSTILE = [
'o/..#1',
'o/.#1',
'-o/r#1',
- 'o-/r#1',
- // GitHub allows only SINGLE inner hyphens in a login.
- 'a--b/r#1',
+ // A leading hyphen reads as a flag and GitHub has never issued one.
'---/r#1',
'o/-r#1',
'o//r#1',
@@ -69,6 +67,16 @@ describe('parseIssueArg', () => {
expect(parseIssueArg('#7')).toEqual({ ok: true, kind: 'local', number: 7 })
})
+ it('accepts the logins GitHub has actually issued: consecutive and trailing hyphens', () => {
+ // Real accounts, checked read-only against api.github.com (2026-09-29): `hello--world` (user,
+ // 2014), `foo--bar` (organization), `john-` (user, 2012), `Test-` (organization). GitHub's
+ // CURRENT sign-up rule is stricter, but the grammar answers for every account that exists.
+ for (const raw of ['hello--world/a#1', 'foo--bar/arthanaya#1', 'john-/x#1', 'Test-/r#2']) {
+ expect(parseIssueArg(raw), raw).toMatchObject({ ok: true })
+ }
+ expect(parseIssueArg(`${'x'.repeat(40)}/r#1`).ok).toBe(false)
+ })
+
it('accepts the repository names GitHub allows (dots, underscores, a leading dot)', () => {
expect(parseIssueArg('a-b/.github#1')).toMatchObject({ ok: true })
expect(parseIssueArg('A1/x_y.z-w#2147483647')).toMatchObject({ ok: true })
diff --git a/src/shared/github-issue-ref.ts b/src/shared/github-issue-ref.ts
index 7c6096437..a3cf7388c 100644
--- a/src/shared/github-issue-ref.ts
+++ b/src/shared/github-issue-ref.ts
@@ -19,10 +19,11 @@
// rendered. Same discipline as `SAFE_SESSION_ID` and `permissionModeFlag`: re-check at the
// interpolation site, never trust the type.
//
-// The grammar is GitHub's own, not a loosened one: an owner is 1–39 alphanumerics or single inner
-// hyphens (no leading/trailing hyphen), a repository name is 1–100 of `[A-Za-z0-9_.-]` that is not
-// `.`/`..` and does not start with `-`, and an issue number is a positive 32-bit integer written
-// without a sign, exponent or leading zero. Nothing in that alphabet is a shell metacharacter,
+// The grammar is what GitHub has actually issued, not a loosened one: an owner is 1–39
+// alphanumerics and hyphens that does not start with a hyphen (see GITHUB_OWNER_PATTERN for why
+// consecutive and trailing hyphens are accepted), a repository name is 1–100 of `[A-Za-z0-9_.-]`
+// that is not `.`/`..` and does not start with `-`, and an issue number is a positive 32-bit
+// integer written without a sign, exponent or leading zero. Nothing in that alphabet is a shell metacharacter,
// quote, whitespace or control byte. `core/github/config.ts` parses a repository slug with the same
// owner/name patterns (`github-issue-ref.config-agreement.test.ts` pins that the two agree).
@@ -33,12 +34,17 @@ export interface IssueRef {
}
/**
- * A GitHub login (user or organization): 1–39 characters, alphanumerics and SINGLE inner hyphens —
- * no leading, trailing or consecutive hyphen. A hyphen must be followed by an alphanumeric (the
- * lookahead), which is what refuses all three. Unanchored so it embeds in a slug pattern; the ONE
- * definition — the board's repository parser and the avatar fetch in `core/github` read it too.
+ * A GitHub login (user or organization): 1–39 alphanumerics and hyphens, never STARTING with a
+ * hyphen (it would read as a flag, and GitHub has never issued one). Consecutive and trailing
+ * hyphens are accepted on purpose: GitHub's current sign-up rule forbids them, but it issued them
+ * before — `hello--world` (user, 2014), `foo--bar` (organization), `john-` (user, 2012) and `Test-`
+ * (organization) all exist (checked read-only against api.github.com, 2026-09-29). A grammar that
+ * refuses a real account stops that board syncing and DROPS every stored issue binding naming it
+ * at load, and the next save writes them out of project.json. Nothing here is a shell
+ * metacharacter either way. Unanchored so it embeds in a slug pattern; the ONE definition — the
+ * board's repository parser and the avatar fetch in `core/github` read it too.
*/
-export const GITHUB_OWNER_PATTERN = '[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}'
+export const GITHUB_OWNER_PATTERN = '[A-Za-z0-9][A-Za-z0-9-]{0,38}'
const OWNER = new RegExp(`^${GITHUB_OWNER_PATTERN}$`)
const REPO = /^[A-Za-z0-9_.-]{1,100}$/
const NUMBER = /^[1-9][0-9]{0,9}$/