Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions skills/ci-failure-triage/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
name: ci-failure-triage
description: Classify CI failures as flake, infra, real-break, dep, or needs_agent and emit a read-only routing packet.
source:
type: cli-tool
command: node
args:
- run.mjs
runx:
tags:
- ci
- triage
- incident-response
links:
source: https://github.com/jaasieldelgado131/runx
---

# CI Failure Triage

## What this skill does

This skill reads a bounded CI failure snapshot and emits a typed
`runx.ci.triage.v1` packet. It classifies the failure as `flake`, `infra`,
`real-break`, `dep`, or `unknown`, attaches cited evidence from the supplied
logs, and returns exactly one read-only consequence when the evidence is strong
enough:

- a read-only rerun verdict for a flake,
- a read-only operator page note for infrastructure failure, or
- a routing decision for `issue-to-pr` when the failure is a real break or
dependency break.

The skill never opens an issue, reruns CI, pages an operator, mints authority,
or claims that a downstream lane has consumed its output. A downstream
`issue-intake`, `issue-to-pr`, or `pr-review-note` run is the separate governed
step that may act on the packet.

## When to use this skill

Use it at the first decision point after a CI job fails and before opening a
tracking item. It is intended for public CI logs or explicitly authorized
operator logs where a reviewer needs a quick, bounded classification with
evidence citations and a conservative escalation path.

## When not to use this skill

Do not use it to mutate repository state, retry CI, page a human, open a bug,
or infer root cause from thin logs. Do not feed it private secrets, tokens,
customer data, or logs that are not authorized for the reviewer. If logs are
truncated, contradictory, or below the configured confidence threshold, the
skill returns `needs_agent` without a routing decision.

## Inputs

- `ci_failure`: object with `logs`, `commit`, and `repo_state`.
- `repo_config`: optional repository context such as default branch and test
command.
- `escalation_policy`: optional object with `min_confidence` for emitting a
routing decision.
- `output_dir`: optional directory inside the skill directory for
`triage-packet.json` and `report.md`.

## Procedure

1. Normalize the CI failure, repository config, and escalation policy.
2. Extract short evidence references from the supplied log lines.
3. Score visible signals for `real-break`, `dep`, `infra`, and `flake`.
4. Refuse to route when logs are absent, truncated, contradictory, or below
`min_confidence`.
5. Emit the read-only triage packet with cited evidence and one bounded
consequence when confidence clears the threshold.
6. Optionally write the packet and a Markdown report under `output_dir`.

## Stop conditions

- Missing or very short logs return `needs_agent`.
- Truncated logs return `needs_agent`.
- Tied evidence between failure classes returns `needs_agent`.
- Confidence below `escalation_policy.min_confidence` returns `needs_agent`.
- No visible evidence for the selected class returns `needs_agent`.

## Output

The primary output is `triage_packet`:

```json
{
"schema": "runx.ci.triage.v1",
"status": "sealed",
"classification": {
"verdict": "real-break",
"confidence": 0.85,
"evidence_refs": []
},
"triage_packet": {
"routing_decision": {
"recommended_lane": "issue-to-pr",
"rationale": "clear code/test failure visible in logs"
}
}
}
```

For ambiguous failures, `status` is `needs_agent` and
`routing_decision` is `null`.

## Harness cases

- `real_break_clear_logs`: clear test failure logs produce
`classification.verdict=real-break` and `recommended_lane=issue-to-pr`.
- `ambiguous_truncated_logs`: truncated logs stop with `needs_agent` and no
routing decision.
133 changes: 133 additions & 0 deletions skills/ci-failure-triage/X.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
skill: ci-failure-triage
version: "0.1.0"

catalog:
kind: graph
audience: public
visibility: public
role: canonical

runx:
mutating: false
scopes:
- ci.logs.read
- repo.state.read
policy:
data_classification: public_ci_metadata
effects:
opens_tracking_items: false
reruns_ci: false
pages_operators: false
mints_authority: false
verifier_notes:
- Emits a read-only draft triage packet for downstream issue-intake, issue-to-pr, or pr-review-note.
- Stops at needs_agent when logs are truncated, contradictory, or below the configured confidence floor.
artifacts:
emits:
- triage_packet
wrap_as: ci_failure_triage_packet

harness:
cases:
- name: real_break_clear_logs
runner: default
inputs:
ci_failure:
logs: |
npm test
FAIL tests/parser.test.ts
TypeError: Cannot read properties of undefined (reading 'items')
Expected 3 received 2
Tests failed in parser regression suite
commit: "1111111111111111111111111111111111111111"
repo_state:
branch: main
changed_files:
- src/parser.ts
repo_config:
default_branch: main
test_command: npm test
escalation_policy:
min_confidence: 0.75
expect:
status: sealed
receipt:
schema: runx.receipt.v1

- name: ambiguous_truncated_logs
runner: default
inputs:
ci_failure:
logs: "Error: job failed ... output truncated"
commit: "2222222222222222222222222222222222222222"
repo_state:
branch: main
repo_config:
default_branch: main
escalation_policy:
min_confidence: 0.75
expect:
status: needs_agent

runners:
default:
default: true
type: graph
inputs:
ci_failure:
type: json
required: true
description: Object containing logs, commit, and repo_state for one CI failure.
repo_config:
type: json
required: false
description: Repository policy context such as default branch and test command.
escalation_policy:
type: json
required: false
description: Object with min_confidence threshold for emitting a routing decision.
output_dir:
type: string
required: false
description: Directory inside the skill directory where artifacts should be written.
graph:
name: ci-failure-triage
steps:
- id: classify
label: classify CI failure and emit triage packet
inputs:
ci_failure: "$input.ci_failure"
repo_config: "$input.repo_config"
escalation_policy: "$input.escalation_policy"
output_dir: "$input.output_dir"
run:
type: cli-tool
command: node
args:
- run.mjs
artifacts:
named_emits:
triage_packet: triage_packet
packets:
triage_packet: runx.ci.triage.v1

- id: human_lane
label: block ambiguous CI failure for agent review
when:
field: classify.triage_packet.data.status
equals: needs_agent
context:
reason: classify.triage_packet.data.escalation.reason
classification: classify.triage_packet.data.classification
run:
type: agent-task
agent: ci-triage-reviewer
task: resolve-ambiguous-ci-failure
outputs:
disposition: string
reviewed_classification: object
next_lane: object
instructions: >
Review only the supplied CI failure packet and reason. Do not infer
root cause, rerun CI, open issues, page operators, or mint
authority unless the missing evidence is supplied by the caller.
12 changes: 12 additions & 0 deletions skills/ci-failure-triage/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "runx-ci-failure-triage",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"test": "node --test tests/*.test.mjs"
},
"engines": {
"node": ">=20"
}
}
Loading