Repository navigation
Description
Split from #1653.
Problem
Proposed design
Problem statement
A managed repository changes when its default branch receives a push. No process starts a RAG ingest run for that change, so the index becomes stale. The Service must submit one ingest run for the new commit and must not submit runs for other branches.
Acceptance criteria
Requirement: Default-branch push submits one ingest Job
The Service SHALL create exactly one RAG ingest Job for a valid push to the default branch of a managed repository.
Scenario: Push to the default branch
- WHEN A signed push webhook for a managed repository has
refequal torefs/heads/<repository.default_branch>. - THEN The Service creates one Job from CronJob
devops-cliwith the argsai rag ingest --repo <repository.full_name>and records theaftercommit SHA.
Requirement: Non-default refs are ignored
The Service SHALL ignore push events that do not target the repository default branch.
Scenario: Push to a feature branch
- WHEN A valid push webhook has
refequal torefs/heads/feature. - THEN The Service creates no ingest Job.
Requirement: Duplicate commits are coalesced
The Service SHALL not create a second ingest Job while a Job for the same repository and commit SHA is running or has succeeded.
Scenario: Repeated push of the same commit
- WHEN Two valid push webhooks carry the same repository full name and
aftercommit SHA, and the first ingest Job is running. - THEN The Service creates one ingest Job, and the second event records the existing Job name as a duplicate.
Requirement: Ingest run records its source
The Service SHALL record the repository full name, the after commit SHA, the Job name and the submission time for each ingest run.
Scenario: Run record after submission
- WHEN The Service creates an ingest Job for a default-branch push.
- THEN The run record contains the repository full name, the
aftercommit SHA, the Job name and a submission timestamp.
Requirement: Failed ingest Job is recorded
The Service SHALL record the final failure of an ingest Job and keep the commit eligible for a later retry.
Scenario: Ingest Job fails
- WHEN An ingest Job has a Failed condition and no Complete condition.
- THEN The Service records the failure with the repository full name and commit SHA, and a later push or manual request creates a new ingest Job for the same commit.
Existing Tool Considered
Argo Events (GitHub EventSource + Sensor) is the open, maintained tool that covers the webhook filter and the trigger of a Workflow or Job. It lacks the project's per-repository serialization and run record, and ADR 0008 rejected it for adding NATS without serialization or a hold; the project already has create_webhook_router (src/devops_cli/server/routes/webhooks.py) and the CronJob-template Job creator (src/devops_cli/k8s/cluster_job.py). The change builds a push consumer and a Job submitter instead: about 400 to 600 lines of code and tests, about 40k to 60k tokens to build, about 10k tokens to keep and fix, and 1 to 2 engineer-days.
Key questions
- Which event starts a RAG ingest run?: A GitHub
pushwebhook starts the run whenrefisrefs/heads/<default_branch>. Polling reconciles a missed delivery, and the router's consumer subscription is the extension point. (best practice) [sources: docs/adr/0009-one-webhook-router-delivers-each-event-to-the-consumers-subscribed-to-it.md, docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md, src/devops_cli/server/routes/webhooks.py:141-153]- Chosen: Push webhook. It starts the run at once, and ADR 0003 keeps polling as the fallback.
- Rejected: Poll only. It delays the run until the next tick.
- Rejected: Scheduled cron. It leaves the index stale between runs.
- How does the Service identify the default branch?: The Service compares
refwithrefs/heads/{repository.default_branch}from the push payload's repository object and falls back toGET /repos/{owner}/{repo}(_repository_default_branch) when the field is absent. (best practice) [sources: src/devops_cli/commands/pr.py:995-1004, src/devops_cli/models/webhooks.py:8-13, src/devops_cli/ai/rag/ingest.py:93-94]- Chosen: Payload default branch with API fallback. A managed repository can use a branch name other than main, and the payload's repository object carries the field; the API read covers a payload that omits it.
- Rejected: Hard-coded main. It misses repositories whose default branch has another name.
- Rejected: API read on every push. It costs a request per push when the payload already carries the repository object.
- What executes the RAG ingest run?: The Service creates one Kubernetes Job from suspended CronJob
devops-cli, the template of every cluster job, with the argsai rag ingest --repo <full_name>. The Job carries the repository and commit labels. Argo Workflows is not used because ADR 0008's measured go has not been recorded. (best practice) [sources: src/devops_cli/k8s/cluster_job.py:1-8, src/devops_cli/k8s/cluster_job.py:122-156, k8s/devops/cronjob.yaml:1-3, docs/adr/0008-argo-workflows-run-the-roadmap-jobs-after-a-measured-go.md, docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md:45]- Chosen: Kubernetes Job. It uses the cluster's existing CronJob template and keeps cluster credentials out of GitHub Actions.
- Rejected: Argo Workflow. ADR 0008's measured go is not recorded, and no roadmap job runs on it yet.
- Rejected: GitHub Actions workflow. It runs outside the cluster and needs a second credential path.
- Rejected: Long-running worker. It adds a service to keep and scale.
- How does the Service prevent duplicate runs for one commit?: The Service labels each ingest Job with a digest of the repository full name and a digest of the commit SHA, then lists the Jobs by those labels. It creates no Job when a listed Job is RUNNING or SUCCEEDED; a FAILED Job does not block a new run. The Kubernetes API is the lock, as it is for the implement runner, so a restart loses nothing. (best practice) [sources: src/devops_cli/k8s/cluster_job.py:60-65, src/devops_cli/k8s/cluster_job_api.py:74-80, src/devops_cli/k8s/cluster_job_api.py:164-174, k8s/README.md:668]
- Chosen: Label and state check. The Kubernetes API is the lock, so a restart loses nothing and a failed Job does not block a retry.
- Rejected: Deterministic Job name. A deterministic name blocks a retry of a failed commit until the old Job is deleted.
- Rejected: In-memory delivery cache. It drops only a repeated delivery id and loses its state on restart.
- Rejected: No deduplication. Repeated deliveries waste work and can race the index.
- How does the Service handle a failed ingest Job?: The Job inherits
backoffLimit: 0from CronJobdevops-cli, so Kubernetes marks it Failed on the first pod failure. The Service records the Failed condition with the repository and commit SHA and leaves the commit eligible for a new Job on a later push or a manual request. (best practice) [sources: k8s/devops/cronjob.yaml:17-20, k8s/README.md:643, k8s/README.md:668, src/devops_cli/k8s/cluster_job_api.py:74-80]- Chosen: Template's
backoffLimit: 0and Service resubmit. The template documents that a Job never retries, and the Service's new Job is the project's retry path. - Rejected: Bounded
backoffLimitabove zero. It overrides the template's documented no-retry rule and duplicates the Service's retry path. - Rejected: No failure record. The index stays stale with no record of the failed commit.
- Chosen: Template's
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(k8s)scope of the title gives the scope.The trigger keeps the index fresh after each merge, but it waits on the #1653 workflow.A push trigger keeps RAG search results current after each default-branch merge.It adds one push trigger, but it depends on the #1653 workflow and its cluster setup.Both add Argo RAG ingest; #1653 asks for the full workflow and the candidate asks only for the default-branch push trigger.devops-cli-service commentedon Nov 8, 2026
Refine cannot set this item to Ready at 7935fba. A bot opened the item, so a review of the issue and of the proposal must approve it first. The review found the defects below. A person edits the body to answer them. The next refine round looks at the item again only after a body edit.
missing_pathat key_questions: The plan names this file as a source. The inputfileshas no entry for the file. Evidence: "src/devops_cli/commands/pr.py:995-1004"