Repository navigation
feat(update): repair installations with configured inference - #138673
Conversation
Share installation repair between triage --run and the unattended updater entry point. Select the system-agent owner's authenticated primary and fallback models before other configured agents, and require tool support. Run isolated native embedded turns with local exec, source-level tool budgets, cancellation and process cleanup. Validate before and after turns; stop on success, regression, no improvement or exhausted budgets. Keep activation, service lifecycle, snapshots and rollback with the orchestrator. Preserve triage's interactive terminal requirement and external handoffs. Validation: focused repair, route, agent-exec, triage and target-isolation tests; a real embedded turn against a localhost synthetic provider executed one host command and returned a parsed REPAIR_RESULT after oracle validation. Full build passed without ineffective dynamic-import warnings. Document the repair scope, default budgets and structured result contract. Integration follow-up: Knip reports the unattended entry point and exported event/validation types as unused until the updater worker consumes them. Updater phase-ordering files are intentionally outside this worker's scope. (cherry picked from commit edc432e6492d25db54823214ee96b41eee3024a3)
Adapt the repair probe to its current owner and auth-preference API. Expand logical model references before selecting native execution so a CLI alias cannot skip the operator's primary model, and retain configured auth rotation. Redact complete repair summaries before enforcing their byte budget. Remove the unused unattended wrapper and duplicate test, narrow exported interfaces to current consumers, and share the temporary tool policy. Keep triage documentation scoped to the integration provided by this PR. Cover logical primary/fallback ordering with the real route resolver, auth rotation at the repair execution boundary, and truncated credential redaction. Related to #124396 and #137580; updater activation integration follows separately.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 6:37 PM ET / 22:37 UTC. ClawSweeper reviewWhat this changesThe PR adds a bounded, Doctor-validated embedded repair loop for Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 6 items remain Keep open. This changes an existing explicit Priority: P1 Review scores
Verification
How this fits togetherTriage gathers diagnostics for a selected OpenClaw installation and can invoke an embedded repair agent. The new loop chooses an authenticated model route, runs a bounded repair against that installation, then uses Doctor lint to determine the outcome. flowchart LR
A[Selected installation] --> B[Doctor lint]
B --> C{Errors found?}
C -->|No| D[Successful triage]
C -->|Yes| E[Configured inference route]
E --> F[Bounded repair agent]
F --> G[Doctor validation]
G --> H[Reported repair outcome]
Decision needed
Why: The PR intentionally changes an established safety contract; choosing between preserving the setting and introducing an elevated mode is product and security policy, not a mechanical repair decision. Before merge
Findings
Agent review detailsSecurityNeeds attention: The diff creates a new no-approval, unrestricted-filesystem host-command path that overrides an operator's saved safety policy. PR surfaceSource +1013, Tests +1227, Docs +22. Total +2262 across 18 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve the operator's configured approval and filesystem boundary for embedded repair, or introduce a separately confirmed, maintainer-approved elevated repair mode with focused upgrade and final-effect coverage. Do we have a high-confidence way to reproduce the issue? Yes, from source: configure an agent with an exec approval or workspace-only policy, invoke embedded repair, and the new repair snapshot clears those restrictions before the agent run. Is this the best way to solve the issue? No. The bounded loop is a coherent repair owner, but silently discarding the configured execution policy conflicts with the prior triage contract; preserve it or make elevation separately explicit. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4b9954e37d70. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Honor explicit exec and repair-tool denies before starting an embedded repair. Keep operator-authorized runs prompt-free with installation/candidate workspace containment, preserving safe bins and layered tool restrictions. Apply the same gate to fallback models before giving them host execution. Explain policy refusals and external triage handoff in the CLI and docs. Cover policy, target, and fallback boundaries plus real host execution and a blocked filesystem escape through the localhost-provider smoke. Addresses the maintainer policy decision in PR #138673. Update activation and unattended integration remain with the caller in the follow-up campaign work.
|
Follow-up to the execution-policy finding and Rank-up moves: the maintainer decision is implemented in df31959f1d9.
Both Rank-up moves are addressed by the explicit maintainer decision and boundary regressions. Thirteen policy/scope cases failed on the prior head. Autoreview then found the fallback gap; two regressions reproduced it before correction. The final nine-file selection passed 153 tests, including both root choices, safe-bin/auth preservation, and denied provider/model fallbacks. The strengthened localhost-provider smoke also passed: ask-mode host exec created the target marker while a filesystem write outside the workspace was blocked (154 tests across 10 files total). Full build passed with zero ineffective dynamic-import warnings. Fresh full-candidate Codex autoreview is P1-clean. The full The data-model compatibility flag does not apply: this change adds no schema, migration, projection, retention, or storage representation; the existing ephemeral-run owner is reused. The correction adds 49 net production lines for the policy gate and refusal result; the full PR remains the new bounded-repair capability. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…w#138673) * feat(update): add a bounded embedded installation repair loop Share installation repair between triage --run and the unattended updater entry point. Select the system-agent owner's authenticated primary and fallback models before other configured agents, and require tool support. Run isolated native embedded turns with local exec, source-level tool budgets, cancellation and process cleanup. Validate before and after turns; stop on success, regression, no improvement or exhausted budgets. Keep activation, service lifecycle, snapshots and rollback with the orchestrator. Preserve triage's interactive terminal requirement and external handoffs. Validation: focused repair, route, agent-exec, triage and target-isolation tests; a real embedded turn against a localhost synthetic provider executed one host command and returned a parsed REPAIR_RESULT after oracle validation. Full build passed without ineffective dynamic-import warnings. Document the repair scope, default budgets and structured result contract. Integration follow-up: Knip reports the unattended entry point and exported event/validation types as unused until the updater worker consumes them. Updater phase-ordering files are intentionally outside this worker's scope. (cherry picked from commit edc432e6492d25db54823214ee96b41eee3024a3) * fix(update): preserve configured repair routing and bounded diagnostics Adapt the repair probe to its current owner and auth-preference API. Expand logical model references before selecting native execution so a CLI alias cannot skip the operator's primary model, and retain configured auth rotation. Redact complete repair summaries before enforcing their byte budget. Remove the unused unattended wrapper and duplicate test, narrow exported interfaces to current consumers, and share the temporary tool policy. Keep triage documentation scoped to the integration provided by this PR. Cover logical primary/fallback ordering with the real route resolver, auth rotation at the repair execution boundary, and truncated credential redaction. Related to openclaw#124396 and openclaw#137580; updater activation integration follows separately. * fix(update): respect repair execution boundaries Honor explicit exec and repair-tool denies before starting an embedded repair. Keep operator-authorized runs prompt-free with installation/candidate workspace containment, preserving safe bins and layered tool restrictions. Apply the same gate to fallback models before giving them host execution. Explain policy refusals and external triage handoff in the CLI and docs. Cover policy, target, and fallback boundaries plus real host execution and a blocked filesystem escape through the localhost-provider smoke. Addresses the maintainer policy decision in PR openclaw#138673. Update activation and unattended integration remain with the caller in the follow-up campaign work.
What Problem This Solves
Installation repair needs a bounded execution path that uses the operator's configured inference and checks whether the target actually improved. Previously, embedded
triage --runran an agent turn without a tool-call budget or a post-repair validation result.Related: #124396 (transactional update validation and recovery) and #137580 (extended Gateway downtime during update finalization). This is the repair-loop slice of that work; unattended updater integration follows separately.
Why This Change Was Made
Share one repair loop with caller-owned validation, cancellation, time limits, tool-call limits, progress events, and structured outcomes. It tries the system-agent owner's primary and configured fallback models before other agents' authenticated routes. A fresh isolated native turn runs against the captured installation; host-side admission counts tool calls after approval checks and drains owned processes before removing temporary state. The validation oracle determines success and stops the loop on regression or lack of improvement.
The recut also adapts the moved inference probe and current auth-preference API, preserves primary-model precedence when a CLI runtime alias differs from the model provider, preserves configured auth rotation, and redacts complete summaries before truncating them. Removed the no-op unattended wrapper and duplicate wrapper test, narrowed exports to current consumers, and shared repeated tool-policy construction. Activation, service lifecycle, snapshots, and rollback remain with the caller.
User Impact
openclaw triage --runstill requires an interactive terminal and now allows one repair turn, with a ten-minute overall limit, five-minute turn limit, and 40 tool calls. Doctor lint runs before and after repair; a clean initial check returns without inference. Incomplete repairs return nonzero even if the model claims success. External coding-agent handoffs retain their existing behavior.The operator-owned update or explicit
triage --runrequest permits prompt-free host exec in a temporary configuration. Explicit exec or repair-tool denies returnunavailablewithexec-denied-by-policybefore the repair agent runs; the CLI explains the policy and points toopenclaw triagefor an external handoff. The workspace is pinned to the installation or staged candidate root, filesystem tools enforceworkspaceOnly: true, and safe-bin, allow/deny, and provider policies are preserved while capabilities are capped toexec,process,read,write,edit, andapply_patch. Every fallback model must pass the same repair-tool gate before execution. Configured sandbox and non-gateway execution remain refused.Host commands follow the repair prompt's root-only scope; filesystem containment is not an OS sandbox for shell commands. The prompt preserves credentials and state and forbids service lifecycle changes. The saved config is not edited, and there are no new configuration keys, database schemas, or protocol changes. Unattended updater integration follows in PR E.
Evidence
Maintainer decision implemented: ClawSweeper's execution-policy finding identified the old snapshot's policy override. The maintainer approved prompt-free repair for an already operator-owned operation, with three boundaries: never override explicit denies; retain installation/candidate workspace containment and existing policy restrictions; document the contract at the config producer and in the CLI/docs. Both Rank-up moves are addressed by that decision and regression proof. The data-model flag does not apply: existing ephemeral-run storage is reused without schema, migration, projection, or retention changes.
Local proof on the corrected candidate:
pnpm buildpassed in 10m 18.6s, including all 90 plugins, 152 public SDK subpaths, UI size gates, and 53 native module-load checks, with zero ineffective dynamic-import warnings. The strengthened localhost-provider smoke passed against that build: an ask-mode repair executed a real host command in the target and an attempted filesystem write outside the workspace was blocked. Total: 154 tests across 10 files. The fullpnpm check:changedplan passed, including core/test types, lint, all three zero-unused-export scans, storage/import guards, and authorization guards.Regression evidence: real route resolution tried
fixture/backupbefore a healthy configured primary on the pre-fix code; the corrected code preserves primary/fallback order. The auth-order regression failed before removal of the temporary override and passed afterward. The summary regression exposed a synthetic credential suffix before redaction-before-truncation and passed afterward.Production LOC: +1,124/−62 (net +1,062); tests: +1,623/−248 (net +1,375); docs: +28/−3. The policy correction adds 49 net production lines for canonical policy preflight, permitted fallback selection, and an explicit refusal result, while removing the policy-clearing path. Remaining branch growth implements the new reusable bounded repair capability.
Campaign-branch evidence (not rerun on this recut): AWS run 9 on source
8a4db45aff48f6fc7b44add16e5756505450e26f, September 4, 2026, passed 90/90 assertions.already-currentglobal-install-failedruntime-verification-failed; one failed repair attemptrestart-unhealthy; 32.369 seconds downtimeThe B-relevant canary run,
8b94b8ab-92d0-47ce-9ca3-f9c2bf73b627, recorded one 13.891-second failed repair attempt with a synthetic provider. The serving Gateway stayed healthy with unchanged PID, invocation, and start timestamp. This proves the campaign integration invokes repair and preserves failure without restarting the healthy Gateway; it does not prove successful repair or real-provider repair quality.