بنقرة واحدة
iterate-fix
Deploy-test-debug retry strategy — triage failures, bound retries, escalate when stuck
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Deploy-test-debug retry strategy — triage failures, bound retries, escalate when stuck
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Known-good Juju bundle shapes (COS Lite, 12-Factor + COS, Identity Platform, Charmed Kubeflow) — canonical app lists and relation edges
Implementing Juju actions for operational tasks in charms. WHEN: add Juju actions to a charm, implement backup / rotate-credentials / restore actions, declare actions in charmcraft.yaml, write action handlers, test actions with Scenario, run actions with juju run.
Adding and validating charm configuration options. WHEN: add charm configuration options, declare config in charmcraft.yaml, validate config values in config-changed, apply config to a Pebble layer, apply config to a machine charm, write Scenario tests for config.
End-to-end workflow for building ops-framework charms for custom applications (K8s and machine). WHEN: build a custom Juju charm, write src/charm.py with Pebble, write a machine charm with systemd, decide K8s vs machine substrate, scaffold a non-paas-charm with charmcraft init, customise the ops framework charm lifecycle.
Workflow for charming infrastructure software (databases, caches, message brokers, proxies, monitoring). WHEN: charm infrastructure software, charm a database / cache / message broker / proxy / monitoring system, implement peer relations, leader election, primary/replica failover, backup and restore actions, clustering.
Expert guidance for developing, building, testing, and publishing Juju charms using charmcraft. WHEN: edit charmcraft.yaml, run charmcraft pack, run charmcraft init, manage charm libraries, publish a charm to Charmhub, set up multi-base builds, configure relations / config options, set up storage or containers.
| name | iterate-fix |
| description | Deploy-test-debug retry strategy — triage failures, bound retries, escalate when stuck |
A formalised retry loop for the deploy → verify → test → fix cycle. Cantrip's
autodeploy helpers already produce follow-up tasks after a failed
BUILD, DEPLOY, or TEST run ([Red/Green retry],
[Acceptance fix], Diagnose deployment failure:, and
[Watcher] tasks). This skill tells you how to handle the feedback
you receive in those follow-ups — what to fix first, when to stop, and
when to ask for help.
Run this skill at the start of a follow-up task whose title begins with any of:
[Red/Green retry] — partial integration-test progress[Acceptance fix] — acceptance test produced a FAIL verdictDiagnose deployment failure: — verify-after-deploy failed[Watcher] — the watcher surfaced a runtime eventOr any time you are about to start a BUILD/DEBUG task that references a prior failure. Skip for fresh RESEARCH / PLAN / DESIGN work.
Never jump straight to code changes. Spend the first tool call on reading the signal.
Source each failure into exactly one bucket:
juju_status on the controller model (juju status -m controller
when available) before touching charm code.juju deploy failed, relation hook errored,
WaitingStatus after five minutes. Check juju_debug_log and
juju_show_unit before assuming the charm code is wrong.ActiveStatus but wrong behaviour. Check loki_query for the
workload logs; check juju_ssh / pebble state for container
services. Also scan juju_debug_log at DEBUG level for lines
logging how many deferred events are in the queue — ops now emits a
total-deferred count per hook. A growing backlog (dozens, hundreds)
almost always points at a deferred handler that never makes
progress; fix that before chasing surface symptoms.Within a category, fix in this order:
ErrorStatus or
BlockedStatus (nothing else can proceed until this is gone).For Workload-bucket failures where juju_debug_log and
loki_query leave the root cause unclear, fall back to interactive
debugging tools before guessing at fixes:
ops.Framework.breakpoint() drops the running charm into pdb
on the next hook firing. Add the call in the suspect handler, fire
the event with jhack utils fire (or wait for the natural
trigger), then juju debug-code <unit> attaches your terminal to
the pdb session. Remove the breakpoint when done.debugpy lets you attach a remote VS Code / IDE debugger
instead of a CLI pdb. Add debugpy.listen() early in
__init__, set the wait flag if you want the charm to pause on
startup, and forward the port from the unit. See the upstream
ops debugging how-to for the exact wiring.jhack scenario snapshot <unit> captures the live state
(relations, config, secrets) so you can reproduce the failure as a
Scenario unit test offline — often faster than re-running the full
deployment.breakpoint() in a Scenario test. ops.testing no
longer rebinds sys.breakpointhook during Context.run, so you
can drop a breakpoint() into the charm handler and
uv run pytest -s tests/unit/test_charm.py lands you in pdb at
the offending line. No deploy needed — this is the fastest
iteration loop once the snapshot is captured.These tools cost a deploy iteration each (except the last, which is local) but eliminate guesswork — prefer them over a fourth speculative fix attempt.
Infinite loops are the biggest risk in autonomous iteration. Cantrip's
autodeploy helpers already prevent trivial chains (_RETRY_PREFIX
checks stop a retry from spawning another retry), but the strategy
inside each retry is on you.
If the same test, hook, or status message has already failed on two prior attempts with fixes applied between attempts, stop. The next step is not a third try with a new guess — it's asking the user.
Signals you've used your budget:
FAILED in a retry task's
[Previous result (excerpt):] block.juju status shows the same unit in the same BlockedStatus
message across two consecutive attempts.loki_query returns the same traceback signature after a fresh
deploy.For a single originating failure, never run more than three fix
attempts in an unbroken chain. If you're on attempt four, escalate:
add a CONFIRM task asking the user what to try next.
Finish the iterate-fix cycle when any of these are true:
juju status reports every app as active/idle and the
originating test suite passes.Don't ask too early; don't press on too long. Good triggers:
ops, jubilant,
charmcraft) — surface the reproducer and move on.When you stop — whether successful or escalating — emit a short block the next subagent can read without re-reading the whole transcript:
[iterate-fix] attempt <N>/<max>: <outcome>
What failed first: <one-line summary of the earliest failure>
What I tried: <bullet list of fixes applied>
What's still broken: <what's left, if anything>
Next step (if not done): <specific tool call or user question>
If the loop succeeded (green status, tests pass, no warnings):
[iterate-fix] green on attempt <N>
find-bugs / security-review. Run those
on any new code you write during the iteration.