Issue-to-PR Automation
RepositoryMonitor can run a durable maintainer-controlled issue-to-PR loop from orka:* labels or equivalent API/CLI/UI commands.
Flow
- A maintainer labels an issue with
orka:implement(or runsorka monitor issue implement <monitor> <number>). - Orka verifies the webhook signature and current GitHub actor permission, then records a durable
command_event. - A
work_actionis queued with the monitor generation, target snapshot digest, dedupe key, and command ID. - Orka inventories the issue and computes a content digest that excludes Orka-authored labels/comments.
- Optional triage and research commands run as hardened read-only agent tasks. If an
implementcommand has no approved plan, Orka queues a read-only planning task first. - If policy requires approval, the workflow stops until
orka:approve-planor the equivalent CLI/API/UI command; otherwise the original implement command continues automatically. - Implementation runs as a patch-only task. The agent returns an
orka.issueImplementation.v1status, and the worker-owned result finalizer captures the actual workspace diff and changed paths. - The controller validates and stores an
orka.patch.v1artifact, then creates a deterministic general-worker mutation task with a configured push branch. - The mutation task applies and pushes only the validated prior-task diff; the controller creates or reuses the PR and records GitHub mutation audit rows.
- PR review and repair continue on exact heads until the PR reaches
merge_readyor a clear blocked state.
Safety model
- Issue and PR text is untrusted input.
- Read-only agents never receive GitHub mutation credentials or direct Git credentials. Claude roles receive only scoped read tools with Bash denied; Codex roles run shell commands inside a read-only Landlock sandbox and receive only a short-lived loopback runtime-auth token. Copilot and external
runtimeRefruntimes are rejected for this hardened mode. - Implementation agents receive only runtime model credentials and a pre-cloned writable workspace, never Git push credentials. Codex and Claude are supported; Copilot is rejected because its runtime credential can mutate GitHub.
- Code-changing tasks must produce a validated patch artifact before any branch push.
- GitHub writes are controller-owned and recorded in
github_mutation_records. - Stop commands cancel queued workflow actions and active monitor Tasks, and prevent post-task mutation from stale task results.
- Repair commands execute only when
spec.repair.enabledis true and remain bounded bymaxRepairsPerPRandmaxRepairsPerHeadwhen configured. - Plans and implementation are bound to issue content digests; human edits make downstream artifacts stale.
planning.requireHumanApprovalFormatches either a plan risk level (for examplehigh) or a plan category (for examplesecurityordatabase-migration). Legacy plan results without acategoriesfield require approval when category-based policy is configured.
CLI quick reference
orka monitor issue plan orka-main 123
orka monitor issue approve-plan orka-main 123
orka monitor issue implement orka-main 123
orka monitor issue implementation get orka-main 123
orka monitor mutations list orka-main --kind issue --number 123
orka monitor pr review orka-main 456 --target-sha <head-sha>
orka monitor pr fix orka-main 456 --target-sha <head-sha>
orka monitor pr ready readiness orka-main 456
orka monitor work-actions list orka-main --kind issue --number 123
Debugging blocked work
Use the workflow timeline first:
orka monitor work-actions list orka-main --status blocked
orka monitor doctor orka-main
Blocked records include a low-cardinality reason such as stale_command_snapshot, security_sensitive, patch_path_denied, validation_failed, or stopped_by_command. The dashboard shows the same blocked reason alongside implementation jobs and GitHub mutation records.
Implementation budgets and path policy
spec.issueWorkflow.implementation bounds code-changing work before a mutation task can push a branch:
maxActivecaps active issue implementation/mutation jobs per monitor (default2).maxAttemptsPerIssuecaps implementation attempts for one issue (default2).maxChangedFilescaps files in anorka.patch.v1artifact (default12).allowedPathsoptionally restricts patch files to monitor-owned glob/prefix allowlists such asapi/**,internal/**, ordocs/**.
Denied paths and secret scanning are always enforced before allow-list checks.
Rate-limit and retry states
Monitor runs classify transient infrastructure failures into low-cardinality states that are written to monitor events and metrics:
github_rate_limitedfor GitHub primary/secondary rate-limit responses.llm_rate_limitedfor model-provider throttling surfaced through workflow errors.cluster_capacity_blockedfor Kubernetes capacity/quota pressure.retry_scheduledfor retryable transient failures.
Use orka monitor events <monitor> --event-type run_failed or the dashboard audit/timeline panels to see the state attached to failed runs.
Fake-GitHub validation
Run the integrated, secret-free validation suite locally with:
make repository-monitor-fake-e2e
For the broader local validation bundle that also checks generated CLI docs, example manifests, website docs, and workflow syntax, run:
make repository-monitor-validate
The suite covers durable command intake, replay/coalescing, guard-label blocking, issue implementation to PR, stop/resume late-task safety, PR review/repair/readiness, and optional automerge against fake GitHub servers. The Repository Monitor Smoke GitHub Actions workflow runs the same fake-GitHub E2E script on relevant PRs.
Patch previews are available through orka monitor issue patch preview <monitor> <issue-number> or GET /api/v1/monitors/implementation-jobs/{id}/patch-preview; the endpoint returns safe orka.patch.v1 metadata instead of blindly streaming arbitrary task output.
Live GitHub/kind preflight
The optional live/manual E2E requires Docker, kind, kubectl, the local Orka images, and a target GitHub repository/issue. Check local prerequisites without changing the cluster with:
make repository-monitor-live-preflight
If Docker is not running, the preflight exits before creating or modifying a kind cluster.
Completion audit helper
Run the local validation bundle plus the live preflight with:
make repository-monitor-completion-audit
The audit exits non-zero when the live preflight is blocked (for example, Docker is not running), but still prints which RepositoryMonitor requirements are covered by the local fake-GitHub validation bundle.