Skip to content

fix(ci): restore managed gateway update test isolation - #129852

Merged
steipete merged 1 commit into
mainfrom
codex/main-update-cli-ci-fix-mt9k07jf
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/main-update-cli-ci-fix-mt9k07jf

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where current main CI fails dozens of managed-gateway update and restart assertions in src/cli/update-cli.test.ts, blocking unrelated pull requests from landing.

The affected main run is https://github.com/openclaw/openclaw/actions/runs/32922605020, job checks-node-compact-small-6 (job 98039417864). Its first failures include stopping a running managed Git gateway, restarting an updated managed service, resolving the updated entrypoint, and preserving the managed service Node and installation prefix.

Why This Change Was Made

The updater test fixture did not isolate the complete set of gateway service-selector environment variables between cases, and its mocked service commands did not represent the effective-command plus managed-definition ownership contract introduced for systemd drop-ins. Capture and restore the canonical selector set, clear it before each test, and construct service fixtures through one helper that carries the managed definition. This repairs the test-boundary ownership contract without changing production behavior or weakening assertions.

This cherry-picks the existing focused fix 378ae5db8551f942d2726ce2911c4c55538ad59f from #128257 while preserving its original commit author, roboclaw-bot <[email protected]>. The unrelated changes from that pull request are deliberately excluded.

User Impact

No user-visible or production behavior changes. Maintainers regain reliable main CI coverage for managed gateway update, restart, package-entrypoint, and service-ownership behavior.

Evidence

@clawsweeper

clawsweeper Bot commented Aug 26, 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 cli CLI command changes size: S maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 04:07
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 12:13 AM ET / 04:13 UTC.

ClawSweeper review

What this changes

The PR resets managed-gateway selector environment variables between updater CLI tests and models mocked owned services with their managed definition.

Regression provenance

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

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this active maintainer-labeled PR open. The focused test fixture repair matches the current managed-service selector and definition contracts; no patch defect was found, but the branch is behind main and exact-head CI is still in progress.

Priority: P2
Reviewed head: ce8fd74b9d0906e83ab10af04d962d78ba2fd2be

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The narrow fixture repair follows the current managed-service contracts and has focused reported validation, with only normal rebase and exact-head CI follow-through remaining.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This maintainer-associated, test-only PR is exempt from the external-contributor proof gate; its body nevertheless reports focused terminal validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-associated, test-only PR is exempt from the external-contributor proof gate; its body nevertheless reports focused terminal validation.
Evidence reviewed 7 items Canonical selector contract: The production selector list contains state directory, config path, profile, port, and platform service selectors; the test now captures and clears that same canonical list rather than maintaining a partial local copy.
Managed-definition ownership contract: Production resolves the managed definition when present and uses it to distinguish effective service state from the rewriteable managed base; the shared test helper now provides an equal managed definition for owned-service fixtures.
Updater caller: The update service passes the managed definition environment into the post-update path, so fixtures without that field no longer represented the current ownership shape.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/cli/update-cli.test.ts

Result: FAIL (partial) — step 2 expect_output 1 file passed: expected terminal output was not visible within 30 seconds: "1 file passed"

[test] starting test/vitest/vitest.cli.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129852-SyQTcy/target

 ✓  cli  src/cli/update-cli.test.ts (247 tests) 3872ms
     ✓ reads the initial update config without schema validation or observation  413ms

 Test Files  1 passed (1)
      Tests  247 passed (247)
   Start at  04:14:10
   Duration  11.03s (transform 5.73s, setup 919ms, import 5.90s, tests 3.87s, environment 0ms)

[test] passed 1 Vitest shard in 16.55s
[test] starting test/vitest/vitest.cli.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129852-SyQTcy/target

 ✓  cli  src/cli/update-cli.test.ts (247 tests) 4887ms
     ✓ reads the initial update config without schema validation or observation  911ms
     ✓ keeps forced post-core fallback and fresh validation in the stopped service profile  551ms

 Test Files  1 passed (1)
      Tests  247 passed (247)
   Start at  04:14:27
   Duration  8.15s (transform 1.82s, setup 421ms, import 2.63s, tests 4.89s, environment 0ms)

[test] passed 1 Vitest shard in 13.60s

Assertions:

  • FAIL expect_output: 1 file passed

How this fits together

