Repository monitors
A RepositoryMonitor puts a GitHub repository under agent care. It reviews pull requests as
they arrive and posts the findings back, and it can also plan and implement issues, repair
pull requests when review or CI asks, and publish a readiness check that GitHub's auto-merge
can wait on. Every run, item, review, and GitHub write is recorded durably and shown in the
API, the CLI, and the dashboard's Monitors page.
Reviews run as read-only coding-agent Tasks bound to the exact pull request head. GitHub writes — review comments, branch pushes, pull requests, labels, and statuses — are made by Orka's controller and publisher and recorded in an audit log, never by an agent. GitHub's own auto-merge owns merging; Orka publishes readiness and never merges.
repository-monitor-pr-review-repair
reviews and repairs pull requests;
repository-monitor-issue-plan-only
triages and plans issues without writing code. To go from an issue label to a merge-ready
pull request, see Issue-to-PR automation.
What it does
A repository monitor can:
- list open pull requests for one GitHub repository and base branch
- inventory open GitHub issues, excluding pull-request-shaped issues
- skip drafts unless explicitly configured to include them
- skip PRs blocked by configured protected or pause labels
- skip PR heads that already have a fresh review result
- queue one read-only review task per selected PR head
- refetch one pull request for targeted manual and webhook runs before queueing review work
- queue exact-head monitor runs from GitHub pull request webhook events
- ingest typed JSON review results from completed review tasks
- store monitor runs, issue/PR items, command events, workflow actions, action records, implementation jobs, mutation records, review records, and audit events durably
- show monitor status, recent runs, workflow timeline, blocked reasons, implementation jobs, mutation audit, issues, and the PR queue in the dashboard under Monitors
The review Task is bound to the exact PR head SHA. It runs as a type: agent Task with workspace.intent: read, receives no Git credential, and must leave the verified tree unchanged. If spec.review.publish.enabled is true, the controller later revalidates the PR state and may publish a deterministic neutral COMMENT review with spec.forgeCredentialRef.
Prerequisites
Create a built-in runtime Agent in the same namespace as the monitor, or set spec.agents.reviewer.namespace explicitly. Built-in runtime Agents must not set spec.secretRef; provider authentication is supplied by the controller-managed runtime proxy.
apiVersion: core.orka.ai/v1alpha1
kind: Agent
metadata:
name: repo-reviewer
namespace: orka-system
spec:
runtime:
type: claude
defaultMaxTurns: 50
defaultAllowedTools:
- Read
- Grep
- Glob
model:
name: claude-opus-5
systemPrompt:
inline: |
Review the exact pull request head for correctness, tests, security, and maintainability.
Return concise, structured findings and do not mutate GitHub.
For private repositories or higher GitHub rate limits, create a source-read Secret in the monitor namespace. When a monitor is created or updated through the API, Orka validates that each configured credential Secret exists and contains a non-empty token, password, or GITHUB_TOKEN key.
kubectl create secret generic repo-monitor-source-read \
--namespace orka-system \
--from-literal=token='<read-only-github-token>'
For review, triage, research, and planning Tasks, the controller maps RepositoryMonitor.spec.readCredentialRef to top-level workspace.readCredentialRef. spec.gitSecretRef is accepted only as a compatibility fallback for this source-read role. The clean-room source boundary resolves it for same-repository private PR heads; the ACP runtime never receives the Secret. Fork PR heads use the eligible source repository URL and remain read-only.
Implementation and repair are write workflows and require four explicit, pairwise-distinct Secret references:
| RepositoryMonitor field | Task workspace role | Required capability |
|---|---|---|
readCredentialRef | workspace.readCredentialRef | Source clone/read only |
publicationReadCredentialRef | workspace.publicationReadCredentialRef | Target preflight and independent verification only |
publicationCredentialRef | workspace.publicationCredentialRef | Exact compare-and-swap branch push |
forgeCredentialRef | workspace.forgeCredentialRef | Controller-owned GitHub API operations and PR reconciliation |
gitSecretRef never supplies a write, publication, or forge role. A write Task is not created when any explicit role is missing or when two roles reference the same Secret. Credential values are resolved only by the controller/Workspace Publisher brokers and never appear in ACP process environment, prompts, Task status, or delivery receipts.
Create a monitor
apiVersion: core.orka.ai/v1alpha1
kind: RepositoryMonitor
metadata:
name: example-app
namespace: orka-system
spec:
provider: github
repoURL: https://github.com/example/app
branch: main
readCredentialRef:
name: repo-monitor-source-read
schedule: "*/30 * * * *"
timeZone: "UTC"
targets:
pullRequests:
enabled: true
includeDrafts: false
maxPerRun: 10
agents:
reviewer:
name: repo-reviewer
review:
event: COMMENT
staleReviewTTL: 24h
exactEventEnabled: true
policy:
protectedLabels:
- security-sensitive
pauseLabels:
- orka:pause
validation:
image: ghcr.io/example/app-validation@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Apply it with:
kubectl apply -f repository-monitor.yaml
The controller normalizes provider, owner, repository, branch, pull request enablement, maxPerRun, and review.event when omitted. review.publish.enabled defaults to false; when enabled, V1 rejects publish events other than COMMENT and same-head policies other than skip or update.
Limit the monitor to labelled pull requests
By default a monitor covers every open pull request on its branch. To opt pull requests in one at a time, set spec.targets.pullRequests.includeLabels:
spec:
targets:
pullRequests:
includeLabels:
- orka:review
Only pull requests with at least one of these labels (case-insensitive) are reviewed, repaired, or given a readiness status. Orka reads the labels on every inventory run, so no webhook is needed. Removing the label retires the pull request from the monitor: its unfinished review and repair Tasks are cancelled, a readiness status it already published turns to failure, and a stop it was under still applies if the label returns. Commands that target an unlabelled pull request are blocked with target_not_included, except stop, which always applies. Readiness is a commit status, so an unlabelled pull request whose head commit and base branch match a labelled one shows that pull request's readiness. This setting cannot be combined with issue implementation, because the pull requests Orka opens would not carry the label.
Repair labelled pull requests
With spec.repair.enabled, Orka repairs every pull request it reviews. Repair labels narrow that, so one label asks for a review and another for fixes:
spec:
targets:
pullRequests:
includeLabels:
- orka:review
repair:
enabled: true
maxRepairsPerPR: 3
includeLabels:
- orka:fix
ciOnlyLabels:
- orka:fix-ci
| Label | Review | Fixes |
|---|---|---|
orka:review | Yes | None |
orka:fix | Yes | Review findings, CI the pull request broke, and merge conflicts |
orka:fix-ci | No | CI the pull request broke |
A pull request with a repair.includeLabels label is reviewed even when targets.pullRequests.includeLabels does not list that label. Each head is reviewed before it is repaired, so the label runs a review-fix loop: findings from a needs_changes review are fixed first, CI is fixed once the review has nothing to fix, and every pushed fix is reviewed again. The loop stops when the review passes and no check the pull request broke is failing, or when the repair limits are reached.
A repair.ciOnlyLabels pull request is not reviewed unless the monitor selects it for review anyway, for example because targets.pullRequests.includeLabels is empty or a review include label is also present. A pull request selected only for CI repair gets no published review or readiness status, and a review command on it is blocked with ci_only. The label limits repair to CI even when the monitor would otherwise repair that pull request in full; a repair.includeLabels label on the same pull request takes precedence.
Before each new repair that a label grants, and again before a queued repair runs, Orka reads the pull request's event history to find who added the label and checks that account's repository permission against spec.triggers.github.labels.requireActorPermission (default write) and spec.policy.allowedRepositoryPermissions. GitHub lets accounts with the Triage role add labels, so this check stops them from getting code pushed. A label added by an account without the permission, or one Orka cannot resolve, marks the repair repair_label_actor_not_permitted. A queued repair whose label was removed before it ran is skipped as repair_scope_withdrawn, and a queued CI repair whose head no longer has a failure the pull request introduced is skipped as no_introduced_ci_failure. Repair commands sent through the API are not label-gated.
Repair labels cannot be combined with issue implementation.
If an existing monitor still uses validation.mode and validation.commands, migrate it before upgrading the controller. Apply the new CRD first, replace the legacy fields with a digest-pinned validation.image, and remove the old fields. The compatibility schema preserves a non-empty legacy command list long enough for the controller to report LegacyValidationCommandsUnsupported; it will not run the monitor with validation silently disabled.
Run manually
Scheduled runs are queued from spec.schedule when the monitor is not suspended. You can also trigger a manual run through the API:
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"https://<orka-api-host>/api/v1/monitors/repositories/example-app/runs?namespace=orka-system" \
-d '{}'
To target one pull request, include targetKind and targetNumber:
{
"targetKind": "pull_request",
"targetNumber": 123
}
targetSHA can also be supplied to require an exact head SHA match.
When targetNumber is set, the controller fetches that pull request directly from GitHub before applying the monitor's open-state, base-branch, draft, label, stale-review, and optional targetSHA checks. Targeted runs do not retire missing or out-of-scope items from the repository-wide inventory, so monitor status counts continue to summarize the stored PR queue rather than only the targeted PR.
A run never re-reviews a head whose review is still current. To review the same head again, for example after you change the reviewer's rules, send a review command for that head:
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"https://<orka-api-host>/api/v1/monitors/repositories/example-app/commands?namespace=orka-system" \
-d '{"kind": "pull_request", "number": 123, "intent": "review", "targetSHA": "<head sha>"}'
fix, fix_ci, and update_branch commands take the same body. Commands sent through the API are not limited by repair labels.
Run from GitHub events
Repository monitors can also receive exact pull request events through the same signed GitHub webhook endpoint used by label triggers. Configure the repository webhook for Pull requests events and set spec.review.exactEventEnabled: true on the monitor.
When /webhooks/github receives an opened, reopened, synchronize, ready_for_review, labeled, or unlabeled pull request event, Orka matches monitors by repository and base branch. If the controller has a watch namespace, only monitors in that namespace are considered; otherwise monitors across all namespaces are eligible. A matching monitor queues a run with targetKind: pull_request, the PR number, and the exact head SHA from the webhook payload. Replayed deliveries and already-queued runs for the same PR head are accepted without creating duplicate monitor work. If a previous exact-event run for the same delivery failed before the queued audit event was recorded, a webhook retry can requeue that failed run.
Exact event runs are still read-only review runs. They are stored with trigger pull_request_event, create an exact_event_run_queued audit event, and wait behind any active or queued monitor run. When the run executes, Orka refetches the current pull request by number and skips review work if the PR is no longer open, moved to another base branch, or no longer matches the event head SHA.
Inspect state
Use kubectl for CRD-level status:
kubectl get repositorymonitors -n orka-system
kubectl describe repositorymonitor example-app -n orka-system
Use the API or dashboard for durable run and item state:
curl -H "Authorization: Bearer $TOKEN" \
"https://<orka-api-host>/api/v1/monitors/repositories?namespace=orka-system"
curl -H "Authorization: Bearer $TOKEN" \
"https://<orka-api-host>/api/v1/monitors/repositories/example-app/runs?namespace=orka-system"
curl -H "Authorization: Bearer $TOKEN" \
"https://<orka-api-host>/api/v1/monitors/repositories/example-app/items?namespace=orka-system&kind=pull_request"
curl -H "Authorization: Bearer $TOKEN" \
"https://<orka-api-host>/api/v1/monitors/events?namespace=orka-system&name=example-app"
The embedded dashboard shows the same state under Monitors:
- monitor list with phase, schedule, repository, and summary counts
- detail page with open PR count, pending reviews, blocked items, merge-ready count, recent runs, and PR queue
- manual Run action for an immediate monitor run
Review workspace context
The review Task is pinned to the exact PR head SHA with workspace.intent: read. Before creating it, the controller fetches the pull request identity, lists the pull request's changed files with their patches, and refetches the pull request to ensure the base, head, and head repository did not change during context assembly. The drift check runs even when the file listing failed, so a race fails closed instead of queueing a stale review; a GitHub read failure does not fail the run and instead marks the context contextUnavailable.
The controller embeds a bounded orka.prReview.context.v1 payload in the prompt: at most 700 KiB encoded context, patch excerpts (at most 64 KiB encoded each) for the first 100 changed files, and path-only identity entries (patchOmitted: "capped") for up to 2,000 changed files, with bounded paths/short metadata fields. Identities take precedence over patches inside the byte budget: patches are dropped first, and truncated.files is set only when the complete change set could not be represented — a missing identity, a compare listing shorter than the pull request's changed_files total (GitHub caps the compare file array at 300 entries), or an omitted patch that hides content the checkout cannot show (a removed file, a renamed file's previous contents, or deleted lines in any changed file). Because the checkout carries no Git metadata, the prompt then requires a non-passed verdict (needs_human or stricter). Patches and paths pass through the shared credential redaction before they are persisted in the Task prompt. The prompt treats titles, labels, paths, patches, and repository content as untrusted data and tells the reviewer to inspect the verified checkout whenever GitHub context is incomplete.
If a Task with the predictable review name already exists, the controller adopts it only when its spec is byte-identical to the freshly rendered review (including the diff context) or carries only the controller-shaped contextUnavailable envelope; any other pre-existing Task fails the run.
The reviewer must not mutate the verified tree. Any unexpected workspace change fails read validation. GitHub review publishing, when enabled, happens later through the controller's deterministic publisher path; the ACP child has no GitHub mutation credential.
If spec.validation.image is configured, the review Task also receives the brokered run_validation tool. The reviewer inspects the repository and supplies one shell command. Orka creates one container Task with the configured image, a 45-minute timeout, and the same exact-head read-only workspace. The checkout init container finishes first. Orka then installs a deny-all NetworkPolicy before releasing the validation command. The reviewer cannot change the image, checkout, credentials, publication settings, or network policy. It can wait only for its own child Task through wait_for_tasks before returning the review result.
The image is repository-specific, not language-specific. It must contain /bin/sh plus every compiler, linter, package manager, dependency, or infrastructure CLI that validation may need. The command cannot download modules, packages, providers, or contact cloud APIs. A Go repository that uses golangci-lint should point at a Go-based image with dependencies and golangci-lint installed. Repositories that run offline Terraform or Azure CLI checks should include those tools and required local data. Maintainers can build and publish that image once, then reuse it in the repository's monitor configuration.
Validation fails closed when configured. A reviewer that does not call the tool, a failed command, a non-terminal child Task, or a child Task whose image or checkout no longer matches the review cannot produce a passed or merge-ready result. Orka stores the image, command digest, status, and safe evidence in the durable review record. The validation binding retains the same SHA-256 command digest. Validation stdout and stderr are suppressed so repository or fixture secrets cannot enter Pod logs or result storage. A failure before workload execution is recorded as unavailable, and the same head remains eligible for a later review. No validation Task is required when spec.validation.image is empty; the review records validation as not_run.
Review results
Review tasks must return a JSON object with schema version orka.prReview.v1. The controller validates the repository, PR number, and exact head SHA before accepting the result. When validation is configured, the controller also verifies the child validation Task independently of the reviewer's reported test status. Accepted results are stored as immutable review records and copied onto the current monitor item.
Valid review verdicts are:
passedneeds_changesneeds_humansecurity_sensitiveskipped
Orka decides between passed and needs_changes itself, from the open findings: any open finding at spec.review.blockingPriority (default P1) or above means needs_changes, whatever the reviewer's own verdict. When the two differ, the summary says so. The reviewer's needs_human, security_sensitive, and skipped verdicts stand. The threshold is applied when a review is recorded, so changing blockingPriority affects reviews from then on; push a commit or send a review command to re-evaluate a pull request that was already reviewed.
Follow-up reviews
Each accepted review stores the pull request's record of findings: every finding Orka has tracked, with a stable ID and a status of open or fixed. With spec.review.trigger: push (the default), every new head is reviewed:
- The first review of a pull request, or of a head that rewrote history (a rebase or force-push), is a full review. So is the review after one whose diff context was unavailable or truncated, since a follow-up review would never check the part it missed.
- A follow-up review covers a head that builds on the last reviewed head. The reviewer sees the whole pull request, the changes since the last review (only the pull request's own files, so changes merged in from the base branch are not reviewed again), and the open findings. It reports whether each open finding is fixed, in a
previousFindingslist of{"id", "status"}entries, and reports only new defects the changes introduce or expose. A new finding that restates an open one (same file and a nearby line, or the same title) is dropped. - Findings outside the new changes count only at
P1or above; lower ones are listed under "Outside the new changes (not blocking)". - A re-review of an unchanged head, such as a
reviewcommand, can add findings but cannot mark any fixed, so the verdict does not flip without a code change.
The published review lists the open findings (marking those open since an earlier commit) and the findings fixed in this commit. Inline comments go only on findings first reported at this head, so earlier findings keep their original threads. When a follow-up review finds a finding fixed, Orka prefixes its inline comment with "✅ Addressed in <commit>" and resolves the comment's thread. It only touches comments on reviews it published, marks each finding once, and a GitHub failure here does not hold up the review; inventory polls retry a failed attempt every five minutes for an hour after the review while its head is current. Unless review.publish.postSecuritySensitive is set, it never marks a finding from a security-sensitive review, since the note would link the finding to its fix.
With spec.review.exhaustive: true, a full review repeats on the same head until a pass finds nothing new, at most three passes, so follow-up reviews start from every finding instead of uncovering them one round at a time. Each pass sees the findings already recorded and reports only additional ones. Until the last pass, the head does not count as reviewed: readiness and repairs wait, and only the last pass is published, with every finding. With review.requireGreenCI, only the first pass waits for green CI, so CI that fails between passes does not stall the chain. Follow-up reviews run once.
Each review asks the reviewer to report a defect that repeats a pattern once, naming the pattern and listing every other place it occurs, and each repair asks the repairer to fix every listed instance, so one round can fix a whole class of defect.
With spec.review.maxRounds, Orka stops a pull request that keeps failing review from cycling indefinitely. It counts the heads reviewed since the pull request's last passed review, counting several reviews of one head once and skipping failed or stale reviews. When a needs_changes review is of the head that reaches the limit, Orka records needs_human instead and prefixes the summary with a note asking the author to reconsider the approach. The findings stay open and published, but automatic repair of review findings stops; CI repair is unaffected. A later passed review resets the count, unless a later review of the same head, such as another exhaustive pass, did not pass. The limit is unset by default; 3 is a reasonable starting point.
With spec.review.trigger: open, Orka reviews each pull request once; later heads are reviewed only on a review command. staleReviewTTL still applies to the reviewed head, so an unchanged head is reviewed again once its review is older than the TTL; leave the TTL unset for strictly one review per pull request. Pull requests that automatic repair may fix are still reviewed on every push, because each pushed fix needs a review.
Review metrics
The controller exports three Prometheus metrics for judging whether reviews converge and how noisy they are:
orka_repository_monitor_reviews_total{mode, verdict}counts review records by review mode (full,incremental, orsame_head) and recorded verdict, rejected reviews included.orka_repository_monitor_review_findings_total{priority, outcome}counts findings when firstreportedand when a later review marks themfixed. A low fixed-to-reported ratio suggests findings that authors do not act on.orka_repository_monitor_review_rounds_to_passrecords, at each pull request's first passed review, how many heads were reviewed to get there. Orka also records areview_first_passedmonitor event with the count, which keeps later passes, including areviewcommand on an already passed head, from counting again; an exhaustive pass that another pass will extend does not count. Itsle="1"bucket divided by its count is the share of pull requests that passed on their first reviewed head; its sum divided by its count is the mean.
These metrics have no per-monitor labels, and like other Prometheus counters they reset when the controller restarts.
For status summaries, open PRs with needs_changes, needs_human, security_sensitive, stale, failed, or skipped review state count as blocked items. Open PRs with queued review work count as pending reviews.
If a review task fails, is cancelled, returns malformed JSON, or returns a stale head SHA, the controller records a rejected review result and leaves an audit event explaining why. If GitHub publishing is enabled, the controller performs publish-time safety checks immediately after ingestion: it refetches the PR, requires the PR to remain open on the monitor base branch and exact reviewed head SHA, rejects draft or protected-label PRs, skips duplicate same-head publications using Orka publish records and hidden GitHub markers, neutralizes mentions in rendered text, and never posts security_sensitive results unless explicitly configured.
If GitHub returns HTTP 401 during publication, the controller records github_authentication_failed and retries after the existing five-minute publish cooldown. Each attempt reloads spec.forgeCredentialRef, so refreshing an expired GitHub App installation token lets the controller publish the completed review without running the reviewer again. Every retry repeats the PR safety and duplicate checks. Orka does not refresh the token itself; an invalid or revoked credential continues to fail until replaced. Non-rate-limited HTTP 403 and HTTP 404 responses remain terminal permission failures. Older attempts already recorded as github_permission_denied are not automatically reclassified.
Issues
Repository monitors can also inventory open GitHub issues when spec.targets.issues.enabled: true. Issue inventory excludes GitHub issues that represent pull requests, stores the item as monitor_items.kind = issue, and records an issue content digest over human-controlled inputs: issue number, title, body, and non-orka:* / non-orka-state:* labels. Orka-authored command labels and state labels therefore do not stale issue plans or future issue workflow artifacts.
A monitor can be run against one exact issue without retiring unrelated inventory:
orka monitor run orka-main --target-kind issue --target-number 123 --namespace orka-system
orka monitor issues list orka-main --namespace orka-system
Label commands — orka:implement to start the workflow and orka:pause to hold an item —
are covered in Issue-to-PR automation.
Guard labels from spec.policy.protectedLabels and spec.policy.pauseLabels record blocked
commands and do not queue work.
Inspect command intake with:
orka monitor commands list orka-main --namespace orka-system
orka monitor commands get '<command-id>' --namespace orka-system
Triage, research, planning, and implementation
orka:implement runs planning when a required ready plan is missing, then continues to implementation if policy permits it. Triage and research are ad hoc API/CLI operations:
triageAPI/CLI command creates a read-only issue triage task and stores anissue_triageaction record.researchAPI/CLI command creates a read-only issue research task and stores anissue_researchaction record.planAPI/CLI command creates a read-only planning task and stores anissue_planaction record. Unresolved plans block implementation with a reason.orka:implementcreates an implementation task only when policy permits it. By default, implementation requires a ready plan; otherwise Orka queues planning first.
Issue action tasks are bound to the issue snapshot digest. Result payloads with mismatched issue numbers or stale digests are recorded as stale/failed action records instead of advancing workflow state.
Implementation Tasks use workspace.intent: write, a controller-selected push branch (spec.issueWorkflow.implementation.branchPrefix, default orka/issue), and the four explicit credential roles above. The ACP child edits only the sanitized workspace and receives no Git or forge credential. After prompt completion, the separate Workspace Publisher freezes and validates the delta, performs the exact publication, independently verifies the remote, and records a non-secret status.delivery receipt.
The controller advances the workflow only from a VerifiedExact delivery whose publication repository, branch, expected commit, verified remote SHA, prior remote SHA, and artifact digest all match the Task contract. Missing, conflicting, superseded, cancelled, credential-blocked, or otherwise unverifiable delivery is recorded as a blocked implementation. After verified publication, the controller uses forgeCredentialRef to create or reuse the pull request with a deterministic Orka-rendered body.
Inspect action records with:
orka monitor actions list orka-main --namespace orka-system --kind issue --number 123
orka monitor actions get '<action-id>' --namespace orka-system
PR repair and readiness
The controller starts bounded repairs automatically when enabled. Ad hoc PR commands can request the same operations:
reviewAPI/CLI command queues an exact-head review run.fixAPI/CLI command queues a repair task on the current PR head branch. Fork PR heads requirerepair.allowForkPullRequests.fix_ciAPI/CLI command queues a CI repair task using the same repair path. Automatic CI repair only fixes checks the pull request broke: a check that also fails on the pull request's base commit is left alone.update_branchAPI/CLI command queues a base-update repair task and allows empty push-branch updates.
Repair Tasks are exact-head write Tasks: workspace.ref and workspace.expectedRemoteSHA bind the selected PR head, and publication targets that same branch. A repair succeeds only with a matching VerifiedExact delivery receipt. An update-branch no-change result is accepted only after the controller independently verifies that the exact PR head contains the requested base revision. Successful repairs clear stale review state so the next exact-head review can recompute readiness. By default, a PR with a passed exact-head review and no active repair is surfaced as merge-ready; GitHub owns the merge decision.
Repair Tasks follow the same path limits as issue implementation. A repair may not change repository control paths (.github/workflows/, config/rbac/, and charts/ paths that contain secret), and when spec.issueWorkflow.implementation.allowedPaths is set, it may change only files that match those patterns. Orka checks the repair's changes before publishing them, so a repair that breaks either rule pushes nothing and fails with patch_path_denied or patch_path_not_allowed.
Repairers run in Orka's built-in runtime image, which has no language toolchains, so by default a repair cannot build or test its change before Orka publishes it. spec.validation.image checks only the next review of the pushed head. Give the repairer Agent a toolbox with the repository's build and test tools, available offline, so it can run them before finishing.
CI evidence for repairs
A fix_ci repair prompt carries CI evidence for the exact PR head next to the check names. failingChecks names the checks the PR broke and baseFailingChecks the checks that also fail on the base commit. failingCheckEvidence (schema orka.prRepair.ciEvidence.v1) describes each failing check in failingChecks:
- Check runs: check-run ID, app slug, name, status, conclusion, link, and up to 10 annotations (path, start and end line, level), failures first.
- Commit statuses: context, state, and link. Statuses have no output or annotations.
- Check runs that have not completed, listed in
pendingChecks.
Every entry has an availability: available, truncated (the truncated list names the bounded fields), unavailable or rate_limited (with a reason such as github_api_status_404), unsupported (commit statuses), or stale (GitHub reported the check for another commit; its output is left out). When the CI lookup itself fails, the prompt still runs: failingCheckEvidence has no checks and its reason says why. A rate limit stops further annotation reads. Evidence never fails or delays a repair.
By default, evidence is structured only and failingCheckEvidence.textOmitted is true. CI tools write check output, annotation text, and commit status descriptions, and they can print credentials that GitHub does not mask, such as a password in a shell trace or a registry config dump. So none of that free text reaches the prompt: no output.title, output.summary, or output.text, no annotation title, message, or raw_details, and no status description. Links are kept only when they point to a check run or GitHub Actions run, attempt, or job of the monitored repository on github.com (https://github.com/OWNER/REPO/runs/ID or https://github.com/OWNER/REPO/actions/runs/ID[/attempts/N][/job/ID]), without their query or fragment. Any other link is left out whole, path included, in every mode: a commit status target_url on an external CI server, or a link on a GitHub Enterprise host.
To include the free text, set spec.repair.ciEvidence.text: true:
spec:
repair:
enabled: true
ciEvidence:
text: true
With text: true, check runs also carry title, summary, and annotation title and message, and commit statuses carry description.
Opting in can expose credentials. The text is stored in the repair Task's spec.prompt, which anyone who can read Tasks in the monitor's namespace can see, and it is sent to the model provider of the repairer agent. Orka redacts the credential shapes it recognizes, but redaction is best effort and cannot recognize every credential a CI tool prints. Turn it on only where Task readers and the model provider may see your CI output, and mask secrets in CI.
When the text is included, Orka strips ANSI escapes, control, and format characters, then redacts or withholds credential-shaped text before it bounds the text on line boundaries. This covers well-known token prefixes, Authorization headers in any common scheme, including quoted, JSON, and Go http.Header forms, and tokens and header values wrapped or backslash-continued across lines. It also withholds whole PEM blocks and the whole multi-line value of a credential key: a YAML block scalar (password: |), a value continued on indented lines, or a quoted value through its closing quote, even behind a diff marker. Whole lines are also withheld when they carry command-line passwords (--password, docker login -p, curl -u user:password), auth fields (.npmrc _auth, Docker config auth, *_AUTH=), kubeconfig client key data, connection-string keys, webhook URLs, or a ::add-mask:: workflow command. Withholding is conservative: a line next to a credential may be withheld with it.
Known limits of redaction, each of which can leave a credential in the text:
- Values split from their option or key across lines, as with
--password \and the value on the next line, or a value wrapped over several lines inside a quoted argument. - Quoted or serialized forms the checks do not parse, such as a quoted option name (
'--password' 'VALUE'), a password with leading spaces, or JSON-escaped config (\"auth\":\"VALUE\"). - Multi-line values under keys or forms it does not list, such as
pwd:, tagged quoted scalars (!!str "..."), a block whose lines carry a timestamp prefix, or anauthvalue on the line after its key. - Short values: a short token after an unknown
Authorizationscheme, or a short base64_auth. - Connection-string keys written as
AccountKey="VALUE"orAccountKey: VALUE. - Any credential in a shape that is not a recognized token prefix, header, assignment, or command option.
The prompt tells the repairer that CI output is untrusted data, separate from review findings and from Orka's instructions.
Evidence limits:
| Limit | Value |
|---|---|
| Checks with evidence | 10 (more are counted in omittedChecks) |
| Pending checks | 10 (more are counted in omittedPendingChecks) |
| Check runs whose annotations are read | 5, at most 2 pages of 50 annotations each |
| Annotations kept per check | 10 |
output.summary, with text: true | 1,536 bytes and 30 lines |
Annotation message, with text: true | 512 bytes and 8 lines |
| One entry, as indented in the prompt | 4 KiB |
| All entries, as indented in the prompt with their separators | 16 KiB, pending checks included; entries that do not fit are counted as omitted |
| Time for annotation reads | 20 seconds |
The repair Task's prompt freezes the evidence for that attempt. If Orka retries the handoff after the Task was created, it reuses the evidence in the Task's prompt rather than reading GitHub again. The repair work action's metadata records ciEvidenceDigest, ciEvidenceIDs, and ciEvidenceAvailability, and so does the repair_task_created monitor event. Reading check runs and annotations uses the forgeCredentialRef token and needs Checks read access.
Pull requests from forks
By default, repairs only push to branches in the monitored repository, and a PR from a fork is blocked with fork_pr_repair_not_writable. Set spec.repair.allowForkPullRequests: true to also repair fork PRs whose authors allow edits from maintainers. The repair Task then clones the fork and publishes to the fork's head branch, with the same exact-head and VerifiedExact checks. If the author turns maintainer edits off, the repair is blocked with fork_pr_maintainer_edits_disabled.
GitHub reports the maintainer-edit setting only when Orka reads a single pull request, which repair always does before it starts; pull request list responses omit it and never count as writable. GitHub still authorizes every push: the publication credentials must be able to read the fork and push to it, which GitHub allows only for accounts with push access to the monitored repository.
GitHub merge readiness
Managed workflows with review.publish.enabled: true publish the commit status orka/<namespace>/<monitor-name>/ready on the exact PR head. Require this status context together with your normal CI and approving-review rules. A GitHub App is not required.
The controller uses forgeCredentialRef for both status writes and readiness reads, including PR inventory and check runs. For private repositories, classic personal access tokens and OAuth tokens need the repo scope. repo:status alone cannot read private PRs or check runs. Fine-grained credentials need Commit statuses write, Pull requests read, and Checks read; publishing reviews also requires Pull requests write.
Reserve this context for Orka. Orka excludes only status IDs persisted in its mutation audit when evaluating CI, including peer monitors, so readiness cannot wait on itself. Check-run IDs are never excluded.
The status stays pending or failed while review, validation, or repair is incomplete. Statuses are commit-scoped: when multiple open PRs on the monitored base branch share a head SHA, all must be ready before that commit receives success. A paused or unreviewed peer blocks the shared status. A new head requires new evidence. Repair defaults to at most five attempts per PR and two per head; explicit lower limits are honored. Workflow polling observes CI and completed Tasks without requiring another command label.
GitHub holds workflow runs for some pull requests from forks until a maintainer approves them, and a held run reports no check run. When a commit has a held run and no failed check, the readiness status reads "Waiting for a maintainer to approve the CI workflow runs for this commit." This includes commits Orka pushed while repairing a fork pull request. Detecting held runs needs Actions read access (classic tokens: repo); a credential without it keeps the previous behaviour.
GitHub merges only when its per-PR auto-merge setting is enabled and all required conditions pass. When disabled, the PR remains open and merge-ready. Orka never calls the merge endpoint or changes the auto-merge setting. There is no sensitive label or additional merge-approval classifier.
API and authorization
Repository monitor endpoints live under /api/v1/monitors/* and require normal Orka API authentication. With ServiceAccount tokens, the API checks Kubernetes RBAC for each route. The Helm chart's orka-client ServiceAccount already has every monitor permission, so a short-lived token for it is enough:
TOKEN=$(kubectl -n orka-system create token orka-client --duration=30m)
For a narrower identity, bind the Kustomize bundle's orka-api-editor-role, or grant create on repositorymonitors/commands and repositorymonitors/runs plus patch on repositorymonitors to send commands, and list on repositorymonitors/items and get/list on monitorcommands to read the results. The permission inventory lists every route.
When context-token authorization is enabled, monitor reads require orka:monitors:read, monitor CRUD requires orka:monitors:write, and manual run creation requires orka:monitors:operate.
Context-token tctx constraints can also restrict monitor access by namespace, repository URL, branch, reviewer Agent, or allowed Agent set.
See API Reference for endpoint details.
Limits
- GitHub is the only supported provider.
- Pull requests and issues are supported targets; commit monitoring is rejected.
- Reviewer Agents must use a built-in
claude,codex, oropencoderuntime and omitspec.secretRef; provider credentials come from the controller-managed runtime proxy and never enter the Task spec. Codex reviewers are confined by the RuntimeSession boundary: the controller rejects elevation requests, the supervisor mediates file writes, and any turn that modifies the workspace fails read-intent validation. - Review publishing supports only neutral
COMMENTreviews, and at most one published review per pull request head. WithsameHeadPolicy: update, a later review of the same head that reaches a different verdict rewrites that review's summary instead of being dropped.
Prompt-orchestrated monitors
Before RepositoryMonitor existed, the chat tool create_pr_monitor created a scheduled AI
Task that reviewed pull requests. It still works, but it keeps none of the durable per-PR
runs, items, review records, publish records, or audit events described on this page. Its
parameters, repository scoping, and review markers are documented under
create_pr_monitor.