Skip to content

fix: let owners ask the agent to maintain its own gateway - #182762

Merged
fuller-stack-dev merged 3 commits into
mainfrom
fix/owner-gateway-maintenance
Oct 24, 2026
Merged

fuller-stack-dev merged 3 commits into
mainfrom
fix/owner-gateway-maintenance

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

An agent refuses an owner's request to maintain its own Gateway because the prompt forbids self-maintenance and the tool lacks restart and cleanup actions.

User Impact

Owners can ask the agent to update, safely restart, or clean up eligible update recovery copies. The agent uses runtime-owned actions instead of sending the owner to slash commands or a terminal. Cleanup runs while the Gateway remains available and permanently removes only eligible rollback copies; a preview is available.

Non-owner requests, explicit tool restrictions, current owner revocation, and chat restart policy remain enforced. No live deployment is part of this change.

Why This Change Was Made

  • Replace the blanket prompt prohibition with supervised-maintenance guidance and expose restart and update.cleanup alongside update.run, including limited profiles without configuration reads.
  • Reuse the existing safe restart coordinator and fix: automatically retire old recovery copies after successful updates #181033's owner-bound cleanup worker/admin RPC. Explicit cleanup uses the existing manual verification and eligibility checks, without inventing an update run or stopping the Gateway.
  • Keep maintenance bound to the hosting Gateway and trusted caller. Revalidate authority before effects; reject a mixed automatic-run/preview request instead of silently ignoring dryRun.
  • Regenerate protocol validators and prompt snapshots. The large generated predicate diff is mechanical renumbering, not a new policy layer.

Evidence

  • Regression cases failed on the base because restart/cleanup were unavailable.
  • 242 passing focused cases across 11 files on exact head f009dd878a0ebd1921fe21115b049c058339a32e, plus 30 unaffected sibling cases from earlier runs: prompt/config and tool-profile contracts, owner update admission, real restart scheduling/deferral, owner revocation and disabled chat restarts, automatic-cleanup siblings, and real serving-Gateway cleanup.
  • The cleanup integration uses the authenticated dispatcher and real worker/filesystem retirement. It proves preview, eligible old-capture removal, retained current capture, service health, non-admin/wrong-owner/non-owner refusal, and device revocation after one removal preventing subsequent deletion.
  • Full build, production typecheck, four affected test type graphs, targeted lint (13 files), generated-validator/registry checks, prompt snapshot checks, and diff checks pass.
  • Test state/HOME/TMPDIR and the resolved handoff SQLite path were task-private; no live Gateway stop/restart/update or live database change.

Full touched-test audit retained distinct public contracts and replaced the obsolete removed-action test with observable scheduling. The cleanup integration takes about 43 seconds of test time (76 seconds including preparation) because it boots one real Gateway and exercises authenticated revocation plus real worker I/O; the tool behavior tests complete in milliseconds. CI timing will be attached by the normal checks.

The repository's declaration-containment guard rejected the global dependency graph. Only this task's graph was changed to pnpm's supported project layout, retaining the canonical content store and packageImportMethod=auto; no guard was bypassed. Build output includes existing advisory CSS-size warnings. Live model-driven maintenance and a production deployment were not run.

Follow-up review corrections also prove deferred owner/policy revocation, a fixed non-update restart reason, real persisted post-restart notice, handler-level revocation before effects, and manual cleanup stopping after owner revocation. The first independent API review identified these gaps and stale consumers; they were fixed together. The final independent API-only review is P0–P2 clean on exact head f009dd878a0ebd1921fe21115b049c058339a32e, including test quality. The current-main merge only adopted the upstream pairing fixture; the reviewer verified unchanged production patch IDs. Native scripts/pr review and preparation records are validated; required CI remains its own gate.

Post-merge focused command: 242 passed / 11 files / 4 shards, 227.97 seconds. The real cleanup integration took 58.5 seconds on that run. Post-merge production/gateway type graphs passed; 15,905 internal documentation links checked, zero broken, and all six prompt snapshots are current.

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime security Security documentation agents Agent runtime and tooling size: XL labels Oct 24, 2026
@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Oct 24, 2026
@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review October 24, 2026 18:28
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR adds owner-requested restart and recovery cleanup actions to the Gateway tool using existing lifecycle and retirement owners.

Example: An owner asks, “Preview cleanup of old update recovery copies.”

  • Before: The Gateway tool exposes update.run but has no cleanup action.
  • After: The agent can call update.cleanup with dryRun=true while the Gateway keeps serving.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Coherent implementation with meaningful authority coverage, bounded by missing qualification of existing recovery data through the new path.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Owners cannot request direct Gateway-tool restarts or serving-Gateway recovery cleanup from the agent.
Reason: Maintainer authorship establishes direction, and the change exposes existing supervised operations without a new setting or competing lifecycle owner.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: the maintainer-approved maintenance capability is useful, and inspection found no actionable code defect.

Priority: P2
Reviewed head: f009dd878a0ebd1921fe21115b049c058339a32e

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply a fresh-install and v2026.10.7-to-candidate run exercising explicit cleanup of existing recovery originals while preserving settings, sessions, current rollback material, and Gateway health.
Agent review details

How this fits together

The agent-facing Gateway tool translates trusted owner or scheduled requests into local Gateway handlers, which coordinate restart signals or worker-owned recovery retirement.

flowchart TD
  A[Owner or operator schedule] --> B[Gateway agent tool]
  B --> C[Local Gateway dispatcher]
  C --> D[Restart coordinator]
  C --> E[Recovery cleanup worker]
  D --> F[Restart signal and session notice]
  E --> G[Existing retirement owner]
Loading

Technical review

Best possible solution:

Keep maintenance in the existing lifecycle and retirement owners, preserving live authorization and existing recovery eligibility.

Do we have a high-confidence way to reproduce the issue?

Current-main schemas establish that direct restart and cleanup actions are absent; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The smallest complete implementation extends the existing tool and delegates scheduling, authorization, eligibility, and deletion to their established owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9198552c7a50.

Provenance checked

  • Regular-agent restart access changes intended behavior with a stated reason (a97bdfb: Restarts were deliberately moved to approved delegation alongside removal of regular-agent configuration writes.)
  • Control-prompt guidance keeps the original intent (fcf2884: Guidance was extracted to avoid recommending disabled chat commands; the capability-sensitive command checks remain.)
  • Serving recovery retirement keeps the original intent (fb9e117: Automatic cleanup reused the retirement owner through a worker with live physical-owner and requester checks.)
  • Generated protocol validation keeps the original intent (f52fb07: Fixed-schema predicates were generated ahead of runtime; this PR changes the canonical cleanup schema and corresponding predicate.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +219, Tests +307, Docs +17. Total +543 across 31 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 10 3101 2882 +219
Tests 14 353 46 +307
Docs 7 44 27 +17
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 31 3498 2955 +543

Review metrics

Metric Value Why it matters
Agent maintenance surface Two added actions and one optional dryRun argument; no new configuration option. Limited profiles gain restart and explicit cleanup without gaining configuration reads.

Labels

Label changes:

  • add P2: Owner maintenance gains a supported agent path, with existing delegation and manual administration available.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: Owner maintenance gains a supported agent path, with existing delegation and manual administration available.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the fresh-install and latest-stable upgrade scenarios identified in the compatibility assessment, with sensitive values redacted.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 24, 2026, 2:51 PM ET / 18:51 UTC.

@fuller-stack-dev
fuller-stack-dev merged commit 8a669b4 into main Oct 24, 2026
222 of 223 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/owner-gateway-maintenance branch October 24, 2026 18:56
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security Security documentation size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant