Install
openclaw skills install @sdk-team/alibabacloud-oss-lifecycle-runtime-diagnosisRead-only OSS diagnosis for lifecycle runtime and archive restore. Use when a lifecycle rule does not take effect (loading window, prefix/tag matching, one-way transition, versioning), when an archive / cold archive / deep cold archive object cannot be read (restore tiers, archive direct read), or for storage tiering advice and restore/retrieval fee composition. Triggers: "lifecycle rule not working", "archive file cannot download", "InvalidObjectState", "RestoreAlreadyInProgress", "Overlap for same action type", "The operation is not valid for the object's state", "restore fee", "storage class transition", "cold archive restore duration", "storage tiering". Do NOT use for bill line-items (alibabacloud-oss-billing-diagnosis), data recovery (alibabacloud-oss-deletion-recovery-diagnosis), transfer error codes (alibabacloud-oss-transfer-error-code-diagnosis), backup-tool retrieval fees (alibabacloud-oss-backup-integration-diagnosis), or write operations.
openclaw skills install @sdk-team/alibabacloud-oss-lifecycle-runtime-diagnosisDiagnose Alibaba Cloud OSS lifecycle and archive problems: "I configured a lifecycle rule but the files are still Standard / not deleted", "my archive file cannot download and returns InvalidObjectState", "how long does a cold archive restore take and what is the restore fee", "how should I tier my storage to cut cost".
Core approach: verify the caller identity, fetch the bucket metadata with the read-only GetBucketInfo control-plane query, read the versioning state with GetBucketVersioning and the actual lifecycle configuration with GetBucketLifecycle, then run a pure-function attribution engine on the evidence: rule loading window (24 hours after creation + daily 08:00 Beijing-time execution), prefix/tag matching against the object key, longest-prefix conflict coverage, delete-over-transition priority on identical scopes, the one-way storage-class transition ladder, and versioning-specific expiration semantics. For restore questions, map the storage class and the reported error code to the official restore tier table (duration and replica validity) and fee composition; the restore itself is always described as user-executed guidance. Conclude with evidence-based findings only; this skill never changes anything.
PutBucketLifecycle, DeleteBucketLifecycle, RestoreObject, PutObject/copy-based storage-class conversion, ossutil restore, ossutil set-meta, PutBucketVersioning, or any ACL/policy change. This includes commands "for the user to run manually" issued from the scripts; rule creation and restores are described as manual guidance in words only, and the user executes them. When a lifecycle rule change is needed, MANDATORY behavior: output a configuration template (XML/JSON shape or console path) as advice - never call the write API.scripts/ (oss_lifecycle_runtime_diagnosis.py as the entry, sts_token.py for identity). The Agent is forbidden from assembling its own ossutil / SDK / curl commands against the OSS control plane or bypassing the scripts - the scripts embed timeout, error degradation, and observability guarantees that ad-hoc commands lack. Read the script output, interpret it, and compose the report; do not re-implement the queries.NoSuchLifecycle means "no rule configured" - report it as a finding, not as an error.[WARN] <category>: <message> to stderr, continue with the remaining steps (including the ListBuckets fallback), and still produce the final report with STATUS: DEGRADED and a NEXT_ACTION line - never silently skip or abort without a report.MANDATORY: For configuration or usage questions, the entry script MUST be invoked with --question "". The script first matches embedded knowledge, then verifies against official OSS docs (doc_verification, llms-index). The final answer MUST cite the URLs from doc_verification.docs. If doc_verification.note starts with DEGRADED, state explicitly: "Unable to verify against online official docs (offline)." Never fabricate doc URLs; only URLs returned by the script may be cited.
All diagnostics MUST be performed by running the scripts under scripts/. Read the structured JSON report, interpret findings / restore / recommendations, and compose the user-facing answer; do not re-implement the queries or call OSS APIs directly.
Route here when the user reports: a lifecycle rule that does not take effect (files not converted / not deleted, rule stuck in the console "loading" state forever, rules seemingly ignored, two rules with overlapping prefixes rejected with Overlap for same action type, a tag-filtered rule that never matches); an archive / cold archive / deep cold archive object that cannot be downloaded or read (InvalidObjectState, "The operation is not valid for the object's state", RestoreAlreadyInProgress, "restore in progress", restore duration questions, or Archive Direct Read as the no-restore alternative); the restore / retrieval fee composition and replica validity window behind an unfreeze; versioning-specific results such as a delete marker instead of a real delete or cleaning up non-current versions; or requests for storage tiering strategy advice.
All API calls issued by the scripts include:
AlibabaCloud-Agent-Skills/{skill-name}/{session-id} skill-version/{skill-version}, where {skill-name} is alibabacloud-oss-lifecycle-runtime-diagnosisreferences/manifest.json (version), the single place where this skill's version is declared. It is never hardcoded, guessed or reused: the entry script resolves and validates it before the first cloud call and stops with STATUS: FAIL (exit 1) when the manifest is missing or its version is invalid.uuid.uuid4().hex) generated once per script run and attached to every OSS SDK request (User-Agent header) and every --user-agent argument of the aliyun CLI identity call of that run, so all calls of one diagnosis can be correlated.The shared client layer (scripts/_oss_client.py) implements this automatically: the session-id is generated lazily on the first call of each run and cached for the rest of the run, and the skill-version is resolved lazily from references/manifest.json on the first User-Agent build.
0 -- the run produced a conclusion: STATUS: OK, or STATUS: DEGRADED
when part of the evidence was unavailable (the missing steps are recorded in
errors[] and as [WARN] lines on stderr; the conclusion is still usable).1 -- no usable conclusion: STATUS: FAIL, because required input is
missing or every evidence call failed. NEXT_ACTION states what to ask the
user for or what to fix; do not treat this as a success.2 -- argparse usage error only (unknown option). A diagnosed condition never
exits with 2.Credentials are resolved exclusively by the default credential chain:
ALIBABA_CLOUD_ACCESS_KEY_ID, ALIBABA_CLOUD_ACCESS_KEY_SECRET, and optionally ALIBABA_CLOUD_SECURITY_TOKEN (STS sessions).aliyun sts get-caller-identity): the aliyun CLI default credential chain (environment or ~/.aliyun/config.json).Do not read, print, or pass AK/SK/STS tokens explicitly. If the identity check fails, guide the user to run aliyun configure - never ask for AK/SK.
The scripts shell out to the aliyun CLI (at minimum the aliyun sts get-caller-identity identity pre-check), which MUST be version 3.3.3 or newer: older builds resolve the default credential chain differently and can drop the STS session token. Verify the installed version and upgrade it before the first run:
aliyun version # must print 3.3.3 or newer (measured with 3.4.5)
aliyun upgrade --yes # upgrade the installed CLI in place to the latest version
If the CLI is not installed at all, install the Alibaba Cloud CLI package for the host OS from the official release channel and then run aliyun configure (the profile stays in ~/.aliyun/config.json; this skill never asks for AK/SK). When the CLI is missing, too old to upgrade, or unauthenticated, the identity pre-check degrades instead of aborting: scripts/_oss_client.py logs [WARN] identity pre-check failed: ... on stderr, records the empty UID, and the diagnosis still runs to a conclusion, because the identity label is traceability only and never evidence.
cd $SKILL_DIR
# Verify caller identity (informational only; credentials always come from the default chain)
python3 scripts/sts_token.py
Because every action of this skill is strictly read-only, no user confirmation is required before running the diagnostic scripts. Confirmation discipline applies at the scope boundary instead: when a request asks for an actual rule write, a restore execution, or any mutation (Absolute Rule 1), do not execute it - output the configuration template / manual guidance only. When a request falls outside lifecycle runtime / restore attribution (Absolute Rule 6), state the boundary and defer to the responsible skill or manual handling.
--bucket): required; the OSS bucket to diagnose.--scope): optional; lifecycle (rule-not-working attribution), restore (archive restore diagnosis), strategy (tiering advice), or all (default).--object): optional; the object the user cares about, used for prefix-matching attribution.--object-class): optional; the object's actual class (Standard/IA/Archive/ColdArchive/DeepColdArchive); when absent it is auto-defaulted to the bucket default class and declared.--error): optional; the data-plane error the user hit (e.g. InvalidObjectState, RestoreAlreadyInProgress).--days-since-created): optional; checks the Days-policy 24-hour spacing requirement.--region): optional; used to derive the query endpoint.aliyun sts get-caller-identity and used only as a traceability label. Auto-fill first, ask second: never ask the user for UID when it can be derived.Auto-fill declaration requirement: Whenever any parameter is auto-filled (query endpoint defaulted or derived from --region, object class defaulted to the bucket default class, UID derived), the Agent MUST explicitly declare this in the response or report metadata, e.g. "query endpoint auto-defaulted to oss-cn-hangzhou.aliyuncs.com (no --region provided)".
Reference modules, strictly 1:1 with the references/ directory:
| Module | File | Responsibility |
|---|---|---|
| M1: Lifecycle playbook | references/lifecycle-playbook.md | Rule loading/execution mechanism, matching conditions, conflict/coverage semantics, versioning behavior, one-way transition ladder, not-working attribution tree |
| M2: Restore guide | references/restore-guide.md | Archive/ColdArchive/DeepColdArchive restore tiers and duration, replica validity, fee composition, InvalidObjectState/RestoreAlreadyInProgress routing, storage tiering advice |
| M3: RAM policies | references/ram-policies.md | Minimal read-only RAM policy required by this skill |
Symptom routing before running the entry script:
--scope lifecycle with --object <key> (and --days-since-created <N> when known).--scope restore with --object-class <class> and --error <code> when reported.--scope strategy.--scope all.Run python3 scripts/sts_token.py to verify credentials and derive the UID (traceability label only). Collect the bucket name, the symptom family, the object key / storage class / error code when known; map the symptom with the Orchestration section above.
cd $SKILL_DIR && python3 scripts/oss_lifecycle_runtime_diagnosis.py \
--bucket <name> [--scope lifecycle|restore|strategy|all] \
[--object <key>] [--object-class <class>] [--error <code>] \
[--days-since-created <N>] [--region <region>]
The script:
aliyun sts get-caller-identity (degraded with [WARN] on failure).GetBucketInfo through the oss2 SDK with the resolved endpoint, carrying the session-id User-Agent and a per-call timeout; on failure falls back to ListBuckets (prefix lookup) to locate the bucket's region.GetBucketVersioning and GetBucketLifecycle (each degraded with [WARN]); NoSuchLifecycle is normalized to "no rules configured", a finding rather than an error.STATUS: OK | DEGRADED and NEXT_ACTION: <action>.Read findings, restore, and recommendations from the report:
NEXT_ACTION guidance honestly; never invent rule definitions or restore states.Summarize the root cause with the actual fields from the report. Base the conclusion on the script's findings / restore / recommendations / next_action fields rather than re-deriving them. Suggestions must be evidence-based and stated as manual guidance only (this skill never applies any change; PutBucketLifecycle is only ever shown as a template).
sts:GetCallerIdentity; never modifies anything.Example 1 - lifecycle rule not working
User: "I set a lifecycle rule on bucket test-agentceping (UID 1552974654746705, cn-hangzhou) to convert logs/ to IA after 30 days, but the files are still Standard - lifecycle rule not working."
python3 scripts/oss_lifecycle_runtime_diagnosis.py --bucket test-agentceping --scope lifecycle --object logs/2026/07/a.log --days-since-created 35 --region cn-hangzhou
Relay the fetched rule list and the attribution findings (measured: this bucket has no rule at all, so the report says no_rules_configured); output the configuration template as manual guidance, declare the 24-hour loading window, and declare any auto-filled parameters. If STATUS: DEGRADED, relay the recorded errors and NEXT_ACTION honestly.
Example 2 - archive file cannot download (InvalidObjectState)
User: "Downloading my archive file fails with InvalidObjectState; the object is ColdArchive. How do I restore it, how long does it take, and does it cost anything?"
python3 scripts/oss_lifecycle_runtime_diagnosis.py --bucket <name> --scope restore --object-class ColdArchive --error InvalidObjectState
Relay the ColdArchive restore tier table (Expedited ~1h / Standard ~2-5h / Bulk ~5-12h), the 1-365 day replica validity window, and the fee composition (retrieval capacity fee + restore request fees); the restore command itself is user-executed guidance only.
Example 3 - storage tiering strategy
User: "I want to tier my bucket's storage to cut cost - any strategy advice?"
python3 scripts/oss_lifecycle_runtime_diagnosis.py --bucket <name> --scope strategy
Relay the tiering ladder advice with minimum-storage-duration and retrieval-fee caveats; emphasize conversion is one-way downward and the restore cost trade-off; never apply any rule.
Example N - An archived object cannot be read right after the rule fired
User: "A lifecycle rule moved my objects to Archive and now every download returns InvalidObjectState."
python3 scripts/oss_lifecycle_runtime_diagnosis.py --bucket "my-bucket" --object "data/archive.tar" --error "InvalidObjectState" --object-class "Archive"
Explain that Archive-class objects must be restored first, quote the restore tier and the retrieval fee basis, and list the rule-match conditions (prefix, tag, version status) that decide whether the rule applied at all.
| Script | Purpose |
|---|---|
scripts/sts_token.py | Verify caller identity via aliyun sts get-caller-identity; derive the UID traceability label (--json optional) |
scripts/oss_lifecycle_runtime_diagnosis.py | Lifecycle runtime entry: GetBucketInfo + GetBucketVersioning + GetBucketLifecycle attribution engine + restore tier/fee routing, with ListBuckets fallback |
CLI options for oss_lifecycle_runtime_diagnosis.py: --bucket <name> (required), --scope lifecycle|restore|strategy|all (default all), --object <key>, --object-class <class>, --error <code>, --days-since-created <N>, --region <region> (all optional).
| Error | Cause | Resolution |
|---|---|---|
| No credentials found | Environment credential chain not configured | Run aliyun configure / configure environment variables; never ask the user for AK/SK |
AccessDenied / 403 | Missing oss:GetBucketInfo / oss:GetBucketLifecycle / oss:GetBucketVersioning, bucket owned by another account, or wrong-region endpoint | Record [WARN], run the ListBuckets fallback, point to references/ram-policies.md; report STATUS: DEGRADED |
NoSuchBucket / 404 | Bucket name does not exist (or the bucket itself was deleted) | Verify spelling and owning account; report STATUS: DEGRADED with NEXT_ACTION |
NoSuchLifecycle / 404 | No lifecycle rule configured on the bucket | NOT an error: report it as the no_rules_configured finding and output the configuration template as guidance |
| Network timeout / connection reset | Transient network failure | Report STATUS: DEGRADED honestly; retry later, never conclude "rule missing" from a failed call |
InternalError / 5xx / SlowDown | Transient service-side failure or request throttling | Retried automatically inside scripts/_oss_client.py (2 extra attempts, 1s then 3s, each traced as [WARN] on stderr); if the call still fails the report carries STATUS: DEGRADED. Do not re-run the script in a loop and never conclude "no problem" from a failed call |
| Doc lookup module | scripts/_doc_lookup.py | Runtime official-doc verification against the OSS help center (llms-index); used by the --question path |
All errors follow the structured category/code/message/hint shape recorded in the report's errors array; every degraded step logs [WARN] on stderr, and the report is always emitted with whatever data succeeded.
The final answer to the user MUST:
STATUS: (OK / DEGRADED) and NEXT_ACTION: line verbatim in meaning.DEGRADED, list the recorded errors and limitations explicitly instead of inventing conclusions.doc_verification, cite the doc titles and URLs from doc_verification.docs in the final answer; when doc_verification.note starts with DEGRADED, state explicitly: "Unable to verify against online official docs (offline)."