mirror of
https://github.com/stablyai/orca.git
synced 2026-09-26 08:02:38 +00:00
* fix(github): resolve owner/repo through SSH Host aliases (#10284) Expand OpenSSH Host → HostName via ssh -G before classifying github.com identity so PR merge works when origin is git@alias:owner/repo.git. Transport URLs stay unchanged so IdentityFile selection is preserved. Do not long-negative-cache indeterminate ssh -G failures. * fix(github): harden SSH alias resolution
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
import { execFile } from 'node:child_process'
|
|
import { promisify } from 'node:util'
|
|
import { gitExecFileAsync, ghExecFileAsync } from '../git/runner'
|
|
// Pure error-parsing helpers come from the lightweight module (not `runner`) so
|
|
// tests that mock `../git/runner` still resolve the real implementations.
|
|
import { extractExecError, parseRetryAfterMs } from '../git/exec-error'
|
|
|
|
// Why: legacy generic execFile wrapper - only used by callers that don't need
|
|
// WSL-aware routing. Repo-scoped callers should use the runner exports below.
|
|
export const execFileAsync = promisify(execFile)
|
|
export { ghExecFileAsync, gitExecFileAsync, extractExecError, parseRetryAfterMs }
|
|
export { classifyGhError, classifyListIssuesError } from './gh-error-classification'
|
|
export {
|
|
_getOwnerRepoCacheSize,
|
|
_resetOwnerRepoCache,
|
|
getOwnerRepoForRemote,
|
|
getRemoteUrlForRepo,
|
|
ghRepoExecOptions,
|
|
githubRepoContext,
|
|
parseGitHubOwnerRepo,
|
|
parseGitHubRemoteIdentity
|
|
} from './github-repository-identity'
|
|
export type {
|
|
GitHubRemoteIdentity,
|
|
GitHubRepoContext,
|
|
LocalGitExecOptions,
|
|
OwnerRepo
|
|
} from './github-repository-identity'
|
|
export {
|
|
getIssueOwnerRepo,
|
|
getOwnerRepo,
|
|
resolveIssueSource,
|
|
resolvePRRepositoryCandidates
|
|
} from './github-owner-repo-selection'
|
|
export type { PRRepositoryCandidates, ResolvedIssueSource } from './github-owner-repo-selection'
|
|
|
|
const MAX_CONCURRENT = 4
|
|
let running = 0
|
|
const queue: (() => void)[] = []
|
|
|
|
export function acquire(): Promise<void> {
|
|
if (running < MAX_CONCURRENT) {
|
|
running += 1
|
|
return Promise.resolve()
|
|
}
|
|
return new Promise((resolve) =>
|
|
queue.push(() => {
|
|
running += 1
|
|
resolve()
|
|
})
|
|
)
|
|
}
|
|
|
|
export function release(): void {
|
|
running -= 1
|
|
const next = queue.shift()
|
|
if (next) {
|
|
next()
|
|
}
|
|
}
|