diff --git a/CONTEXT.md b/CONTEXT.md index 8b82855356..8401216aa9 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -88,7 +88,7 @@ _Avoid_: proposal, suggestion **Intake**: The single entry point that turns a candidate into an item: it rejects duplicates, sets priority and puts the item in the backlog. -_Avoid_: ingestion, triage +_Avoid_: ingestion **Duplicate**: A candidate that asks for the same change as an item: the same result and the same acceptance criteria, so that the delivery of one delivers the other. A shared theme, goal, umbrella or file does not make a duplicate. A candidate is never a duplicate of the issue that it is split from. It is also never a duplicate of an issue that has sub-issues, because the sub-issues deliver that issue. @@ -104,7 +104,7 @@ _Avoid_: research **Refinement**: Answering an item's key questions until it is ready. -_Avoid_: grooming, triage +_Avoid_: grooming **Alternative**: An open, maintained tool or library that covers the need of an item, in whole or in part. The alternatives check looks for one, reads its license and its last activity, and records a verdict: covers, partly, none or not-applicable. A person decides what an alternative means for the item: refinement asks a person to adopt a covering tool or to keep the item with a reason. @@ -139,7 +139,7 @@ The long-running devops-cli deployment that runs the roadmap jobs when they are _Avoid_: runner, bot, daemon, worker **Lane**: -One of the Service's two paths for a repository's jobs, each running one round at a time: the model lane runs intake, refinement, staging and the alternatives check, which call the model, and the status lane runs the metrics and the implement row, which call no model. Both get every trigger, and a round in one never waits for a round in the other. +One of the Service's three paths for a repository's jobs, each running one round at a time. The triage lane runs intake on the fast devops-triage model. The model lane runs refinement, staging and the alternatives check, which call the devops-background model. The status lane runs the metrics and implement rows, which call no model. All three get every trigger, and a round in one never waits for a round in the others. _Avoid_: queue, track, worker ## Code review diff --git a/docs/CLI_REFERENCE.md b/docs/CLI_REFERENCE.md index eaa762a8e8..b12cb631a0 100644 --- a/docs/CLI_REFERENCE.md +++ b/docs/CLI_REFERENCE.md @@ -8923,7 +8923,7 @@ devops serve [OPTIONS] | `--workers`, `-w` | `integer` | `1` | Number of worker processes. | | `--log-level`, `-l` | `string` | `info` | Logging level (debug, info, warning, error). | | `--docs` / `--no-docs` | `boolean` | `True` | Enable or disable Swagger UI (/docs) and ReDoc (/redoc). | -| `--service`, `-s` | `boolean` | - | Run continuous background service with GitHub webhook verification and per-repository status and model lanes. | +| `--service`, `-s` | `boolean` | - | Run continuous background service with GitHub webhook verification and per-repository status, triage and model lanes. | --- diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index 7deca783da..71446d87e5 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -216,7 +216,7 @@ AI code review, multi-agent pipelines, RAG semantic search, and embeddings. | `allow_private_network` | `bool` | `False` | `DEVOPS_CLI_AI_ALLOW_PRIVATE_NETWORK` | Permit private-IP network targets | | `max_retries` | `int` | `4` | `DEVOPS_CLI_AI_MAX_RETRIES` | Maximum retry count for AI requests upon response validation failure | | `timeout` | `Union` | - | - | Seconds each LLM request waits for the next data of its reply: a streamed reply, such as every OpenAI-compatible chat reply, can take longer in total. `ai.tasks..timeout` sets one task's. Unset, a request waits 3600 s, and a review's analysis requests 1200 s | -| `tasks` | `AITasksConfig` | `chat=AITaskOverride(provider=None, model=None, reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) metadata=AITaskOverride(provider=None, model=None, reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) analysis=AITaskOverride(provider=None, model=None, reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) verification=AITaskOverride(provider=None, model=None, reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) compose=AITaskOverride(provider=None, model=None, reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) embedding=AIEmbeddingTaskOverride(provider=None, model='qwen3-embedding:0.6b', reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) implement=AIImplementTaskOverride(provider=None, model='devops-coder', reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=128000, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None)` | - | - | +| `tasks` | `AITasksConfig` | `chat=AITaskOverride(provider=None, model=None, reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) metadata=AITaskOverride(provider=None, model=None, reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) analysis=AITaskOverride(provider=None, model=None, reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) verification=AITaskOverride(provider=None, model=None, reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) compose=AITaskOverride(provider=None, model=None, reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) embedding=AIEmbeddingTaskOverride(provider=None, model='qwen3-embedding:0.6b', reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) implement=AIImplementTaskOverride(provider=None, model='devops-coder', reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=128000, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None) triage=AITaskOverride(provider=None, model=None, reasoning_effort=None, supports_reasoning=None, use_model_sampling=None, temperature=None, top_p=None, context_window=None, num_ctx=None, max_tokens=None, ollama_urls=None, ollama_max_parallel=None, api_base_url=None, max_retries=None, timeout=None)` | - | - | | `rag` | `AIRAGConfig` | `enabled=True top_k=5 score_threshold=0.35 chunk_size=2400 chunk_overlap=240` | - | - | | `cache` | `AICacheConfig` | `enabled=True ttl_seconds=604800 max_entries=1000 append_cache=False` | - | - | | `task_name` | `Union` | - | - | - | diff --git a/docs/commands/serve.md b/docs/commands/serve.md index cd380aa179..2d969f2af0 100644 --- a/docs/commands/serve.md +++ b/docs/commands/serve.md @@ -22,6 +22,6 @@ devops serve [OPTIONS] | `--workers`, `-w` | `integer` | `1` | Number of worker processes. | | `--log-level`, `-l` | `string` | `info` | Logging level (debug, info, warning, error). | | `--docs` / `--no-docs` | `boolean` | `True` | Enable or disable Swagger UI (/docs) and ReDoc (/redoc). | -| `--service`, `-s` | `boolean` | - | Run continuous background service with GitHub webhook verification and per-repository status and model lanes. | +| `--service`, `-s` | `boolean` | - | Run continuous background service with GitHub webhook verification and per-repository status, triage and model lanes. | --- diff --git a/k8s/README.md b/k8s/README.md index f6c1770fc2..dc82d2aa81 100644 --- a/k8s/README.md +++ b/k8s/README.md @@ -101,7 +101,7 @@ minikube service llm-gateway -n llm --url ``` ### LLM Gateway (`llm-gateway`) -The LiteLLM gateway is the single entry point to every inference server. It serves the virtual models `devops-chat`, `devops-coder`, `devops-reasoning` and `devops-review`, plus models by name (`qwen3.8:27b`, `gemma4:31b`, `deepseek-r1:70b`, `qwen3-embedding:0.6b`). It moves a prompt too long for `devops-chat` to `devops-coder`, then `devops-reasoning`, before calling any backend. It falls back from an unavailable `devops-coder` to `devops-reasoning` before the small Ollama model, and rejects requests without its master key. `devops k8s deploy-stack` writes the key (`llm/llm-gateway-secrets`, starting with `sk-`) from the keyring before the gateway starts, adopting a live key the keyring lacks and generating one where neither has it; `devops k8s push-secrets --only llm/llm-gateway-secrets` does the same alone (see Cluster Secrets). +The LiteLLM gateway is the single entry point to every inference server. It serves the virtual models `devops-chat`, `devops-coder`, `devops-reasoning`, `devops-review` and `devops-triage`, plus models by name (`qwen3.8:27b`, `gemma4:31b`, `deepseek-r1:70b`, `qwen3-embedding:0.6b`). It moves a prompt too long for `devops-chat` to `devops-coder`, then `devops-reasoning`, before calling any backend. It falls back from an unavailable `devops-coder` to `devops-reasoning` before the small Ollama model, and rejects requests without its master key. `devops k8s deploy-stack` writes the key (`llm/llm-gateway-secrets`, starting with `sk-`) from the keyring before the gateway starts, adopting a live key the keyring lacks and generating one where neither has it; `devops k8s push-secrets --only llm/llm-gateway-secrets` does the same alone (see Cluster Secrets). The routing config is `llm/gateway/config.yaml`. LiteLLM reads it only at start. The gateway kustomization (`llm/gateway/kustomization.yaml`) generates ConfigMap `llm-gateway-config-` from that file, and writes the name into the Deployment. When the config changes, the name and the pod template change, and Kubernetes rolls the gateway onto the new config. Argo CD's `llm` Application renders the kustomization when it syncs, and `devops k8s deploy-stack --stack llm` applies it with `kubectl apply -k llm/gateway`. Thus a config change needs no `kubectl rollout restart` (#1929). Argo CD prunes the ConfigMap of the old config. Without Argo CD, that ConfigMap stays until `teardown-stack` deletes the namespace. @@ -118,7 +118,8 @@ These groups route reviews, embeddings and background work: - Ollama models are also served under their own names: `qwen3.8:27b`, `gemma4:31b`, `deepseek-r1:70b`, and the embedding model `qwen3-embedding:0.6b`. An embedding group configures `model_info.mode: embedding` so health checks embed rather than generate. - `qwen3-embedding:0.6b` has one deployment on each serving tier, and LiteLLM's `order` sets which the router tries first. The gateway routes the embedding group with `simple-shuffle` across order 1 deployments (#2027). Order 1 is `ollama-48gib-fast` and `ollama-64gib-standard`, which embed a 32-chunk RAG batch in under 5 s beside their chat model. Order 2 is `ollama-16gib-fast`, whose chat model leaves no VRAM for the embedder, and `ollama-48gib-slow`, which takes 12 to 30 s. The router sends a request to order 2 only when every order 1 deployment fails. Each deployment sets `num_ctx` to `CONST_RAG_MAX_CHUNK_TOKENS` (8,192), so the largest RAG chunk fits. With its 32,768-token default, the embedder takes 5.2 GB, not 2.9 GB, on `ollama-64gib-standard`. These tiers keep two models loaded, so the embedder stays beside the chat model where both fit, and each must hold the model: `kubectl -n llm exec ds/ -c ollama -- ollama pull qwen3-embedding:0.6b`. - `qwen3-coder:30b` and `gpt-oss:20b` each pin one of `devops-review`'s models: the group copies that model's `devops-review` deployments, with no `max_input_tokens` and no fallback, so a review measured on one model is routed as the pool routes it. -- `devops-background` is the background tier's one generation model: `qwen3.8:27b` on `ollama-48gib-slow`. That tier serves one request at a time, so it is in no interactive or review pool, where background work would queue in front of review calls. It keeps its embedding model and `qwen3.8:27b` loaded together and is sent no other model. In-cluster services (`k8s/devops/` such as `roadmap-service` and cluster jobs) and `devops-review` fallback reach it; the pinned groups have no fallback. The client streams the call and the gateway's pings keep it open, so the client reads the reply of a `devops-review` call that falls back to this tier. Use it for `devops review path --watch`, `devops ai pipeline`, `devops ai agents` and `devops ai analyze` through environment overrides, never in workstation `config.yaml`, so no interactive run lands on it. Set `DEVOPS_CLI_AI_MAX_RETRIES=1`; the ConfigMap template of `k8s/devops/` sets `ai.max_retries: 1` for the in-cluster services, and `devops k8s deploy-stack --stack devops` applies it (Roadmap service, Go-live check). The gateway stops a call when the tier sends no token for 1,100 s, and does not retry it. The client retries a call that fails or times out before its reply starts in its HTTP transport, the single retry layer, `ai.max_retries + 1` times, and each retry waits for the same single slot. A call that fails after its reply starts is not retried. With `1` a call is sent at most two times; `0` does not stop retries, because the transport then makes five attempts: +- `devops-triage` is the fast triage model for candidate intake: `qwen3.8:27b` on `ollama-64gib-standard`. It serves candidate triage alone so backlog placement completes within one poll round. The router falls back to `qwen3.8:27b` if unavailable. +- `devops-background` is the background tier's one generation model: `qwen3.8:27b` on `ollama-48gib-slow`. That tier serves one request at a time, so it is in no interactive or review pool, where background work would queue in front of review calls. It keeps its embedding model and `qwen3.8:27b` loaded together and is sent no other model. The router falls back to `qwen3.8:27b` if unavailable. In-cluster services (`k8s/devops/` such as `roadmap-service` and cluster jobs) and `devops-review` fallback reach it; the pinned groups have no fallback. The client streams the call and the gateway's pings keep it open, so the client reads the reply of a `devops-review` call that falls back to this tier. Use it for `devops review path --watch`, `devops ai pipeline`, `devops ai agents` and `devops ai analyze` through environment overrides, never in workstation `config.yaml`, so no interactive run lands on it. Set `DEVOPS_CLI_AI_MAX_RETRIES=1`; the ConfigMap template of `k8s/devops/` sets `ai.max_retries: 1` for the in-cluster services, and `devops k8s deploy-stack --stack devops` applies it (Roadmap service, Go-live check). The gateway stops a call when the tier sends no token for 1,100 s, and does not retry it. The client retries a call that fails or times out before its reply starts in its HTTP transport, the single retry layer, `ai.max_retries + 1` times, and each retry waits for the same single slot. A call that fails after its reply starts is not retried. With `1` a call is sent at most two times; `0` does not stop retries, because the transport then makes five attempts: ```bash DEVOPS_CLI_AI_MAX_RETRIES=1 DEVOPS_CLI_AI_TASK_ANALYSIS_MODEL=devops-background \ DEVOPS_CLI_AI_TASK_COMPOSE_MODEL=devops-background devops review path src --watch --concurrency 1 @@ -590,7 +591,7 @@ kubectl -n devops logs -f job/ 14. The row `alternatives` of the model lane runs after `refine`: on a first run, and 24 hours after its last success. It runs `devops roadmap alternatives --confirm` for the repository. A round checks at most `roadmap.alternatives.limit` items (5 by default): first the items with no check, then the items whose check is older than `roadmap.alternatives.recheck_days` (30 by default) or whose text changed. A webhook makes the row due at no other time. The row changes no label and closes no issue. It does nothing, and logs `The alternatives check of is off`, for a private repository and when no Firecrawl key is set. If the check of an item fails, the row writes the other checks and fails, naming the item. Each written check adds 1 to `devops_cli_roadmap_alternatives_total` by `verdict`: `covers`, `partly`, `none` or `not-applicable`. A `covers` verdict makes refine ask a person to adopt the tool or to keep the item with a reason. The item waits on a person until a reply answers the question, and Ready items with a new covering tool go back to New. Refine records the tool it asked about in the job record (`refine.alternatives_asked`). `devops roadmap run --dry-run` lists the row when it is due. 15. The row `stage` follows `refine` on the model lane (#2659). It runs `devops roadmap stage --confirm` in the model clone: it is due every hour, on a first run, and in a round where `refine` set an item Ready. It stages the Ready items that `roadmap.stage.filter` names, at most `roadmap.stage.limit` in a round, and splits a task group over `roadmap.stage.step_tokens`. It leaves out an item whose change folder is on the default branch or in its archive (#2714): a round reads that tree once with `git ls-tree`, so a merged staging pull request never makes a second one. The pull request it opens has the title `docs(openspec): plan # `. `k8s/devops/configmap.example.yaml` holds the three settings, and `devops k8s deploy-stack --stack devops` applies them; each also has a variable, `DEVOPS_CLI_ROADMAP_STAGE_FILTER`, `DEVOPS_CLI_ROADMAP_STAGE_LIMIT` and `DEVOPS_CLI_ROADMAP_STAGE_STEP_TOKENS`. Each item of a round counts once in `devops_cli_roadmap_stage_total` by its `result`: `staged`, `skipped`, `needs_split` or `failed`. The image carries the pinned OpenSpec and a Node runtime, so the job validates each change before it pushes: `kubectl -n devops exec deploy/roadmap-service -- openspec --version` prints the locked version. 16. The row `implement` follows `metrics` on the status lane (#2667, #2757). It calls no model, so a model-lane round that has not ended never delays it. It is due every 10 minutes and on a first run, in the clone of the status lane. The Service runs no step: a round only talks to the Kubernetes API, in three moves. It reports each Job that ended, with a comment on the item that holds the state and the last 40 lines of the log of the Job's pod, masked of secrets, and records `implement.job_state` as `succeeded`, `failed` or `gone`. It waits while a Job of the repository has not ended. Else it makes one Job from CronJob `devops-cli-runner` for the first Staged or Planned item that the default filter names (a Planned item has its change folder on the default branch and no branch: a person merged the staging pull request, and the job makes the branch and the draft itself), with the args `roadmap implement --repo --item --confirm` and the item's number as the only item text, and records the name of the Job in `implement.job`. The Jobs of a repository carry the label `implement-repo`, whose value is a digest of the repository name, so the API is the lock and a restart of the Service loses nothing. A Job that leaves its item In Progress, or Ready with no stop, is a stop that the runner could not write, such as a pod that the kernel killed for its memory. The round then sets the item Ready and records `implement.stopped` as `job`, so that no Job is made for it again. A person's comment `implement: retry`, made after the report, clears the stop. If CronJob `devops-cli-runner` does not exist, the round fails with a message that names it: run `devops k8s deploy-stack --stack devops`, or wait for Argo CD. A Job that cannot pull its image (the package `runner` is not public, or no release published it) ends by its deadline after two hours, and the next round records the stop. Read the Jobs with `kubectl -n devops get jobs -l implement-repo`. -17. Each repository has two lanes, and each lane runs one round at a time in its own clone (#1532). The status lane runs the rows `metrics` and `implement`, in the clone `clone`. The model lane runs the rows `intake`, `refine`, `stage` and `alternatives`, in the clone `model-clone`. A poll and a webhook go to both lanes, and the lanes share the file `schedule.json` of the repository, the ledger `service-failures.json` and the lock that each write of an item's job record takes (#2757). The label `lane` of `devops_cli_service_jobs_total`, `devops_cli_service_job_seconds_total` and `devops_cli_service_queue_depth` is `status` or `model`. The label `row` of `devops_cli_github_requests_total` and `devops_cli_service_job_suspended` is the name of the row. A model-lane round that has not ended does not delay a status-lane round. +17. Each repository has three lanes, and each lane runs one round at a time in its own clone (#1532, #1534). The status lane runs the rows `metrics` and `implement` in the clone `clone`. The triage lane runs the row `intake` on the `devops-triage` model in the clone `triage-clone`. The model lane runs the rows `refine`, `stage` and `alternatives` on `devops-background` in the clone `model-clone`. A poll and a webhook go to all three lanes. The lanes share the file `schedule.json` of the repository, the ledger `service-failures.json` and the lock that each write of an item's job record takes (#2757). When intake places a critical fix or P0 item, it writes a `refine_due` timestamp to `schedule.json` so refinement becomes due in the next model-lane round. The label `lane` of `devops_cli_service_jobs_total`, `devops_cli_service_job_seconds_total` and `devops_cli_service_queue_depth` is `status`, `triage` or `model`. The label `row` of `devops_cli_github_requests_total` and `devops_cli_service_job_suspended` is the name of the row. A model-lane round that has not ended does not delay a status-lane or triage-lane round. #### Runner Jobs diff --git a/k8s/devops/configmap.example.yaml b/k8s/devops/configmap.example.yaml index 81f9df41d5..c833f5851e 100644 --- a/k8s/devops/configmap.example.yaml +++ b/k8s/devops/configmap.example.yaml @@ -28,6 +28,8 @@ data: model: devops-background embedding: model: qwen3-embedding:0.6b + triage: + model: devops-triage # devops-cli's cache Valkey in namespace llm (llm/valkey-devops.yaml): the embedding cache # and the threat-intelligence cache. Its password reaches the pod from Secret devops-cli as # DEVOPS_CLI_VALKEY_PASSWORD, never from this ConfigMap. diff --git a/k8s/llm/gateway/config.yaml b/k8s/llm/gateway/config.yaml index e819934463..3d09774071 100644 --- a/k8s/llm/gateway/config.yaml +++ b/k8s/llm/gateway/config.yaml @@ -84,6 +84,12 @@ model_list: timeout: 1100 num_retries: 0 + # devops-triage: fast triage and roadmap intake on the 64 GiB standard tier. + - model_name: devops-triage + litellm_params: + model: ollama_chat/qwen3.8:27b + api_base: http://ollama-64gib-standard.llm.svc.cluster.local:11434 + # devops-review: one model name spread over the interactive Ollama tiers. The least-busy # router sends each request to the deployment with the fewest requests in flight: # - qwen3-coder:30b on ollama-48gib-fast (2x RTX 3090) and ollama-64gib-standard (Tesla V100). @@ -211,6 +217,11 @@ router_settings: # No devops-chat rule: fallbacks chain, so devops-coder and devops-reasoning failures # would reach the background tier through devops-chat. - devops-review: [devops-background] + # Fallback chain: devops-review -> devops-background -> qwen3.8:27b means background and + # review work can reach the interactive tiers when the background tier fails. devops-triage + # falls back to qwen3.8:27b if the standard tier deployment is unavailable. + - devops-triage: [qwen3.8:27b] + - devops-background: [qwen3.8:27b] # Prompt too long for the model: escalate to a larger context window. context_window_fallbacks: - devops-chat: [devops-coder, devops-reasoning] diff --git a/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/design.md b/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/design.md new file mode 100644 index 0000000000..e29a4994ec --- /dev/null +++ b/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/design.md @@ -0,0 +1,13 @@ +# Design + +## Decisions + +- **Use three lanes per repository**: The roadmap Service runs `status`, `triage`, and `model` lanes. Status runs metrics and implement. Triage runs intake. Model runs refine, stage, and alternatives. Each lane has an independent queue and worker. A slow refine round does not block intake. +- **Cross-lane refine trigger uses schedule.json stamp**: When intake places a P0 item, it writes a `refine_due` stamp to `schedule.json` under `_SCHEDULE_LOCK`. The model lane checks this stamp when judging whether refine is due. This allows cross-lane triggering without inter-thread coupling. +- **Direct devops roadmap run keeps same-round cross-job execution**: `devops roadmap run` evaluates all rows in `DEFAULT_DUE_TABLE` in a single pass. The `_refine_cross_job` predicate continues to trigger refine in the same round for CLI executions. +- **Triage task settings fall back to parent AIConfig**: `AITasksConfig.triage` defaults to an empty `AITaskOverride`. When unset, `ai.for_task("triage")` returns `ai.model`. + +## Rejected Alternatives + +- **Shared model lane with priority queue**: Keeping intake and refine in the same lane would still allow an in-progress refine call to block an incoming triage request for up to several minutes. Separate worker threads eliminate this delay completely. +- **In-memory event bus between workers**: Cross-lane notifications in memory would be lost on process restart or rollout. Stamping `schedule.json` persists state across restarts and reuses existing lock mechanisms. diff --git a/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/proposal.md b/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/proposal.md new file mode 100644 index 0000000000..55d8dcbbd0 --- /dev/null +++ b/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/proposal.md @@ -0,0 +1,51 @@ +# Proposal + +## Why + +Issue #1534: The roadmap Service runs intake and refine in the same model lane. +A new P0 or P1 item waits behind every queued refine call before it gets its priority. +This change gives intake its own triage lane on a fast devops-triage model. +A new critical item gets its priority within one poll or delivery. +Refine continues in a separate model lane. + +## What Changes + +- Add the `devops-triage` model group and its fallback rules to the LLM gateway configuration. +- Add `triage` to `AITasksConfig`, and make intake propose with `ai.for_task("triage")`. +- Add the `triage` service lane with its own clone directory and worker. +- Move intake from the model lane to the triage lane. +- Add the cross-lane refine trigger through `schedule.json` when intake places a P0 item. +- Update documentation and help text to describe three service lanes and the triage model. + +## Capabilities + +### New Capabilities + +None. + +### Modified Capabilities + +- `ai-gateway-routing`: Add `devops-triage` deployment and fallbacks. +- `ai-task-models`: Add `triage` task model override for intake proposal calls. +- `roadmap-scoped-updates`: Run scoped intake on the triage lane. + +## Impact + +- Roadmap Service runs three worker lanes per repository: status, triage, and model. +- Metrics report queue depth with the `triage` lane label. +- A model-lane round that is blocked does not hold back intake in the triage lane. + +## Feasibility + +- The LiteLLM gateway configuration in `k8s/llm/gateway/config.yaml` accepts the `devops-triage` deployment on `ollama-64gib-standard` and its fallbacks. +- `tests/test_k8s_llm_gateway.py` validates gateway deployments and routing rules. +- `AITasksConfig` in `src/devops_cli/config/settings.py` validates task overrides and falls back to `ai.model` when unset. +- `src/devops_cli/roadmap/run.py` supports independent lanes through `service_jobs`. +- The cross-lane refine stamp uses `_record_success` under `_SCHEDULE_LOCK` in `schedule.json`. + +## Existing Tool Considered + +The service uses existing LiteLLM and Ollama infrastructure for model routing. +The service uses existing `RepoWorker` thread management for lane execution. +No custom queue or task runner is built. +Written cost: roughly 60 tokens of new logic, 0 new dependencies, negligible maintenance overhead. diff --git a/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/specs/ai-gateway-routing/spec.md b/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/specs/ai-gateway-routing/spec.md new file mode 100644 index 0000000000..7331ebd7c7 --- /dev/null +++ b/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/specs/ai-gateway-routing/spec.md @@ -0,0 +1,17 @@ +# Spec Delta + +## ADDED Requirements + +### Requirement: Gateway routes devops-triage to the standard tier +The LiteLLM gateway configuration SHALL define a `devops-triage` model group with one deployment: `ollama_chat/qwen3.8:27b` on the 64 GiB standard tier. + +#### Scenario: The devops-triage route +- **WHEN** the gateway configuration is loaded +- **THEN** `devops-triage` routes to `ollama_chat/qwen3.8:27b` on `http://ollama-64gib-standard.llm.svc.cluster.local:11434` + +### Requirement: Gateway fallbacks include triage and background targets +The gateway router settings fallbacks SHALL include `devops-triage: [qwen3.8:27b]` and `devops-background: [qwen3.8:27b]`. + +#### Scenario: Fallback routes +- **WHEN** `devops-triage` or `devops-background` fails all retries +- **THEN** the request falls back to `qwen3.8:27b` diff --git a/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/specs/ai-task-models/spec.md b/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/specs/ai-task-models/spec.md new file mode 100644 index 0000000000..b025921be1 --- /dev/null +++ b/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/specs/ai-task-models/spec.md @@ -0,0 +1,14 @@ +# Spec Delta + +## ADDED Requirements + +### Requirement: Intake proposal uses triage task settings +When roadmap intake requests a candidate proposal, the LLM client SHALL use configuration from `ai.tasks.triage` if configured, or fall back to global `ai` settings when unset. + +#### Scenario: Triage task model configured +- **WHEN** `ai.tasks.triage.model` is set +- **THEN** intake initializes its LLM client with the configured triage model + +#### Scenario: Triage task model unset +- **WHEN** `ai.tasks.triage.model` is unset +- **THEN** intake initializes its LLM client with the global `ai.model` setting diff --git a/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/specs/roadmap-scoped-updates/spec.md b/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/specs/roadmap-scoped-updates/spec.md new file mode 100644 index 0000000000..94aa53b712 --- /dev/null +++ b/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/specs/roadmap-scoped-updates/spec.md @@ -0,0 +1,14 @@ +# Spec Delta + +## MODIFIED Requirements + +### Requirement: An issues delivery runs intake of its one issue +`run_scoped_update` SHALL run intake of the one issue that a delivery of the `issues` event with the action `opened`, `edited` or `reopened` names, on the triage lane, with intake's own decision code. It SHALL decide and write nothing for another issue. + +#### Scenario: A delivery about one of three candidates +- **WHEN** a delivery of `issues` with the action `opened`, `edited` or `reopened` names candidate 2 of three candidates +- **THEN** the model judges candidate 2 alone, and only candidate 2 gets labels and a reason comment + +#### Scenario: An edit of an issue that is already an Item +- **WHEN** a delivery of `issues` `edited` names an issue that holds a `priority/*` label, and no other candidate is open +- **THEN** the model judges nothing, the store records no write, and no intake record is written diff --git a/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/tasks.md b/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/tasks.md new file mode 100644 index 0000000000..20e75219cf --- /dev/null +++ b/openspec/changes/archive/2026-10-31-1534-intake-triage-lane/tasks.md @@ -0,0 +1,41 @@ +# Tasks + +## 1. Configure Gateway Models and Fallbacks + +Reads: None.. Changes: None.. + +- [x] 1.1 Add `devops-triage` deployment and fallbacks to `k8s/llm/gateway/config.yaml`, update `tests/test_k8s_llm_gateway.py`, and verify with `uv run pytest tests/test_k8s_llm_gateway.py`. +- [x] 1.2 Update `k8s/devops/configmap.example.yaml` with `triage.model: devops-triage`. + +## 2. Add Triage Task Setting and Intake Model Client + +Reads: None.. Changes: None.. + +- [x] 2.1 Add `triage: AITaskOverride` to `AITasksConfig` in `src/devops_cli/config/settings.py`. +- [x] 2.2 Update `GatewayIntakeModel._client` in `src/devops_cli/roadmap/intake_model.py` to use `task="triage"` and `self._ai.for_task("triage")`. +- [x] 2.3 Add test for setting and unsetting `ai.tasks.triage` in `tests/test_roadmap_intake.py`, and verify with `uv run pytest tests/test_roadmap_intake.py -k triage`. + +## 3. Implement Triage Lane and Cross-Lane Refine + +Reads: None.. Changes: None.. + +- [x] 3.1 Declare constants `CONST_SERVICE_LANE_TRIAGE`, `CONST_ROADMAP_RUN_TRIAGE_CLONE_DIRNAME`, and `CONST_ROADMAP_REFINE_DUE_STAMP` in `src/devops_cli/config/constants.py`. +- [x] 3.2 Define `TRIAGE_LANE_ROWS` and remove `intake` from `MODEL_LANE_ROWS` in `src/devops_cli/roadmap/run.py`. Update `DEFAULT_DUE_TABLE` and `_SCOPED_INTAKE`. +- [x] 3.3 Implement cross-lane refine stamp writing in `_run_intake_adapter` / `_intake_one` and check in `_Poll.is_due` in `src/devops_cli/roadmap/run.py`. +- [x] 3.4 Update `service_jobs` to include the `triage` lane. +- [x] 3.5 Add tests in `tests/test_roadmap_run.py` for cross-lane refine, request budget across three lanes, and triage queue-depth metrics with webhook trigger. Verify with `uv run pytest tests/test_roadmap_run.py`. + +## 4. Documentation and Docs Generation + +Reads: None.. Changes: None.. + +- [x] 4.1 Update `CONTEXT.md` to drop triage from avoid lists and describe three lanes. +- [x] 4.2 Update `serve --service` help text in `src/devops_cli/lang/en/help.py`, and regenerate docs with `uv run devops docs generate --sync-readme`. +- [x] 4.3 Update `k8s/README.md` to document the `devops-triage` model and three service lanes. + +## 5. Verification and OpenSpec Archive + +Reads: None.. Changes: None.. + +- [x] 5.1 Run full CI test suite and linters to verify all checks pass. +- [x] 5.2 Archive the change folder with `PATH="/home/vscode/.local/bin:$PATH" uv run devops openspec archive 1534-intake-triage-lane`. diff --git a/openspec/specs/ai-gateway-routing/spec.md b/openspec/specs/ai-gateway-routing/spec.md index 288037b4da..cee01b457a 100644 --- a/openspec/specs/ai-gateway-routing/spec.md +++ b/openspec/specs/ai-gateway-routing/spec.md @@ -151,3 +151,17 @@ The model query of a gateway SHALL send the AI API key only to a configured gate - **WHEN** a gateway of another origin answers HTTP 401 and the AI API key is set - **THEN** the error says that this gateway got no key, because the key goes only to the configured gateway - **AND** the error holds the host and port of that gateway and no URL + +### Requirement: Gateway routes devops-triage to the standard tier +The LiteLLM gateway configuration SHALL define a `devops-triage` model group with one deployment: `ollama_chat/qwen3.8:27b` on the 64 GiB standard tier. + +#### Scenario: The devops-triage route +- **WHEN** the gateway configuration is loaded +- **THEN** `devops-triage` routes to `ollama_chat/qwen3.8:27b` on `http://ollama-64gib-standard.llm.svc.cluster.local:11434` + +### Requirement: Gateway fallbacks include triage and background targets +The gateway router settings fallbacks SHALL include `devops-triage: [qwen3.8:27b]` and `devops-background: [qwen3.8:27b]`. + +#### Scenario: Fallback routes +- **WHEN** `devops-triage` or `devops-background` fails all retries +- **THEN** the request falls back to `qwen3.8:27b` diff --git a/openspec/specs/ai-task-models/spec.md b/openspec/specs/ai-task-models/spec.md index 2601bac111..0d760d5351 100644 --- a/openspec/specs/ai-task-models/spec.md +++ b/openspec/specs/ai-task-models/spec.md @@ -37,3 +37,14 @@ When a variable or a config file sets a field of `ai.tasks.embedding` other than #### Scenario: A window set in the config file - **WHEN** the project config file holds `ai.tasks.implement.context_window: 64000` and the settings load - **THEN** `ai.for_task("implement").context_window` is 64000 and its model is still `devops-coder` + +### Requirement: Intake proposal uses triage task settings +When roadmap intake requests a candidate proposal, the LLM client SHALL use configuration from `ai.tasks.triage` if configured, or fall back to global `ai` settings when unset. + +#### Scenario: Triage task model configured +- **WHEN** `ai.tasks.triage.model` is set +- **THEN** intake initializes its LLM client with the configured triage model + +#### Scenario: Triage task model unset +- **WHEN** `ai.tasks.triage.model` is unset +- **THEN** intake initializes its LLM client with the global `ai.model` setting diff --git a/openspec/specs/roadmap-scoped-updates/spec.md b/openspec/specs/roadmap-scoped-updates/spec.md index 44691d56b5..a8116d6d51 100644 --- a/openspec/specs/roadmap-scoped-updates/spec.md +++ b/openspec/specs/roadmap-scoped-updates/spec.md @@ -6,7 +6,7 @@ The update that a subscribed webhook event of the roadmap runs at once, scoped t ## Requirements ### Requirement: An issues delivery runs intake of its one issue -`run_scoped_update` SHALL run intake of the one issue that a delivery of the `issues` event with the action `opened`, `edited` or `reopened` names, on the model lane, with intake's own decision code. It SHALL decide and write nothing for another issue. +`run_scoped_update` SHALL run intake of the one issue that a delivery of the `issues` event with the action `opened`, `edited` or `reopened` names, on the triage lane, with intake's own decision code. It SHALL decide and write nothing for another issue. #### Scenario: A delivery about one of three candidates - **WHEN** a delivery of `issues` with the action `opened`, `edited` or `reopened` names candidate 2 of three candidates diff --git a/src/devops_cli/config/constants.py b/src/devops_cli/config/constants.py index eaee26ba4b..46dace3ac3 100644 --- a/src/devops_cli/config/constants.py +++ b/src/devops_cli/config/constants.py @@ -1512,6 +1512,7 @@ class WebhookExposure(StrEnum): # lane runs the jobs that call the model, so a status-lane round never waits for a model-lane # round. A service app given no jobs runs its logging job in the default lane. CONST_SERVICE_LANE_STATUS: Final[str] = "status" +CONST_SERVICE_LANE_TRIAGE: Final[str] = "triage" CONST_SERVICE_LANE_MODEL: Final[str] = "model" CONST_SERVICE_LANE_DEFAULT: Final[str] = "default" CONST_SERVICE_PROBE_PATHS: Final[frozenset[str]] = frozenset( @@ -3061,9 +3062,12 @@ class WebhookExposure(StrEnum): # The Service's intake record beside schedule.json: what intake decided and left (#1360). CONST_ROADMAP_INTAKE_RECORD_FILENAME: Final[str] = "intake.json" CONST_ROADMAP_RUN_CLONE_DIRNAME: Final[str] = "clone" +# The triage lane's clone beside it, so the triage lane's checkout never touches another lane's clone (#1534). +CONST_ROADMAP_RUN_TRIAGE_CLONE_DIRNAME: Final[str] = "triage-clone" # The model lane's own clone beside it, so the model lane's checkout never touches the status # lane's `clone` (#1532). CONST_ROADMAP_RUN_MODEL_CLONE_DIRNAME: Final[str] = "model-clone" +CONST_ROADMAP_REFINE_DUE_STAMP: Final[str] = "refine_due" CONST_ROADMAP_INTAKE_BATCH_KEYS: Final[tuple[tuple[str, str, str], ...]] = ( ("webhook", "issues", "opened"), ("webhook", "issues", "reopened"), diff --git a/src/devops_cli/config/settings.py b/src/devops_cli/config/settings.py index 9268347d16..c81f7253a4 100644 --- a/src/devops_cli/config/settings.py +++ b/src/devops_cli/config/settings.py @@ -601,6 +601,10 @@ class AITasksConfig(BaseModel): default_factory=AIImplementTaskOverride, description="The task of `devops roadmap implement`: one step of a staged change", ) + triage: AITaskOverride = Field( + default_factory=AITaskOverride, + description="The task of roadmap intake", + ) class AIConfig(BaseModel): diff --git a/src/devops_cli/lang/en/help.py b/src/devops_cli/lang/en/help.py index 2f22dff3ab..d41a201169 100644 --- a/src/devops_cli/lang/en/help.py +++ b/src/devops_cli/lang/en/help.py @@ -918,7 +918,7 @@ class ServeCommandHelp: docs: str = "Enable or disable Swagger UI (/docs) and ReDoc (/redoc)." service: str = ( "Run continuous background service with GitHub webhook verification and " - "per-repository status and model lanes." + "per-repository status, triage and model lanes." ) diff --git a/src/devops_cli/roadmap/intake_model.py b/src/devops_cli/roadmap/intake_model.py index d771d48618..d6a4b477d6 100644 --- a/src/devops_cli/roadmap/intake_model.py +++ b/src/devops_cli/roadmap/intake_model.py @@ -210,7 +210,7 @@ def _client(self) -> ProposalClient: from devops_cli.ai.client import get_llm_client return get_llm_client( - task="analysis", config=self._ai.for_task("analysis"), api_key=self._api_key + task="triage", config=self._ai.for_task("triage"), api_key=self._api_key ) def embed(self, texts: Sequence[str]) -> list[list[float]]: @@ -223,7 +223,7 @@ def embed(self, texts: Sequence[str]) -> list[list[float]]: ) from exc def propose(self, request: ProposalRequest) -> ModelProposal: - """Ask the `analysis` task's model for its proposal.""" + """Ask the `triage` task's model for its proposal.""" from devops_cli.ai.client.models import StructuredOutputValidationError try: diff --git a/src/devops_cli/roadmap/run.py b/src/devops_cli/roadmap/run.py index e947e29771..0741f1f063 100644 --- a/src/devops_cli/roadmap/run.py +++ b/src/devops_cli/roadmap/run.py @@ -47,13 +47,16 @@ CONST_ROADMAP_INTAKE_BATCH_KEYS, CONST_ROADMAP_INTAKE_RECORD_FILENAME, CONST_ROADMAP_P0_PRIORITIES, + CONST_ROADMAP_REFINE_DUE_STAMP, CONST_ROADMAP_RUN_CLONE_DIRNAME, CONST_ROADMAP_RUN_MODEL_CLONE_DIRNAME, CONST_ROADMAP_RUN_STATE_FILENAME, + CONST_ROADMAP_RUN_TRIAGE_CLONE_DIRNAME, CONST_SERVICE_CAUSE_UNKNOWN, CONST_SERVICE_FAILURES_FILENAME, CONST_SERVICE_LANE_MODEL, CONST_SERVICE_LANE_STATUS, + CONST_SERVICE_LANE_TRIAGE, CONST_SERVICE_METRIC_JOB_SUSPENDED, CONST_SERVICE_SOURCE_POLL, ) @@ -447,7 +450,12 @@ def _run_intake_adapter( applied = apply_intake(store, plan) if plan.has_writes else IntakeApplied() if plan.has_writes: raise_for_failed_placements(applied) - return JobOutcome(placed_critical_or_p0=_places_critical_or_p0(plan)) + placed_p0 = _places_critical_or_p0(plan) + if placed_p0: + _record_success( + repo_dir / CONST_ROADMAP_RUN_STATE_FILENAME, CONST_ROADMAP_REFINE_DUE_STAMP, now + ) + return JobOutcome(placed_critical_or_p0=placed_p0) @dataclass(frozen=True) @@ -490,7 +498,12 @@ def _intake_one( applied = apply_intake(store, plan) if plan.has_writes else IntakeApplied() if plan.has_writes: raise_for_failed_placements(applied) - return JobOutcome(placed_critical_or_p0=_places_critical_or_p0(plan)) + placed_p0 = _places_critical_or_p0(plan) + if placed_p0: + _record_success( + repo_dir / CONST_ROADMAP_RUN_STATE_FILENAME, CONST_ROADMAP_REFINE_DUE_STAMP, now + ) + return JobOutcome(placed_critical_or_p0=placed_p0) def _job_clone(job: str, clone_path: Path | None) -> Path: @@ -638,7 +651,7 @@ def _run_metrics_adapter( implement Job, which only talks to the Kubernetes API and GitHub. The model runs in the Job, so a model-lane round that is still running never delays the row (#2757).""" -MODEL_LANE_ROWS: tuple[JobRow, ...] = ( +TRIAGE_LANE_ROWS: tuple[JobRow, ...] = ( JobRow( name="intake", interval=timedelta(minutes=DEFAULT_ROADMAP_INTAKE_INTERVAL_MINUTES), @@ -647,6 +660,10 @@ def _run_metrics_adapter( first_run_due=True, due_rule=_intake_due, ), +) +"""The row that runs intake on the fast devops-triage model in its own triage lane (#1534).""" + +MODEL_LANE_ROWS: tuple[JobRow, ...] = ( JobRow( name="refine", interval=timedelta(minutes=DEFAULT_ROADMAP_REFINE_INTERVAL_MINUTES), @@ -673,7 +690,7 @@ def _run_metrics_adapter( """The rows that call the model, which answers one call at a time: intake, refine, stage and the daily check for alternative tools (#2652).""" -DEFAULT_DUE_TABLE: tuple[JobRow, ...] = (*STATUS_LANE_ROWS, *MODEL_LANE_ROWS) +DEFAULT_DUE_TABLE: tuple[JobRow, ...] = (*STATUS_LANE_ROWS, *TRIAGE_LANE_ROWS, *MODEL_LANE_ROWS) """Every row, the status lane's first: what `devops roadmap run` runs in one round.""" @@ -687,7 +704,7 @@ class ScopedUpdate: runner: Callable[..., JobOutcome] -_SCOPED_INTAKE = ScopedUpdate(job="intake", lane=CONST_SERVICE_LANE_MODEL, runner=_intake_one) +_SCOPED_INTAKE = ScopedUpdate(job="intake", lane=CONST_SERVICE_LANE_TRIAGE, runner=_intake_one) SCOPED_UPDATES: Mapping[tuple[str, str], ScopedUpdate] = MappingProxyType( {("issues", action): _SCOPED_INTAKE for action in ("opened", "edited", "reopened")} @@ -816,6 +833,10 @@ def is_due(self, row: JobRow) -> bool: last = self.schedule.get(row.name) if _is_interval_due(row, last, self.now) or _batch_matches(self.batch, row): return True + if row.name == "refine": + refine_due = self.schedule.get(CONST_ROADMAP_REFINE_DUE_STAMP) + if refine_due is not None and (last is None or refine_due > last): + return True if row.due_rule is None: return False since = last or self.now @@ -1201,6 +1222,12 @@ def service_jobs(state_dir: Path) -> Mapping[str, LaneJob]: clone_dirname=CONST_ROADMAP_RUN_CLONE_DIRNAME, failures=failures, ), + CONST_SERVICE_LANE_TRIAGE: partial( + service_job, + table=TRIAGE_LANE_ROWS, + clone_dirname=CONST_ROADMAP_RUN_TRIAGE_CLONE_DIRNAME, + failures=failures, + ), CONST_SERVICE_LANE_MODEL: partial( service_job, table=MODEL_LANE_ROWS, @@ -1215,6 +1242,7 @@ def service_jobs(state_dir: Path) -> Mapping[str, LaneJob]: "MODEL_LANE_ROWS", "SCOPED_UPDATES", "STATUS_LANE_ROWS", + "TRIAGE_LANE_ROWS", "FailureLedger", "JobOutcome", "JobRow", diff --git a/tests/config/test_unknown_config_keys.py b/tests/config/test_unknown_config_keys.py index ae373b92df..cee216d25e 100644 --- a/tests/config/test_unknown_config_keys.py +++ b/tests/config/test_unknown_config_keys.py @@ -93,6 +93,7 @@ def test_the_sections_that_refuse_an_unknown_key_are_ai_its_tasks_and_each_task( ("ai", "tasks", "compose"), ("ai", "tasks", "embedding"), ("ai", "tasks", "implement"), + ("ai", "tasks", "triage"), ] diff --git a/tests/test_k8s_gpu_matrix.py b/tests/test_k8s_gpu_matrix.py index d20330eb92..cc91da6d4e 100644 --- a/tests/test_k8s_gpu_matrix.py +++ b/tests/test_k8s_gpu_matrix.py @@ -165,7 +165,7 @@ def test_rendered_gateway_config_matches_ollama_profiles() -> None: tokens_match_services, ) == ( "", - 20, + 21, [], True, ) diff --git a/tests/test_k8s_llm_gateway.py b/tests/test_k8s_llm_gateway.py index 826a9f6ae9..27767c7e6f 100644 --- a/tests/test_k8s_llm_gateway.py +++ b/tests/test_k8s_llm_gateway.py @@ -394,6 +394,7 @@ def test_gateway_configmap_virtual_models(self) -> None: "devops-reasoning", "qwen3-embedding:0.6b", "devops-background", + "devops-triage", "devops-review", "qwen3-coder:30b", "gpt-oss:20b", @@ -406,6 +407,8 @@ def test_gateway_configmap_virtual_models(self) -> None: {"devops-reasoning": ["devops-coder"]}, {"devops-coder": ["devops-reasoning", "devops-chat"]}, {"devops-review": ["devops-background"]}, + {"devops-triage": ["qwen3.8:27b"]}, + {"devops-background": ["qwen3.8:27b"]}, ], ) @@ -636,6 +639,14 @@ def test_the_slow_tier_serves_embeddings_and_devops_background_alone(self) -> No [("ollama_chat/qwen3.8:27b", slow, None)], ) + def test_devops_triage_serves_qwen_on_standard_tier(self) -> None: + """Verify devops-triage has exactly one deployment: ollama_chat/qwen3.8:27b on + ollama-64gib-standard.""" + standard = "http://ollama-64gib-standard.llm.svc.cluster.local:11434" + assert _routes(_deployments("devops-triage")) == [ + ("ollama_chat/qwen3.8:27b", standard, None) + ] + @pytest.mark.parametrize("readme", GATEWAY_READMES, ids=str) def test_a_gateway_readme_names_exactly_the_embedding_groups_the_gateway_serves( self, readme: Path diff --git a/tests/test_roadmap_intake.py b/tests/test_roadmap_intake.py index f5491c9d34..469be89c09 100644 --- a/tests/test_roadmap_intake.py +++ b/tests/test_roadmap_intake.py @@ -1997,6 +1997,37 @@ def test_an_off_list_proposal_skips_its_candidate_after_one_model_call(roadmap: ) == (Outcome.SKIP, 1, True, True, None) +def test_intake_proposal_uses_triage_task_model_or_falls_back_to_ai_model( + monkeypatch: pytest.MonkeyPatch, +) -> None: + """Intake uses ai.tasks.triage model when set; when unset, it falls back to ai.model.""" + from devops_cli.config.settings import AIConfig, AITaskOverride, AITasksConfig + from devops_cli.roadmap.intake_model import GatewayIntakeModel + + captured_configs: list[tuple[str, str]] = [] + + def fake_get_llm_client(*, task: str, config: Any, api_key: Any = None) -> Any: + captured_configs.append((task, config.model)) + return None + + monkeypatch.setattr("devops_cli.ai.client.get_llm_client", fake_get_llm_client) + + # 1. Unset triage task: falls back to ai.model + ai_unset = AIConfig(model="base-chat-model") + model_unset = GatewayIntakeModel(ai_unset, embedder=_Embedder()) + _ = model_unset._client + assert captured_configs[-1] == ("triage", "base-chat-model") + + # 2. Set triage task: uses triage.model + ai_set = AIConfig( + model="base-chat-model", + tasks=AITasksConfig(triage=AITaskOverride(model="devops-triage")), + ) + model_set = GatewayIntakeModel(ai_set, embedder=_Embedder()) + _ = model_set._client + assert captured_configs[-1] == ("triage", "devops-triage") + + def test_intake_title_confirm_exits_non_zero_when_candidate_is_skipped( opened: Roadmap, fake_model: FakeModel, tmp_path: Path ) -> None: diff --git a/tests/test_roadmap_run.py b/tests/test_roadmap_run.py index 29e293197c..4fed58e891 100644 --- a/tests/test_roadmap_run.py +++ b/tests/test_roadmap_run.py @@ -6,8 +6,8 @@ at the process edge (#1366). The last cases run the GitHub store over `GitHubFake`, a fake at the `gh` process edge, to count a round's reads and show that no round reads a project board (#1361, ADR 0016). The table holds the status lane's -metrics and implement rows and the model lane's intake, refine, stage and alternatives rows; -every clone tracks origin's default branch. +metrics and implement rows, the triage lane's intake row and the model lane's refine, stage and +alternatives rows; every clone tracks origin's default branch. """ from __future__ import annotations @@ -37,15 +37,19 @@ from devops_cli.config.constants import ( CONST_GH_CLI, CONST_ROADMAP_INTAKE_BATCH_KEYS, + CONST_ROADMAP_REFINE_DUE_STAMP, CONST_ROADMAP_RUN_CLONE_DIRNAME, CONST_ROADMAP_RUN_MODEL_CLONE_DIRNAME, + CONST_ROADMAP_RUN_TRIAGE_CLONE_DIRNAME, CONST_ROADMAP_WEBHOOK_EVENTS, CONST_SERVICE_BUDGET_FILENAME, CONST_SERVICE_FAILURES_FILENAME, CONST_SERVICE_HALT_FILENAME, CONST_SERVICE_LANE_MODEL, CONST_SERVICE_LANE_STATUS, + CONST_SERVICE_LANE_TRIAGE, CONST_SERVICE_METRIC_JOB_SUSPENDED, + CONST_SERVICE_METRIC_QUEUE_DEPTH, CONST_URL_CLOUDFLARE_STATUS_SUMMARY, CONST_URL_GITHUB_STATUS_SUMMARY, ) @@ -73,6 +77,7 @@ MODEL_LANE_ROWS, SCOPED_UPDATES, STATUS_LANE_ROWS, + TRIAGE_LANE_ROWS, FailureLedger, JobOutcome, JobRow, @@ -330,12 +335,12 @@ def _poll_round( def test_the_table_runs_the_lanes_in_order_and_names_no_release_job() -> None: - """The status lane's metrics and implement rows run first, then the model lane's intake, - refine, stage and alternatives; no row closes items, cuts or starts a release (#1360, #2652, - #2659, #2667, #2757).""" + """The status lane's metrics and implement rows run first, then the triage lane's intake row, + then the model lane's refine, stage and alternatives rows; no row closes items, cuts or starts + a release (#1360, #1534, #2652, #2659, #2667, #2757).""" assert ( [row.name for row in DEFAULT_DUE_TABLE], - DEFAULT_DUE_TABLE == (*STATUS_LANE_ROWS, *MODEL_LANE_ROWS), + DEFAULT_DUE_TABLE == (*STATUS_LANE_ROWS, *TRIAGE_LANE_ROWS, *MODEL_LANE_ROWS), sorted(CONST_ROADMAP_WEBHOOK_EVENTS), ) == ( ["metrics", "implement", "intake", "refine", "stage", "alternatives"], @@ -725,9 +730,9 @@ def test_service_wiring( seeded_store: InMemoryRoadmapStore, roadmap_store_repos: list[str], ) -> None: - """`devops serve --service` passes the two lanes' jobs to create_service_app, with no + """`devops serve --service` passes the three lanes' jobs to create_service_app, with no reader of a round pause: no roadmap read has a budget refusal that names one (ADR 0016). - Each lane's job opens the store and runs its own rows in its own clone (#1532).""" + Each lane's job opens the store and runs its own rows in its own clone (#1532, #1534).""" with patch("uvicorn.run") as mock_uvicorn: res = runner.invoke(serve_app, ["--service"]) fastapi_app = mock_uvicorn.call_args[0][0]() @@ -747,17 +752,21 @@ def test_service_wiring( fastapi_app.state.pause_until is no_round_pause, REPO in roadmap_store_repos, lanes, - [[row.name for row in rows] for rows in (STATUS_LANE_ROWS, MODEL_LANE_ROWS)], + [ + [row.name for row in rows] + for rows in (STATUS_LANE_ROWS, TRIAGE_LANE_ROWS, MODEL_LANE_ROWS) + ], ) == ( 0, - [CONST_SERVICE_LANE_STATUS, CONST_SERVICE_LANE_MODEL], + [CONST_SERVICE_LANE_STATUS, CONST_SERVICE_LANE_TRIAGE, CONST_SERVICE_LANE_MODEL], True, True, [ (REPO, STATUS_LANE_ROWS, CONST_ROADMAP_RUN_CLONE_DIRNAME), + (REPO, TRIAGE_LANE_ROWS, CONST_ROADMAP_RUN_TRIAGE_CLONE_DIRNAME), (REPO, MODEL_LANE_ROWS, CONST_ROADMAP_RUN_MODEL_CLONE_DIRNAME), ], - [["metrics", "implement"], ["intake", "refine", "stage", "alternatives"]], + [["metrics", "implement"], ["intake"], ["refine", "stage", "alternatives"]], ) @@ -1545,6 +1554,92 @@ def test_intake_placing_p2_medium_issue_labelled_type_bug_does_not_make_refine_d ) == (("intake",), ["intake"], ("P2-Medium", PLANNED)) +def test_cross_lane_refine_becomes_due_at_next_model_lane_round_via_stamp( + tmp_path: Path, +) -> None: + """Intake placing a P0 item in the triage lane stamps refine_due in schedule.json, making + refine due in the next model-lane round, and refine succeeding updates its stamp so it is no + longer due (#1534).""" + clock = _Clock() + store = InMemoryRoadmapStore(clock=clock) + store.seed_file(".github/labels.yml", Path(".github/labels.yml").read_text(encoding="utf-8")) + store.seed_milestone(PLANNED) + store.seed_evidence(Evidence(kind=EvidenceKind.FAILED_RUN, value="4242")) + store.seed_issue( + "P0 critical bug", + body="Failed run 4242.", + labels=["type/bug"], + author_association="COLLABORATOR", + ) + proposal = ModelProposal( + type="type/bug", + type_reason="defect.", + priority="P0-Critical", + priority_reason="critical.", + value="High", + value_reason="high.", + effort="Low", + effort_reason="low.", + evidence=ModelEvidence(kind="failed_run", value="4242"), + ) + model = _IntakeModel(proposals={"P0 critical bug": proposal}) + intake = partial(_run_intake_adapter, model=model) + _stamp( + tmp_path, + intake=NOW - timedelta(minutes=61), + refine=NOW - timedelta(minutes=5), + stage=NOW - timedelta(minutes=5), + alternatives=NOW - timedelta(minutes=5), + ) + + triage_table = build_stub_table({"intake": intake}) + triage_ran = run_due_jobs( + REPO, + store, + batch={POLL_KEY: 1}, + table=triage_table, + data_dir=tmp_path, + now=NOW, + ) + assert triage_ran == ("intake",) + schedule = json.loads((tmp_path / REPO_DIR / "schedule.json").read_text(encoding="utf-8")) + assert CONST_ROADMAP_REFINE_DUE_STAMP in schedule + assert schedule[CONST_ROADMAP_REFINE_DUE_STAMP] == NOW.isoformat() + + model_ran: list[str] = [] + model_table = build_stub_table( + { + "refine": _recorded(model_ran, "refine"), + "stage": _recorded(model_ran, "stage"), + "alternatives": _recorded(model_ran, "alternatives"), + } + ) + ran_jobs = run_due_jobs( + REPO, + store, + batch={POLL_KEY: 1}, + table=model_table, + data_dir=tmp_path, + now=NOW, + ) + assert ran_jobs == ("refine",) + schedule_after = json.loads((tmp_path / REPO_DIR / "schedule.json").read_text(encoding="utf-8")) + assert schedule_after["refine"] == NOW.isoformat() + + model_ran.clear() + next_now = NOW + timedelta(minutes=1) + ran_again = run_due_jobs( + REPO, + store, + batch={POLL_KEY: 1}, + table=model_table, + data_dir=tmp_path, + now=next_now, + ) + assert ran_again == () + assert model_ran == [] + + # ── On the GitHub store, at the `gh` process edge (#1361) ───────────────────── @@ -1691,6 +1786,24 @@ def test_a_status_lane_poll_reads_no_change_and_sends_no_request( assert [args for args in github.calls if "rate_limit" not in " ".join(args)] == [] +def test_a_model_lane_poll_when_not_due_reads_no_change_and_sends_no_request( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + """No model-lane row has a due rule, so its poll reads no change: with nothing due by its + interval, the round sends no request, and reads no roadmap file as it opens the store (#1534).""" + github = _service_github(_labeled(2, "alice")) + _serve_over(tmp_path, monkeypatch, github) + recent = datetime.now(UTC) - timedelta(minutes=1) + _stamp( + tmp_path, + refine=recent, + stage=recent, + alternatives=recent, + ) + service_jobs(tmp_path)[CONST_SERVICE_LANE_MODEL](POLL) + assert [args for args in github.calls if "rate_limit" not in " ".join(args)] == [] + + def test_a_blocked_model_lane_holds_back_none_of_the_status_lanes_rounds( seeded_store: InMemoryRoadmapStore, tmp_path: Path, monkeypatch: pytest.MonkeyPatch ) -> None: @@ -1751,6 +1864,72 @@ def refine(**_: Any) -> JobOutcome: ) == (True, ["metrics", "implement"], [True], True, True) +def test_opened_issue_webhook_runs_triage_lane_while_model_lane_blocked_and_reports_queue_depth( + seeded_store: InMemoryRoadmapStore, tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + """A refine round blocks on a slow model in the model lane. In the same repository the triage + lane runs intake for an opened issue without waiting, and reports its queue depth (#1534).""" + monkeypatch.setenv("DEVOPS_CLI_DATA_DIR", str(tmp_path)) + refining, model_answers = threading.Event(), threading.Event() + refine_released: list[bool] = [] + triage_ran: list[str] = [] + during_refine: list[bool] = [] + + def intake(**_: Any) -> JobOutcome: + during_refine.append(not model_answers.is_set()) + triage_ran.append("intake") + return JobOutcome() + + def refine(**_: Any) -> JobOutcome: + refining.set() + refine_released.append(model_answers.wait(timeout=THREAD_HANDOFF_BOUND_SECONDS)) + return JobOutcome() + + lanes = { + CONST_SERVICE_LANE_TRIAGE: partial( + service_job, + table=_lane(TRIAGE_LANE_ROWS, intake=intake), + clone_dirname=CONST_ROADMAP_RUN_TRIAGE_CLONE_DIRNAME, + ), + CONST_SERVICE_LANE_MODEL: partial( + service_job, + table=_lane(MODEL_LANE_ROWS, refine=refine), + clone_dirname=CONST_ROADMAP_RUN_MODEL_CLONE_DIRNAME, + ), + } + manager = ServiceManager( + ServiceConfig(repos=[REPO]), {}, lanes, lambda: datetime.now(UTC), asyncio.sleep + ) + triage_worker = manager.workers[(REPO, CONST_SERVICE_LANE_TRIAGE)] + model_worker = manager.workers[(REPO, CONST_SERVICE_LANE_MODEL)] + for worker in manager.workers.values(): + worker.start() + + manager.enqueue_trigger(REPO, "poll", "", "") + assert refining.wait(timeout=THREAD_HANDOFF_BOUND_SECONDS) + assert triage_worker.wait_active(THREAD_HANDOFF_BOUND_SECONDS) + triage_ran.clear() + during_refine.clear() + + manager.enqueue_trigger(REPO, "webhook", "issues", "opened") + triage_finished = triage_worker.wait_active(THREAD_HANDOFF_BOUND_SECONDS) + refine_still_running = model_worker.is_active() + model_answers.set() + asyncio.run(manager.drain_and_stop()) + + triage_depth = GLOBAL_METRICS.get_gauge_value( + CONST_SERVICE_METRIC_QUEUE_DEPTH, labels={"lane": CONST_SERVICE_LANE_TRIAGE, "repo": REPO} + ) + assert ( + triage_finished, + triage_ran, + during_refine, + refine_still_running, + triage_depth, + bool(refine_released) and all(refine_released), + ) == (True, ["intake"], [True], True, 0.0, True) + + def test_the_implement_row_is_due_on_the_status_lane_by_its_interval_and_by_no_hint( seeded_store: InMemoryRoadmapStore, tmp_path: Path ) -> None: @@ -1861,12 +2040,20 @@ def round_of(at: datetime) -> tuple[str, ...]: def test_each_lanes_success_stays_in_schedule_json_when_their_rounds_interleave( seeded_store: InMemoryRoadmapStore, tmp_path: Path ) -> None: - """A model-lane round records intake, refine, stage and alternatives while a status-lane round + """A triage-lane round and a model-lane round record their jobs while a status-lane round is running metrics, which had read `schedule.json` before them: the success of metrics and the - one of implement, which follows it, keep theirs.""" + one of implement, which follows it, keep theirs (#1534).""" later = NOW + timedelta(seconds=1) def metrics(**_: Any) -> JobOutcome: + triage_round = run_due_jobs( + REPO, + seeded_store, + batch={POLL_KEY: 1}, + table=_lane(TRIAGE_LANE_ROWS), + data_dir=tmp_path, + now=later, + ) model_round = run_due_jobs( REPO, seeded_store, @@ -1875,7 +2062,10 @@ def metrics(**_: Any) -> JobOutcome: data_dir=tmp_path, now=later, ) - assert model_round == ("intake", "refine", "stage", "alternatives") + assert (triage_round, model_round) == ( + ("intake",), + ("refine", "stage", "alternatives"), + ) return JobOutcome() ran = run_due_jobs( @@ -2136,14 +2326,16 @@ def test_a_service_round_needs_no_roadmap_file( def test_service_job_unreadable_github_roadmap_propagates_unchanged( unreadable_github_roadmap: Any, tmp_path: Path, monkeypatch: pytest.MonkeyPatch ) -> None: - """A model-lane round whose read of the changes GitHub cannot answer (HTTP 503) raises - GitHubOperationError unchanged (#1365).""" + """A triage-lane round whose read of the changes GitHub cannot answer (HTTP 503) raises + GitHubOperationError unchanged (#1365, #1534).""" monkeypatch.setenv("DEVOPS_CLI_DATA_DIR", str(tmp_path)) monkeypatch.setattr("devops_cli.roadmap.run._get_session_login", lambda: "roadmap-bot") batch = TriggerBatch(repo="example/repo", counts={OPENED: 1}, first_at=NOW, last_at=NOW) with pytest.raises(GitHubOperationError) as exc_info: - service_job(batch, table=MODEL_LANE_ROWS, clone_dirname=CONST_ROADMAP_RUN_CLONE_DIRNAME) + service_job( + batch, table=TRIAGE_LANE_ROWS, clone_dirname=CONST_ROADMAP_RUN_TRIAGE_CLONE_DIRNAME + ) assert not isinstance(exc_info.value, ConfigurationError) @@ -2156,13 +2348,13 @@ def _delivery(action: str, number: int, *, event: str = "issues") -> WebhookDeli return WebhookDelivery(repo=REPO, event=event, action=action, number=number) -def test_the_issues_actions_run_a_scoped_intake_on_the_model_lane() -> None: - """`issues` opened, edited and reopened each run intake of one issue on the model lane, and - no other event has a scoped update.""" +def test_the_issues_actions_run_a_scoped_intake_on_the_triage_lane() -> None: + """`issues` opened, edited and reopened each run intake of one issue on the triage lane, and + no other event has a scoped update (#1534).""" assert {key: (update.job, update.lane) for key, update in SCOPED_UPDATES.items()} == { - ("issues", "opened"): ("intake", CONST_SERVICE_LANE_MODEL), - ("issues", "edited"): ("intake", CONST_SERVICE_LANE_MODEL), - ("issues", "reopened"): ("intake", CONST_SERVICE_LANE_MODEL), + ("issues", "opened"): ("intake", CONST_SERVICE_LANE_TRIAGE), + ("issues", "edited"): ("intake", CONST_SERVICE_LANE_TRIAGE), + ("issues", "reopened"): ("intake", CONST_SERVICE_LANE_TRIAGE), } @@ -2308,7 +2500,12 @@ def test_the_alternatives_row_follows_refine_and_is_due_once_a_day_and_by_no_hin def ran(batch: dict[tuple[str, str, str], int], **stamps: datetime) -> tuple[str, ...]: _stamp(tmp_path, **stamps) - return _poll_round(seeded_store, tmp_path, table=_lane(MODEL_LANE_ROWS), batch=batch) + return _poll_round( + seeded_store, + tmp_path, + table=_lane((*TRIAGE_LANE_ROWS, *MODEL_LANE_ROWS)), + batch=batch, + ) first = ran({POLL_KEY: 1}) too_soon = ran({POLL_KEY: 1}, **recent, alternatives=NOW - timedelta(hours=23, minutes=59)) diff --git a/tests/test_server_service.py b/tests/test_server_service.py index af41b21c33..3e87304850 100644 --- a/tests/test_server_service.py +++ b/tests/test_server_service.py @@ -10,7 +10,7 @@ import queue import sys import threading -from collections.abc import Callable, Iterator, Mapping +from collections.abc import Callable, Iterator, Mapping, Sequence from datetime import UTC, datetime, timedelta from functools import partial from typing import Any @@ -31,6 +31,7 @@ CONST_SERVICE_LANE_DEFAULT, CONST_SERVICE_LANE_MODEL, CONST_SERVICE_LANE_STATUS, + CONST_SERVICE_LANE_TRIAGE, CONST_SERVICE_MAX_BODY_BYTES, CONST_SERVICE_METRIC_JOB_SECONDS, CONST_SERVICE_METRIC_JOB_START_TIMESTAMP, @@ -1461,18 +1462,22 @@ def unreadable(_exc: Exception) -> datetime | None: # ── A status-lane round never waits for a model-lane round (#1532) ──────────── -STATUS_LANE, MODEL_LANE = CONST_SERVICE_LANE_STATUS, CONST_SERVICE_LANE_MODEL +STATUS_LANE, TRIAGE_LANE, MODEL_LANE = ( + CONST_SERVICE_LANE_STATUS, + CONST_SERVICE_LANE_TRIAGE, + CONST_SERVICE_LANE_MODEL, +) class _Lanes: - """One repository's two lane jobs: the model lane's first round blocks, as on a slow model, + """One repository's lane jobs: the model lane's first round blocks, as on a slow model, until the test lets it go; every round is recorded by lane.""" - def __init__(self) -> None: + def __init__(self, lane_names: Sequence[str] = (STATUS_LANE, MODEL_LANE)) -> None: self.model_started = threading.Event() self.model_answers = threading.Event() self.model_released: bool | None = None - self.batches: dict[str, list[TriggerBatch]] = {STATUS_LANE: [], MODEL_LANE: []} + self.batches: dict[str, list[TriggerBatch]] = {lane: [] for lane in lane_names} self.most_at_once = dict.fromkeys(self.batches, 0) self._running = dict.fromkeys(self.batches, 0) self._lock = threading.Lock() @@ -1717,9 +1722,11 @@ def _webhook_keys(lanes: _Lanes) -> dict[str, list[tuple[str, str, str]]]: } -def _unblocked_lanes() -> _Lanes: +def _unblocked_lanes( + lane_names: Sequence[str] = (STATUS_LANE, TRIAGE_LANE, MODEL_LANE), +) -> _Lanes: """Lane jobs that record their rounds, the model lane's start-up round answering at once.""" - lanes = _Lanes() + lanes = _Lanes(lane_names) lanes.model_answers.set() return lanes @@ -1762,14 +1769,17 @@ def test_an_event_no_consumer_subscribes_to_gets_no_subscriber_and_starts_no_rou assert ([(r.status_code, r.json()) for r in responses], settled, _webhook_keys(lanes)) == ( [(200, {"status": "no_subscriber"})] * 2, True, - {STATUS_LANE: [], MODEL_LANE: []}, + {STATUS_LANE: [], TRIAGE_LANE: [], MODEL_LANE: []}, ) @pytest.mark.parametrize("event", ["issues"]) -def test_the_roadmap_consumer_takes_the_events_its_jobs_read_into_both_lanes(event: str) -> None: +def test_the_roadmap_consumer_takes_the_events_its_jobs_read_into_all_three_lanes( + event: str, +) -> None: """Each event a roadmap job's batch keys name, the issues events alone, reaches the status - lane and the model lane as a ("webhook", , ) trigger, whatever its action.""" + lane, the triage lane and the model lane as a ("webhook", , ) trigger, whatever + its action (#1534).""" lanes = _unblocked_lanes() app = _lanes_app(lanes) with TestClient(app) as client: @@ -1780,7 +1790,7 @@ def test_the_roadmap_consumer_takes_the_events_its_jobs_read_into_both_lanes(eve 202, {"status": "accepted"}, True, - {STATUS_LANE: [key], MODEL_LANE: [key]}, + {STATUS_LANE: [key], TRIAGE_LANE: [key], MODEL_LANE: [key]}, ) @@ -1789,7 +1799,7 @@ def test_a_subscribed_issues_delivery_runs_its_scoped_update_and_queues_no_full_ action: str, monkeypatch: pytest.MonkeyPatch, roadmap_store: Any ) -> None: """A delivery of `issues` opened, edited or reopened with an issue number runs its scoped update - on the model lane worker, and queues no full round on either lane (ADR 0017, #1533).""" + on the triage lane worker, and queues no full round on any lane (ADR 0017, #1533, #1534).""" ran_updates: list[tuple[Any, str]] = [] def fake_scoped(delivery: Any, store: Any, **kwargs: Any) -> Any: @@ -1815,7 +1825,7 @@ def fake_scoped(delivery: Any, store: Any, **kwargs: Any) -> Any: 202, {"status": "accepted"}, True, - {STATUS_LANE: [], MODEL_LANE: []}, + {STATUS_LANE: [], TRIAGE_LANE: [], MODEL_LANE: []}, 1, ) delivery, thread_name = ran_updates[0] @@ -1825,7 +1835,7 @@ def fake_scoped(delivery: Any, store: Any, **kwargs: Any) -> Any: action, 42, ) - assert f"-{MODEL_LANE}" in thread_name + assert f"-{TRIAGE_LANE}" in thread_name @pytest.mark.parametrize( @@ -1837,7 +1847,7 @@ def fake_scoped(delivery: Any, store: Any, **kwargs: Any) -> Any: ) def test_an_unscopeable_delivery_keeps_the_whole_round_hint(payload: dict[str, Any]) -> None: """An issues event without an issue number, or with an action not in SCOPED_UPDATES, keeps the - whole-round hint to all lanes.""" + whole-round hint to all lanes (#1534).""" lanes = _unblocked_lanes() app = _lanes_app(lanes) with TestClient(app) as client: @@ -1849,7 +1859,7 @@ def test_an_unscopeable_delivery_keeps_the_whole_round_hint(payload: dict[str, A 202, {"status": "accepted"}, True, - {STATUS_LANE: [key], MODEL_LANE: [key]}, + {STATUS_LANE: [key], TRIAGE_LANE: [key], MODEL_LANE: [key]}, ) @@ -1885,7 +1895,7 @@ def test_enqueue_scoped_unmanaged_repo_or_unknown_lane() -> None: def dummy() -> None: pass - assert mgr.enqueue_scoped("example-org/unmanaged", MODEL_LANE, dummy) is False + assert mgr.enqueue_scoped("example-org/unmanaged", TRIAGE_LANE, dummy) is False assert mgr.enqueue_scoped(REPO_A, "nonexistent-lane", dummy) is False @@ -1903,7 +1913,7 @@ def test_the_app_bots_own_event_reaches_neither_lane() -> None: 200, {"status": "ignored_own_write"}, True, - {STATUS_LANE: [], MODEL_LANE: []}, + {STATUS_LANE: [], TRIAGE_LANE: [], MODEL_LANE: []}, ) @@ -2264,7 +2274,7 @@ def test_the_app_bots_event_is_refused_by_the_roadmap_consumer_alone() -> None: [(202, {"status": "accepted"})] * 2, [(REPO_A, "issues", "opened"), (REPO_A, "issues", "closed")], True, - {STATUS_LANE: [key], MODEL_LANE: [key]}, + {STATUS_LANE: [key], TRIAGE_LANE: [key], MODEL_LANE: [key]}, )