Skip to content

fix(workers): skip shared-host quiescence sweeps - #120969

Merged
steipete merged 9 commits into
mainfrom
steipete/cloud-quiescence-shared-host
Aug 9, 2026
Merged

steipete merged 9 commits into
mainfrom
steipete/cloud-quiescence-shared-host

Conversation

@steipete

@steipete steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Workspace quiescence froze every process owned by the worker SSH uid. That is correct for dedicated cloud workers, but the QA Lab static-ssh provider explicitly targets shared development hosts. There the sweep could stop unrelated developer processes and never converge, preventing the cloud turn's workspace result from being applied. This addresses #120952.

Why This Change Was Made

Worker leases can now declare sharedHost: true, and core validates and persists that provider-owned isolation fact through the durable environment record and tunnel workspace actions. The static-ssh provider sets the flag.

By workspace reconciliation time the remote worker runtime has already exited, so there is no stable runtime PID whose descendants can be scoped honestly. Shared-host quiescence therefore skips both the initial and renewal freeze sweeps while retaining the watchdog lease, orphan recovery, renewal, resume cleanup, and workspace manifest/finalization fences. Dedicated workers keep the existing uid-wide sweep unchanged.

This tradeoff can miss double-forked strays or late writers. It is accepted only when a provider explicitly declares that the host is shared and not owned by the worker lease; the remote quiescence command logs when it takes this path.

User Impact

Cloud turns using QA Lab static-ssh workers can reconcile workspace results without freezing unrelated same-uid processes on the development host. Existing worker providers and dedicated hosts retain their current behavior because absent or false sharedHost values use the uid-wide process sweep.

Evidence

  • node scripts/run-vitest.mjs src/gateway/worker-environments/ extensions/qa-lab/src/static-ssh-worker-provider.test.ts
    • Gateway: 42 files, 532 tests passed.
    • QA Lab: 1 file, 25 tests passed.
  • node scripts/run-oxlint.mjs <touched TypeScript files> passed.
  • pnpm plugin-sdk:surface:check passed without baseline changes.
  • pnpm plugin-sdk:api:check passed.
  • pnpm db:kysely:check passed.
  • pnpm docs:list completed.
  • pnpm docs:check-mdx passed for 769 files.
  • Targeted oxfmt --check passed for all touched files.
  • git diff --check passed.
  • Autoreview reported no accepted or actionable findings.

@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime extensions: qa-lab labels Aug 9, 2026
@steipete
steipete marked this pull request as ready for review August 9, 2026 07:00
@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 9, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 9, 2026
@clawsweeper

clawsweeper Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 4:47 AM ET / 08:47 UTC.

ClawSweeper review

What this changes

This PR records a worker provider’s shared-host isolation fact and uses it to skip uid-wide process freeze sweeps for QA Lab static-SSH workspace reconciliation.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep this PR open: the current head resolves the prior legacy-lease blocker and remains the needed fix for the open shared-host quiescence issue; it now needs normal exact-head CI completion before merge.

Priority: P1
Reviewed head: 4e8127932899246bfcc4e0e0ef1844816a7a55f6

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The current head addresses the earlier P1 with an upgrade-safe owner-boundary repair and focused regression coverage.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its source includes direct child-process boundary coverage, though this read-only review did not execute it.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its source includes direct child-process boundary coverage, though this read-only review did not execute it.
Evidence reviewed 5 items Prior finding fixed: The current head inspects persisted active leases, reconciles the provider-authoritative shared-host fact, and refuses tunnel startup while that fact remains unknown.
Upgrade regression coverage: The test starts from a legacy NULL isolation value, fences startup on failed inspection, then permits a shared-host tunnel only after authoritative reconciliation.
Current main remains affected: Current main still runs the unconditional same-UID quiescence sweep, so the PR is not redundant or released.
Findings None None.
Security None None.

How this fits together

QA Lab worker providers supply SSH lease facts to the gateway, which persists them and starts a tunnel for workspace reconciliation. The tunnel selects dedicated or shared-host quiescence behavior before applying the remote workspace result.

flowchart LR
  A[Static SSH worker provider] --> B[Worker lease isolation fact]
  B --> C[Gateway environment storage]
  C --> D[Provider inspection on upgrade]
  D --> E{Isolation known?}
  E -->|Dedicated| F[Freeze worker UID processes]
  E -->|Shared host| G[Skip process sweep]
  F --> H[Reconcile workspace result]
  G --> H
Loading

Before merge

  • Resolve merge risk (P1) - Existing legacy leases now intentionally fail closed until their provider inspection authoritatively supplies the isolation fact; a provider that cannot do so will block tunnel startup rather than risk a uid-wide sweep.
Agent review details

Security

None.

