agentsclimarketplace

Systematic debugging

Skill Chenghao-Wu/superscientist/skills/systematic-debugging

Use when any workflow stage fails — simulation, analysis, plotting, post-processing, or environment setup — before proposing fixesFrom its SKILL.md

Install
npx -y skills add Chenghao-Wu/superscientist --skill systematic-debugging

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

5.7 KB, as published. Nobody here has run it

Systematic Debugging

Overview

Random fixes waste time. Investigate root cause first.

Core principle: ALWAYS find root cause before attempting fixes.

Violating the letter of this process is violating the spirit of debugging.

The Iron Law

NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST

Phase 1: Gather Evidence

  1. Read error output — Read the failed stage's output and error files completely. Don't skip.
  2. Read progress.log — What was attempted? What happened before the failure?
  3. Read stage spec — What was this stage supposed to do? What are the inputs, parameters, success criteria?
  4. Reproduce — Can you trigger the failure again with the same inputs?

Phase 2: Diagnose Failure Category

CategorySymptomsCommon Causes
Input errorMissing files, wrong format, bad parametersTypo in paths, wrong output from prior stage
Convergence failureIterative solver not converging, optimization stalledBad initial conditions, too tight criteria, wrong method
Numerical instabilityNaN values, diverging quantities, unphysical outputsStep size too large, ill-conditioned inputs, problematic initial state
Resource limitOOM, timeout, disk fullSystem too large, too many k-points, long trajectory
Wrong resultsConverged but incorrect answerWrong method/model, missing correction, inappropriate approximation
Analysis/plotting errorMissing data, wrong column, library issueWrong file format, missing dependency, encoding
Environment issueMissing binary, wrong version, import errorWrong conda env, missing package, version mismatch
Dependency conflictSoftware missing feature, incompatible libsSoftware missing required module, incompatible library versions

Phase 3: Hypothesis and Test

  1. Form single hypothesis — "I think X is the root cause because Y"
  2. Test minimally — Smallest possible change. One variable at a time.
  3. Verify — Did it work? Yes → Phase 4. No → new hypothesis.
  4. If 3+ fixes failed — STOP. Question whether the approach is fundamentally wrong. Discuss with user before continuing.

Phase 4: Fix and Retry

  1. Apply the fix
  2. Update progress.log with diagnosis and fix applied
  3. Never remove the failed attempt from the log — append the retry
  4. Retry the stage via superscientist:executing-workflows
  5. retry_count is incremented in workflow-state.json

DPDispatcher Failures (HPC Stages)

When an HPC stage fails (any stage using a remote backend profile), always start with dpdispatcher.log — it is available locally without any download.

Step 1: Read dpdispatcher.log

cat {workflow_root}/dpdispatcher.log

Extract for the failed stage's submission:

  • Job IDs: Slurm/PBS job IDs (e.g., job_id: 23085)
  • Status: terminated (non-zero Slurm exit) or finished (exit 0 but DPDispatcher found issues)
  • fail_count: Number of times DPDispatcher internally retried the job
  • Remote path: The hash-based remote working directory (e.g., 959691370546a346be2a4770ce9b93789f42ce6a)

Step 2: Classify the failure

DPDispatcher statusMeaningRoot cause categoryNext step
terminatedScheduler killed the jobScheduler/resource error: wrong partition, OOM, walltime exceeded, invalid GPU request, duplicate --gresFix resources or custom_flags in submission parameters
finished + backward_files missingJob ran to completion but expected outputs not createdCommand-level error: wrong input script, missing software package, wrong binary pathRead stage-N/log and stage-N/err if downloaded; if not, request Level 2 diagnostic reproduction run from orchestrator
DPDispatcher error (Python traceback)DPDispatcher itself failedSSH/network issue, remote_root misconfigured, $ref config invalidCheck machine config path, network connectivity; retry

Step 3: Check for custom_flags issues

If the job was terminated by the scheduler, check dpdispatcher.log or the original submission.json for common custom_flags problems:

  • Missing #SBATCH prefix: Entries like "--qos=4gpus" instead of "#SBATCH --qos=4gpus" are silently ignored by Slurm. They appear as bare shell lines in the .sub script.
  • Duplicate directives: gpu_per_node: 1 auto-generates #SBATCH --gres=gpu:1. Adding "#SBATCH --gres=gpu:1" to custom_flags creates a duplicate that some schedulers reject.

Wrong Results: The Hardest Category

When the calculation converges and files look correct, but the answer is physically wrong:

  1. Check against known reference values (published data, databases, analytical solutions)
  2. Check domain-appropriate bounds (values within physically/mathematically meaningful ranges)
  3. Check internal consistency (outputs internally consistent — quantities derived from the same source agree)
  4. If no reference exists — propose a validation calculation against a well-known test case as a new stage (via amendment protocol)

Red Flags

ThoughtReality
"I know what's wrong"Investigate first. You might be wrong.
"Quick fix, let me try"Root cause first. Phase 1 → 2 → 3 → 4.
"Let me try one more fix" (after 2+)Stop. Question the approach. Talk to user.
"Results look close enough"Check against reference. "Close" might be wrong.
"The error is in the simulation code" (HPC stage)Read dpdispatcher.log first. The failure may be scheduler-level, not code-level.

Keep looking

Skills are one crate of 627,559. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.