cdp_repair_action
Self-repair an L3 reusable action whose Maestro replay failed with SELECTOR_NOT_FOUND. Loads the action from .rn-agent/actions/<actionId>.yaml, snapshots the live device, fuzzy-matches the failed testID against current testIDs (Levenshtein-based), and patches the YAML in place. Guardrails: refuses if a human edited the YAML since the agent last wrote (mtime check), refuses if the rolling-24h repair budget is exhausted (3 attempts/24h). On success, bumps revision, demotes status to “experimental” until the next clean replay re-validates, and appends a RepairRecord to the sidecar. Pass dryRun=true to preview the diff without writing.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
actionId | string | Yes | Action id matching <projectRoot>/.rn-agent/actions/<actionId>.yaml. | ||
failedSelector | string | Yes | The testID that the prior maestro_run reported as missing. Parse it from stderr like “Element with id ‘X’ not found” → X. | ||
projectRoot | string | No | Override project root (default: process.cwd()). | ||
threshold | number | No | min: 0, max: 1 | Fuzzy-match similarity threshold (0..1). Default 0.6. Lower if the screen has many similar testIDs and Levenshtein on the original is too strict. | |
dryRun | boolean | No | Don’t write changes — return the diff that WOULD be applied. Useful for previewing repairs before committing. | ||
agentReasoning | string | No | Free-form one-liner the agent records in the RepairRecord. Helps audit “why did this repair happen”. Max ~200 chars recommended. |
cdp_repair_action(actionId: <string>, failedSelector: <string>)