PR surface

Source +102, Tests +146, Docs 0, Generated +1. Total +249 across 23 files.

View PR surface stats
Area Files Added Removed Net
Source 14 115 13 +102
Tests 6 168 22 +146
Docs 2 2 2 0
Config 0 0 0 0
Generated 1 1 0 +1
Other 0 0 0 0
Total 23 286 37 +249

Review metrics

Metric Value Why it matters
Production versus test LOC production +105/-12; tests +179/-23 The production growth establishes a provider-owned persistence and lifecycle boundary; focused regressions cover fresh, legacy, initial, and renewal paths.
Worker-provider contract 1 optional isolation field added to provision and active-inspection results Existing providers default to dedicated behavior, while persisted legacy leases require authoritative inspection before tunnel startup.

Stored data model

Persistent data-model change detected: durable storage schema: src/gateway/worker-environments/placement-dispatch-test-fixtures.ts, durable storage schema: src/gateway/worker-environments/service-validation.ts, durable storage schema: src/gateway/worker-environments/service.test.ts, durable storage schema: src/gateway/worker-environments/service.ts, durable storage schema: src/gateway/worker-environments/store.test.ts, durable storage schema: src/gateway/worker-environments/store.ts, and 13 more. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Merge-risk options

Maintainer options:

  1. Keep the fail-closed upgrade fence (recommended)
    Retain the current requirement that a legacy lease be authoritatively inspected before it may start a tunnel, preventing an unsafe uid-wide sweep.
  2. Pause if legacy providers cannot inspect
    Do not merge if supported provider implementations cannot reliably return an active lease’s isolation fact after upgrade.

Technical review

Best possible solution:

Keep the provider-owned isolation fact, upgrade fence, and dedicated-host default, then merge after the exact head has completed required CI.

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

Yes—current-main source has the unconditional same-UID sweep, and the PR’s focused owner-boundary tests model the shared-host path and pre-upgrade lease sequence.

Is this the best way to solve the issue?

Yes—the provider declares its own host-isolation fact, generic gateway lifecycle code persists and reconciles it, and the remote command consumes it without hardcoding static-SSH policy into core.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 29c442d48389.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its source includes direct child-process boundary coverage, though this read-only review did not execute it.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The affected static-SSH workflow can freeze unrelated same-UID processes and prevent workspace reconciliation.
  • merge-risk: 🚨 compatibility: The PR extends the worker-provider lease contract and changes how pre-upgrade persisted leases become eligible for tunnel startup.
  • merge-risk: 🚨 availability: An unavailable or malformed provider inspection intentionally prevents a legacy worker tunnel from starting.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its source includes direct child-process boundary coverage, though this read-only review did not execute it.

Evidence

What I checked:

Likely related people:

  • steipete: Authored this PR’s four commits and the nearby cloud-worker, static-SSH, quiescence, and reconciliation history. (role: feature owner and recent area contributor; confidence: high; commits: 90e4658, e681646, 3bfe82180e1d; files: src/gateway/worker-environments/service.ts, src/gateway/worker-environments/workspace-quiescence-scripts.ts, extensions/qa-lab/src/static-ssh-worker-provider.ts)

Rank-up moves

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

  • Complete and resolve exact-head required CI before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-09T07:43:48.917Z sha 8b3a7e8 :: found issues before merge. :: [P1] Migrate existing shared-host leases

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 9, 2026
@steipete
steipete force-pushed the steipete/cloud-quiescence-shared-host branch 5 times, most recently from 333465a to 3e75cb7 Compare August 9, 2026 11:01
@steipete
steipete force-pushed the steipete/cloud-quiescence-shared-host branch from 3e75cb7 to da5cc0d Compare August 9, 2026 11:04
… module

workspace-sync.ts crossed the 700-line lint budget by one; drop its
re-export and point consumers at workspace-sync-helpers directly.
@steipete
steipete merged commit b869d5e into main Aug 9, 2026
120 checks passed
@steipete
steipete deleted the steipete/cloud-quiescence-shared-host branch August 9, 2026 11:34
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 10, 2026
* fix(workers): skip shared-host quiescence sweeps

Refs openclaw#120952.

* test(workers): update shared-host fixtures

Refs openclaw#120952.

* fix(workers): reconcile shared-host lease metadata

* fix(workers): fence unknown lease isolation

* chore(plugin-sdk): refresh API baseline

* fix(workers): fence tunnel isolation updates

* docs(workers): clarify shared-host final fences

* ci: invalidate Vitest cache for state schemas

* refactor(workers): import stableWorkerPathComponent from its defining module

workspace-sync.ts crossed the 700-line lint budget by one; drop its
re-export and point consumers at workspace-sync-helpers directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: qa-lab gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant