agents/skills/experimental-code-coverage-cq-debugger/SKILL.md
Throughout the triage process, maintain a state file at
scratch/triage_state.json. In Step 1, you MUST load the existing state
file (initialized by the orchestrator) and initialize ALL variables defined in
templates/triage_state_template.json in
scratch/triage_state.json initially, even if many of them will initially be
null. Update these variables in scratch/triage_state.json as they are
resolved in subsequent steps.
When initializing variables in Step 1, reference
templates/triage_state_template.json for the
required variables and data contract. All variables from this schema MUST be
loaded into scratch/triage_state.json at the start of Phase 1.
This skill defines the end-to-end triaging and resolution process for Gerrit Commit Queue (CQ) underreported coverage bugs. It guides the agent through Phase 1 (Information Gathering), Phase 2 (Audit Configuration), Phase 3 (Prepare Experiment), and Phase 4 (Validation).
[!IMPORTANT] Sequential Execution & Status Updates:
- Sequential Execution: You must execute each step in the workflow sequentially. Do NOT skip any steps or proceed to a subsequent step until the current step has fully completed, returned its outputs, and validated its constraints.
- Status Updates: You MUST update the
statusfield inscratch/triage_state.jsonwhenever transferring to another step (i.e., at the end of each step) to track progress. The status value should reflect the step name or number just completed (e.g.,"CQ Triage: Step 5 Completed"). The final terminal status values must be set to either"FIXED"or"ESCALATED".
scratch/triage_state.json and initialize/append ALL
variables defined in
templates/triage_state_template.json in
scratch/triage_state.json (setting unresolved variables to null or empty
dictionaries). Ensure all existing variables already defined in
scratch/triage_state.json (such as bug_id, status, bug_details, etc.,
initialized by the orchestrator) are preserved.scratch/triage_state.json.bug_details in
scratch/triage_state.json and store it in the original_cl variable in
scratch/triage_state.json. Then, verify the repository and retrieve modified
files for original_cl. (Note: You can use
tools/code_coverage/parse_gerrit_url.py to extract host, project,
change, and patchset details from any CL URL when needed).original_cl (the CL URL) and the list of
modified_files. Update these variables in scratch/triage_state.json.chromium/src repository. If the CL targets recipe or infrastructure
repositories (e.g. infra/build), stop immediately and inform the user that
recipe triage is out of scope for this playbook.original_cl and modified_files in
scratch/triage_state.json.bug_details or is not
provided, prompt the user to get it.modified_files (retrieved in Step 2) with the
developer's bug report (found in bug_details in
scratch/triage_state.json)..cc, .cpp,
.java, etc.) the developer is complaining about in bug_details. Set
target_files to only contain those specific files matching the bug
report. If the bug report does not specify files, keep all modified
application source files from modified_files.bug_details. Set metrics_of_concern to only
contain matching metrics from the standard options ("absolute_coverage",
"incremental_coverage", "absolute_unit_tests_coverage",
"incremental_unit_tests_coverage"). If the bug report does not specify,
keep all four standard coverage metrics.target_files list and
metrics_of_concern list under investigation. Update both target_files and
metrics_of_concern in scratch/triage_state.json.target_files using a sub-agent.metrics_reader sub-agent equipped with the
experimental-read-code-coverage-metrics
skill. You MUST explicitly pass cl_url (read original_cl from
scratch/triage_state.json),
artifact_path: "scratch/original_metrics.json", and target_files (read
from scratch/triage_state.json) in the subagent prompt.metrics_reader sub-agent to complete before
proceeding.target_files in scratch/original_metrics.json.unit_tests, browser_tests)
compile the modified files.test_suites for the target files.
Update test_suites in scratch/triage_state.json.builders_of_concern based on the
file language:
android-arm64-rel, android-x86-rel, android-12-x64-rel,
android-cronet-x64-dbg-14-testslinux-relmac-rel, ios-simulator, ios-simulator-full-configswin-rellinux-chromeos-relandroid-arm64-rel, android-x86-rel, android-12-x64-rel,
android-cronet-x64-dbg-14-testsbuilders_of_concern. Update
builders_of_concern in scratch/triage_state.json.builders_of_concern:
verify-coverage-fix) if
fix_branch_name is None, and update fix_branch_name in
scratch/triage_state.json. Check out fix_branch_name.lucicfg generate infra/config/main.star
builders_of_concern, and update fix_branch_name in
scratch/triage_state.json (if created).builders_of_concern in
parallel by invoking a specialized sub-agent for each builder.builder_auditor sub-agent for each builder in
builders_of_concern. Equip each sub-agent with the
experimental-builder-config-validator skill and the
experimental-ci-only-validator skill. When launching each sub-agent,
instruct it to:
builders_of_concern and language_context ("cpp", "objc",
"rust", "java", "js", or "ts", inferred from target_files) to
experimental-builder-config-validator to validate GN arguments.experimental-ci-only-validator to verify if any of the mapped
test_suites (from scratch/triage_state.json) are barred by
ci_only = True on that builder (checking all mapped test suites, not just
one).builder_auditor sub-agents to return their results
before proceeding to Phase 3.ci_only = True:
ci_only = True flag for any barred test suite on that builder
in Starlark.fix_branch_name branch (creating the branch from main if
fix_branch_name is None).lucicfg generate infra/config/main.star
ci_only settings
are valid across all builders_of_concern and all mapped test_suites. If
configuration fixes were applied, update fix_branch_name in
scratch/triage_state.json (if created).builders_of_concern.scratch/config_summary.md documenting whether any test suites were added or
patched, any GN arguments were corrected, or any ci_only flags were removed
(or confirming that existing builder configurations were valid without
changes).fix_branch_name:
fix_branch_name is NOT None: We need two branches:
fix_branch_name).verify-coverage-baseline, and set control_branch_name to this
branch).fix_branch_name is None: We only need one branch:
verify-coverage-baseline, and set control_branch_name to this
branch).control_branch_name and, if it wasn't
already created, fix_branch_name. Update control_branch_name and
fix_branch_name in scratch/triage_state.json.cl_generator sub-agents in parallel (one
for the baseline branch and one for the experimental fix branch if created).
Equip both sub-agents with the
experimental-code-coverage-verification-prep skill to inject dummy comments,
optimize Starlark configs, and upload CLs to Gerrit. When launching each
cl_generator sub-agent, instruct it to read its primary
inputs (target_files, builders_of_concern, test_suites, bug_id)
directly from scratch/triage_state.json. You MUST pass role ("Control"
or "Fix"). For "Fix" runs, also pass in a summary of the configuration and
recipe fixes applied (e.g. from scratch/config_summary.md,
scratch/swarming_summary.md, or scratch/local_debugging.md) so the
sub-agent can generate a descriptive CL description.cl_generator sub-agents to return their results
before proceeding to Step 12.control_cl and fix_cl (if
applicable). Update control_cl and fix_cl in scratch/triage_state.json.control_cl is already instantiated with a non-null value in
scratch/triage_state.json (such as during subsequent iterations or if
pre-populated), skip generating control_cl and do NOT launch a
cl_generator sub-agent for the control run. Only launch the sub-agent for
the experimental fix branch (role: "Fix").build_invoker sub-agents in parallel (one
for the control CL and one for the fix CL if created). Equip both sub-agents
with the experimental-code-coverage-build-invoker skill. When launching each
sub-agent, instruct it to:
control_cl: pass builders_of_concern and the designated
control_cl URL (read from scratch/triage_state.json).fix_cl (if created): pass builders_of_concern and the designated
fix_cl URL (read from scratch/triage_state.json).build_invoker sub-agents to return their results
before proceeding to Phase 4.control_builds (for control CL) or
fix_builds (for fix CL). Update control_builds and fix_builds in
scratch/triage_state.json.control_builds is already instantiated with non-empty values in
scratch/triage_state.json (such as during subsequent iterations or if
pre-populated), skip triggering try jobs for control_cl and do NOT launch a
build_invoker sub-agent for the control run. Only trigger try jobs for
fix_cl.build_inspector sub-agent for each target builder
in builders_of_concern. Equip each sub-agent with the
experimental-code-coverage-build-inspector skill. When launching each
sub-agent, the parent agent MUST pass builder_name (e.g., "linux-rel").
Instruct each sub-agent to:
control_builds[builder_name] and fix_builds[builder_name] (if
present) from scratch/triage_state.json.experimental-code-coverage-build-inspector for the build link(s),
passing language_context ("cpp", "objc", "rust", "java", "js",
or "ts"), test_suites, and target_files (read from
scratch/triage_state.json), to verify GN arguments, inspect merge script
logs for the specific target test suites, and check whether coverage data
is generated for target_files in the HTML report and downloaded JSON
coverage artifacts. (Note: It is also possible that we only have a control
build with no fix build. If fix_builds[builder_name] is omitted, inspect
only the control build).scratch/inspection_<builder_name>.md documenting whether coverage
processing succeeded on the fix build compared to the control (or
documenting baseline results if no fix build exists).build_inspector sub-agents to return their results.build_inspector sub-agent to invoke the schedule tool
(CronExpression="*/10 * * * *") to check back every 10 minutes until
terminal build completion before continuing to Step 14.control_builds and fix_builds, and the generated
inspection artifacts (scratch/inspection_<builder_name>.md for each builder
of concern). Update control_builds and fix_builds in
scratch/triage_state.json.scratch/inspection_<builder_name>.md generated in Step 13) across all
builders_of_concern.scratch/inspection_summary.md which summarizes all the information from all
the inspected scratch/inspection_<builder_name>.md files across all
builders_of_concern, confirming whether coverage generation changed/resolved
due to our configuration fixes (or confirming baseline coverage generation if
no fix build was triggered).metrics_reader sub-agents in parallel (one
for the control CL and one for the fix CL if created). Equip both sub-agents
with the
experimental-read-code-coverage-metrics
skill. When launching each sub-agent, you MUST explicitly pass:
cl_url (control_cl),
artifact_path: "scratch/control_metrics.json", and target_files (read
from scratch/triage_state.json).cl_url (fix_cl),
artifact_path: "scratch/fix_metrics.json", and target_files (read from
scratch/triage_state.json).metrics_reader sub-agents to complete before
proceeding.scratch/control_metrics.json (for baseline control CL) and
scratch/fix_metrics.json (for experimental fix CL).scratch/control_metrics.json already exists (such as during
iteration 2 or 3), skip launching the metrics_reader subagent for the
control CL and only launch one for scratch/fix_metrics.json.scratch/metrics_summary.json.scratch/original_metrics.json against
the coverage data in scratch/control_metrics.json and
scratch/fix_metrics.json.
status as "FIXED" in
scratch/triage_state.json and jump directly to Step 20 to formulate
Root Cause Analysis.swarming_validator sub-agent equipped with the
experimental-code-coverage-swarming-output-validator skill. You MUST pass
test_suites and build_url (read from scratch/triage_state.json).
Instruct the subagent to create a summary document of all steps taken and
insights gained at scratch/swarming_summary.md.local_debugger sub-agent equipped with the
experimental-code-coverage-local-debugger skill. Instruct the subagent to
create a summary document of all steps taken and insights gained at
scratch/local_debugging.md.scratch/swarming_summary.md and
scratch/local_debugging.md to evaluate whether findings indicate that an
additional fix (such as a Starlark recipe fix, GN argument change, or test
harness patch) is required.scratch/triage_state.json under "iteration", defaulting to 1) is less
than 3:
"iteration" by 1 in scratch/triage_state.json.fix_branch_name) and commit them so subsequent uploads append new
patchsets to the same experimental CL (fix_cl).scratch/fix_metrics.json, scratch/metrics_summary.json,
scratch/inspection_*.md, scratch/swarming_summary.md,
scratch/local_debugging.md) by moving them into
scratch/iteration_<N-1>/. Do NOT archive scratch/control_metrics.json
as it is preserved across iterations. Also copy
scratch/triage_state.json to
scratch/iteration_<N-1>/triage_state.json to snapshot prior build URLs.
Then, in the active scratch/triage_state.json file, reset fix-related
variables ("fix_builds": {}) while preserving Phase 1 metadata and
control baseline variables ("control_builds", "control_cl").hypothesis_summarizer sub-agent to synthesize all
debugging iterations, tryjob links, metrics, and findings into a concise final
report.hypothesis_summarizer sub-agent. Instruct it to:
scratch/triage_state.json, current iteration scratch files, and any
archived scratch/iteration_*/ verification files.scratch/final_hypothesis_summary.md documenting:
scratch/triage_state.json under the "rca" variable (referencing
templates/triage_state_template.json for
the variable contract).status to "FIXED" or "ESCALATED" in
scratch/triage_state.json.