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(control): read a stored PR wait's repository with the one owner/name grammar

reviewe264e7066760
diff --git a/src/shared/github-issue-ref.ts b/src/shared/github-issue-ref.ts
index 8c91f9e13..bb1e8aebb 100644
--- a/src/shared/github-issue-ref.ts
+++ b/src/shared/github-issue-ref.ts
@@ -42,7 +42,8 @@ export interface IssueRef {
* 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.
+ * board's repository parser, the avatar fetch in `core/github` and a stored `--after-pr` hold
+ * (`parseRepository`, below) read it too.
*/
export const GITHUB_OWNER_PATTERN = '[A-Za-z0-9][A-Za-z0-9-]{0,38}'
const OWNER = new RegExp(`^${GITHUB_OWNER_PATTERN}$`)
@@ -90,6 +91,8 @@ export function normalizeIssueRef(value: unknown): IssueRef | undefined {
}
/** `owner/repo` split into its halves, validated. Used for a project's configured repository. */
+/** `owner/repo`, validated with the grammar above. Exported so a stored `owner/repo` elsewhere
+ * (a `--after-pr` hold, `@shared/pr-wait`) is read with the same rule, never a copy of it. */
export function parseRepository(repository: unknown): { owner: string; repo: string } | undefined {
if (typeof repository !== 'string') return undefined
const slash = repository.indexOf('/')
diff --git a/src/shared/pr-wait.test.ts b/src/shared/pr-wait.test.ts
index ce003eb2c..7ab6b9384 100644
--- a/src/shared/pr-wait.test.ts
+++ b/src/shared/pr-wait.test.ts
@@ -180,6 +180,26 @@ describe('normalizePrWaitHold — a git-shared, hand-editable project file is ho
})
})
+describe('owner names GitHub really issued (a stored value is never narrower than GitHub)', () => {
+ // MEASURED 2026-09-29 (gh api users/<name>): `john-` (user), `Test-` (org), `hello--world` (user)
+ // and `foo--bar` (org) exist; `-foo` does not. A validator narrower than that would turn every
+ // stored hold on such a repository invalid on load, and the next save would write it out that way.
+ it.each(['john-/repo', 'Test-/x', 'hello--world/nodeterm', 'foo--bar/a.b_c-d'])('keeps a hold on %s', (repository) => {
+ const hold = { repository, waits: [{ number: 3, until: 'merged' }], deadlineAt: 5 }
+ expect(normalizePrWaitHold(hold)).toEqual(hold)
+ expect(parseAfterPrArg(`${repository}#3:merged`)).toEqual({
+ ok: true,
+ specs: [{ number: 3, until: 'merged', repository }]
+ })
+ })
+
+ it.each(['-foo/repo', 'o/-repo', 'o/..', 'o/.', 'a'.repeat(40) + '/r', 'o/r;x', 'o/r x'])('still refuses %s', (repository) => {
+ expect(normalizePrWaitHold({ repository, waits: [{ number: 3, until: 'merged' }], deadlineAt: 5 })).toEqual(
+ INVALID_PR_WAIT_HOLD
+ )
+ })
+})
+
describe('formatPrWaits', () => {
it('names each pull request and its condition', () => {
expect(
diff --git a/src/shared/pr-wait.ts b/src/shared/pr-wait.ts
index 4f5d7c4ea..b1198234e 100644
--- a/src/shared/pr-wait.ts
+++ b/src/shared/pr-wait.ts
@@ -68,6 +68,10 @@ export const RUN_NOW_AFTER_PR_REFUSAL =
const FORMS = 'N:checks or N:merged (N may be #N or owner/repo#N), comma-separated'
+// The repository a hold names is a STORED value, so it is read with the one owner/name grammar
+// (`parseRepository` over GITHUB_OWNER_PATTERN): what GitHub has actually issued, `john-` and
+// `hello--world` included. A narrower rule would turn every hold on such a repository invalid on
+// load and write it out that way on save.
const NUMBER = /^[1-9][0-9]{0,9}$/
const MAX_NUMBER = 2 ** 31 - 1