Managed gateway updates inspect a service’s effective command and managed definition to preserve the correct installation, profile, and environment through stop, update, and restart. The updater test suite supplies those service inputs and verifies the resulting update behavior.

flowchart LR
  A[Updater CLI tests] --> B[Service selector environment]
  B --> C[Mock managed service definition]
  C --> D[Update and restart flow]
  D --> E[Ownership and profile assertions]
  E --> F[CI coverage]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind main and several exact-head checks remain in progress; refresh against current main and require the focused updater test gate to pass before merge.
  • Complete next step (P2) - This protected, active maintainer-associated PR needs normal rebase and exact-head CI handling rather than a repair-lane dispatch.
Agent review details

Security

None.

PR surface

Tests +2. Total +2 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 31 29 +2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 31 29 +2

Review metrics

Metric Value Why it matters
Production versus test delta production +0/-0; tests +31/-29 The patch is confined to one existing updater test fixture, limiting behavior impact to CI coverage fidelity.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Rebase or refresh the branch onto current main, retain the canonical selector cleanup and managed-definition fixture shape, then merge after exact-head CI confirms the updater suite remains isolated.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Rebase or refresh the branch onto current main, retain the canonical selector cleanup and managed-definition fixture shape, then merge after exact-head CI confirms the updater suite remains isolated.

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

Yes, source-reproducible: the old fixture did not reset the complete canonical selector set and did not model the managed definition consumed by the updater ownership path. The PR body also records a failing main CI shard and an after-fix 247-test pass.

Is this the best way to solve the issue?

Yes. Reusing the canonical selector list prevents fixture drift, while a single helper makes owned-service mocks match the production effective-command and managed-definition contract without touching runtime code.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs unreliable managed-gateway updater test coverage without changing production behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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-associated, test-only PR is exempt from the external-contributor proof gate; its body nevertheless reports focused terminal validation.

Label justifications:

  • P2: This repairs unreliable managed-gateway updater test coverage without changing production behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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-associated, test-only PR is exempt from the external-contributor proof gate; its body nevertheless reports focused terminal validation.

Evidence

What I checked:

  • Canonical selector contract: The production selector list contains state directory, config path, profile, port, and platform service selectors; the test now captures and clears that same canonical list rather than maintaining a partial local copy. (src/daemon/constants.ts:11, ce8fd74b9d09)
  • Managed-definition ownership contract: Production resolves the managed definition when present and uses it to distinguish effective service state from the rewriteable managed base; the shared test helper now provides an equal managed definition for owned-service fixtures. (src/daemon/service-types.ts:114, ce8fd74b9d09)
  • Updater caller: The update service passes the managed definition environment into the post-update path, so fixtures without that field no longer represented the current ownership shape. (src/cli/update-cli/update-command-service.ts:570, ce8fd74b9d09)
  • Focused fixture repair: The helper now returns matching effective and managed definitions, and beforeEach clears every canonical selector key before each scenario. (src/cli/update-cli.test.ts:647, ce8fd74b9d09)
  • Sibling coverage: Post-update tests already exercise effective-versus-managed environments and systemd tests assert managedDefinition output, supporting the fixture shape used here. (src/cli/update-cli/update-command-post-update.test.ts:317, ce8fd74b9d09)
  • History and release status: Blame attributes the changed fixture lines to the proposed commit; no checked-out tag contains that commit, consistent with GitHub context that this PR is open and unmerged. (src/cli/update-cli.test.ts:647, ce8fd74b9d09)

Likely related people:

  • roboclaw-bot: Git blame attributes the selector capture, managed-definition helper, and test cleanup lines to the proposed fixture commit. (role: introduced the current test-fixture shape; confidence: high; commits: ce8fd74b9d09; files: src/cli/update-cli.test.ts)
  • steipete: The PR author committed the focused current fixture change; current local history is shallow beyond this commit. (role: recent area contributor and commit committer; confidence: medium; commits: ce8fd74b9d09; files: src/cli/update-cli.test.ts)

Rank-up moves

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

  • Refresh the branch against current main and let the exact-head updater checks complete green.

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.

@steipete
steipete merged commit 647414e into main Aug 26, 2026
179 checks passed
@steipete
steipete deleted the codex/main-update-cli-ci-fix-mt9k07jf branch August 26, 2026 05:17
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

cli CLI command changes maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

2 participants