agentleFS
imbue-aiimbue-ai/sculptor/.claude/skills/run-integration-test/SKILL.md

run-integration-test

Skill246 starsChanged 5 months agoMITView on GitHub

Run Sculptor integration tests. MUST be used whenever: - Running tests in sculptor/tests/integration/ - User asks to "run integration tests" or "run the tests" for integration test files - Using pytest on integration test files

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If you exhaust the ladder (rung 3 trips) without completion, treat it as hung regardless of apparent progress — something is consuming the …

    line 77
  2. Distinctive:

    Start small, grow up. Each rung's wake-up is both a hang backstop and a progress check.

    line 81
  3. Very specific:

    Look for the N passed / N failed summary.

    line 99

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Sculptor Integration Test Runner

What NOT To Do

  • uv run pytest directly — use just test-integration so the test harness wraps it correctly.
  • TaskOutput on the test task — returns all cumulative output and can blow context. Use tail on the log file at the end instead.
  • Polling with repeated sleep N && tail — let Monitor wake you on completion or timeout.

The Pattern

Run the test in the background with a completion marker appended to its log. Arm a Monitor with an until-loop that trips on the marker, with timeout_ms sized from the ladder below. On each Monitor timeout, check the log: if still progressing, re-arm with the next rung; if stale, kill.

Step 1: Create a unique log file

mktemp -t integration-test

Note the returned path. The rest of the steps reference it as <LOG>.

Step 2: Launch the test in background with a completion marker

{
  "command": "( just test-integration sculptor/tests/integration/path/to/test.py 2>&1; echo \"JUST_COMPLETED: $?\" ) > <LOG> 2>&1",
  "run_in_background": true,
  "description": "Run integration test in background"
}

The subshell + echo "JUST_COMPLETED: $?" guarantees the log ends with a marker on any exit. Monitor watches for that marker. Note the returned task_id — you need it to kill a real hang.

Multiple test files must be quoted as a single argument to just test-integration:

( just test-integration "sculptor/tests/integration/a.py sculptor/tests/integration/b.py" 2>&1; echo "JUST_COMPLETED: $?" ) > <LOG> 2>&1

Step 3: Arm the Monitor watchdog at rung 1

{
  "command": "until grep -q \"JUST_COMPLETED:\" <LOG> 2>/dev/null; do sleep 3; done; echo \"TEST_COMPLETED\"",
  "description": "integration test completion watcher",
  "timeout_ms": <RUNG_1_MS>,
  "persistent": false
}

Step 4: On Monitor event

TEST_COMPLETED (or the test task's completion notification) → go to Step 5.

[Monitor timed out — re-arm if needed.] → NOT necessarily a hang. Tail the log:

tail -30 <LOG>

Note: the tee'd <LOG> shows the just wrapper output, which prints the .just-logs/test-integration-*.log path — tail that file for actual pytest progress.

  • Fresh output — new lines since your last look, or recent timestamps — the test is progressing. Re-arm Monitor with the next rung in the ladder and wait again.
  • Stale — no new content since last check → genuine hang. TaskStop the task from Step 2, then go to Step 5 to inspect partial output.

If you exhaust the ladder (rung 3 trips) without completion, treat it as hung regardless of apparent progress — something is consuming the budget. TaskStop and report.

Step 4b: Timeout ladder

Start small, grow up. Each rung's wake-up is both a hang backstop and a progress check.

ScopeRung 1Rung 2Rung 3
Single test function60_000180_000600_000
Single test file (default)120_000300_000900_000
Multi-file suite300_000600_0001_800_000

Why a ladder? Most runs complete at rung 1, giving you a fast wake-up. Slow tests get more time only when they've earned it by showing progress. A single giant timeout hides all of this.

Step 5: Read results

just writes pytest output to .just-logs/test-integration-<timestamp>.log. Tail the newest:

Bash: ls -t .just-logs/test-integration-*.log | head -1 | xargs tail -30

Look for the N passed / N failed summary. The tee'd <LOG> only contains wrapper output and the JUST_COMPLETED: marker — useful for the exit code, not pytest details.

Example (normal completion)

1. Bash: mktemp -t integration-test
   → /var/folders/.../integration-test.b5N49YB3VL

2. Bash (run_in_background: true):
     ( just test-integration sculptor/tests/integration/frontend/test_homepage.py 2>&1; echo "JUST_COMPLETED: $?" ) > /var/folders/.../integration-test.b5N49YB3VL 2>&1
   → task_id="b7q6lny77"

3. Monitor (timeout_ms: 120000):
     until grep -q "JUST_COMPLETED:" /var/folders/.../integration-test.b5N49YB3VL 2>/dev/null; do sleep 3; done; echo "TEST_COMPLETED"
   → task_id="bl7ca3bqd"

4. Event "TEST_COMPLETED" arrives at ~90s.

5. Bash: ls -t .just-logs/test-integration-*.log | head -1 | xargs tail -30
   → "============================= 10 passed in 27.40s =============================="

Example (slow test — ladder climb)

3.  Monitor rung 1 (120000ms). Times out.
4.  Tail .just-logs — latest file mtime 4s ago, new lines since last check.
    → progressing. Re-arm Monitor rung 2 (300000ms).
4b. Event "TEST_COMPLETED" arrives at ~240s.
5.  Tail summary.

Example (true hang)

3.  Monitor rung 1 (120000ms). Times out.
4.  Tail .just-logs — latest file mtime 2m ago, no new content.
    → hang. TaskStop task_id="b7q6lny77".
5.  Tail partial log for diagnosis.

Why this shape

  • run_in_background keeps the conversation unblocked.
  • The JUST_COMPLETED: marker is a file-level signal that works uniformly across test files, independent of pytest config.
  • Monitor's timeout_ms is the single source of truth for each rung's ceiling. No external gtimeout/timeout needed.
  • The ladder gives you early wake-ups (fast feedback when the test finishes quickly) AND a generous final ceiling (avoids killing legitimately slow tests), with a progress check between rungs to distinguish slow from stuck.
  • One tail at the end keeps context clean.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.