Skip to content

refactor(infra): simplify update campaign cleanup ownership - #146555

Merged
steipete merged 1 commit into
mainfrom
codex/update-campaign-reset-owner9
Sep 14, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/update-campaign-reset-owner9

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Related: #138398

What Problem This Solves

Update-campaign lifecycle cleanup needs one clear, auditable owner.

User Impact

User impact: no intended user-visible change; this is internal maintenance, not a reported update failure. Automatic-update countdown, hold, cancellation, and pending-work cleanup remain unchanged. No configuration, dependency, schema, or RPC change is introduced by this patch.

Why This Change Was Made

Remove duplicate reset plumbing while preserving cleanup order and the lifecycle owner's responsibility for pending work. The startup test-reset API stays in place. Production is +5/-14, net -9 lines, with no shipping test changes.

Evidence

The refreshed head passed 177 macOS cases and the original 125-file Linux group: 3,067 cases, including the previously timed-out lifetime test. Fresh exact-commit review returned no findings at the P0-only threshold. The current changed-check command passed 29 local checks after automatic fallback; its remote command verdict remains unknown, not a clean remote pass. New-head hosted CI is pending.

No real package update, updater-service handoff, or Gateway restart was exercised; this patch preserves the existing reset sequence rather than changing those workflows.

Detailed proof, refresh reason and retained limits

The lifecycle stop and campaign clear() remain the cleanup owner. This removes the redundant campaign test-reset method and inlines its now-single-use private helper, preserving timer cancellation, state-reset ordering and synchronous observer notification. Pending update work is still joined by the lifecycle owner. The earlier constructor cleanup in #138398 is not counted again.

  • Original and candidate owner/Gateway selections each passed 173 cases: startup118, campaign21, update-hold4 and update-run-campaign30. Temporary three-row clear/timer controls and a startup-reset control passed on both versions. Deliberately omitted cancellation, premature notification and omitted stopping failed their intended state/timer observations. Each filtered startup control retained118 skipped existing cases, not passing credit.
  • The earlier PR CI timed out in lifetime profile authorization. This refresh mechanically rebases the unchanged two-file patch onto relevant upstream lifetime-test and Vitest mock-resolution fixes. Both complete owned preimages and afterimages remain identical; no causal claim about a single upstream fix is made.
  • Current-head macOS proof passed the same173 cases plus all four lifetime rows. The separate Linux proof passed106 gateway-core files/2,905 cases and19 gateway-client files/162 cases using the original selector group. Native command, wrapper, observer and separate lease stop all returned0; same-call source/runtime/generation closure passed. This was Linux Node24.19 with four available execution CPUs, not exact historical CI machine size, per-worker order, cache or companion-shard contention.
  • The current changed gate reached remote checks but ended with a provider cleanup timeout, then automatically ran all29 checks locally and returned0. Remote success is not inferred. The older gate's cleanup-status TLS failure is also retained. A separate initial metadata call exited9 before tests because Node interpreted inspect as its reserved debugger command; correcting that metadata argument did not replay tests.
  • Earlier precommit and exact-commit reviews covered the unchanged patch. Fresh exact-commit review of the refreshed head completed seven reports with no P0 findings, aggregate confidence0.98. P0-scoped clean is not all-priority correctness or merge approval. These tests and controls do not claim a real updater-service run.

@clawsweeper

clawsweeper Bot commented Sep 12, 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 size: XS maintainer Maintainer-authored PR labels Sep 12, 2026
@steipete
steipete marked this pull request as ready for review September 12, 2026 23:14
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 2:19 AM ET / 06:19 UTC (Revision 3).

ClawSweeper review

What this changes

The PR consolidates automatic-update campaign cleanup in the existing clear operation and removes its redundant test-reset path.

Merge readiness

✅ Ready for maintainer review

Keep open: this remains a distinct, useful cleanup with no actionable correctness findings. The earlier merged constructor cleanup did not implement it, and the maintainer-authored, protected PR is not eligible for automatic closure.

Priority: P3
Reviewed head: 6ed954d4dfa46875db52be3a9499f2aa50df1999

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving cleanup with relevant retained coverage and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal refactor is exempt from external-contributor runtime proof. Reported tests exercise campaign and lifecycle cleanup; they do not establish a real updater-service run, which the body explicitly disclaims.
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 internal refactor is exempt from external-contributor runtime proof. Reported tests exercise campaign and lifecycle cleanup; they do not establish a real updater-service run, which the body explicitly disclaims.
Evidence reviewed 7 items Introduced patch preserves cleanup ordering: The pinned merge-base-to-head diff moves the same five reset statements into clear(), before the existing observer notification, and removes the campaign test-reset method and its sole call.
Lifecycle already owns synchronous cleanup: stop() aborts its controller, synchronously clears the singleton campaign when it owns the current lifecycle, and then joins predecessor and pending work. The retained startup test-reset calls stop() before clearing the lifecycle reference. Both complete production modules were inspected.
Current main and latest release retain the old helper: The campaign module on fetched main still contains resetForTest() and the private reset() helper. The same structure is present in the supplied latest release, v2026.9.4; this cleanup is not already implemented there.
Findings None None.
Security None None.

How this fits together

The Gateway's update scheduler creates campaigns that wait for idle work, count down, and initiate an update. Campaign cleanup cancels its timer and clears process-local state; the scheduler lifecycle separately waits for pending work to finish.

flowchart TD
  A[Update checks] --> B[Campaign controller]
  B --> C[Idle wait and countdown]
  C --> D[Update handoff]
  E[Lifecycle stop or test reset] --> F[Clear timer and campaign state]
  F --> G[Notify schedule observers]
  E --> H[Wait for pending work]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -9. Total -9 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 5 14 -9
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 5 14 -9

Review metrics

None.

Technical review

Best possible solution:

Keep campaign state cleanup in clear() and pending-work settlement in the existing lifecycle owner, preserving notification order and update behavior.

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

Not applicable: this PR reports redundant cleanup plumbing rather than a user-facing defect; source inspection confirms that redundancy.

Is this the best way to solve the issue?

Yes: inlining the single-use helper and relying on the existing lifecycle stop removes duplication without changing the production reset sequence.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8c776697bf3f.

Labels

Label justifications:

  • P3: This is a bounded internal cleanup with no intended user-visible behavior change.
  • 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 internal refactor is exempt from external-contributor runtime proof. Reported tests exercise campaign and lifecycle cleanup; they do not establish a real updater-service run, which the body explicitly disclaims.

Evidence

What I checked:

  • Introduced patch preserves cleanup ordering: The pinned merge-base-to-head diff moves the same five reset statements into clear(), before the existing observer notification, and removes the campaign test-reset method and its sole call. (src/infra/update-campaign.ts:96, 6ed954d4dfa4)
  • Lifecycle already owns synchronous cleanup: stop() aborts its controller, synchronously clears the singleton campaign when it owns the current lifecycle, and then joins predecessor and pending work. The retained startup test-reset calls stop() before clearing the lifecycle reference. Both complete production modules were inspected. (src/infra/update-startup.ts:179, 6ed954d4dfa4)
  • Current main and latest release retain the old helper: The campaign module on fetched main still contains resetForTest() and the private reset() helper. The same structure is present in the supplied latest release, v2026.9.4; this cleanup is not already implemented there. (src/infra/update-campaign.ts:147, 3a9d69db306c)
  • Main-source necessity check: Fetched main retains the separate campaign reset and the extra startup test-reset call, confirming the proposed consolidation remains distinct. (src/infra/update-startup.ts:213, 8c776697bf3f)
  • Retained behavioral coverage: Campaign tests cover clearing state, observer notification, holds, failed applies, and stale completion after replacement. Startup tests retain cancellation and pending-work draining, including preventing a managed handoff after stop. These tests were inspected, not executed in this read-only review. (src/infra/update-startup.test.ts:2274, 6ed954d4dfa4)
  • Related merged work and routing history: The supplied GitHub context verifies refactor(infra): remove update campaign test constructor seam #138398 merged as 578cb8b. It removed constructor injection while explicitly preserving reset behavior. Main history also identifies Peter Steinberger across several campaign changes. Deeper history inspection encountered unavailable objects, so no source-line introduction attribution is claimed. (src/infra/update-campaign.ts, 578cb8b93bce)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (2 earlier review cycles)
  • reviewed 2026-09-12T23:21:27.864Z sha b139ee1 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T17:59:21.064Z sha 6ed954d :: needs maintainer review before merge. :: none

Inline the single-use campaign reset into clear and remove the redundant
test reset call. Keep the startup reset API, synchronous observer ordering,
timer cancellation, and lifecycle-owned joining unchanged.

Production: +5/-14, net -9. No shipping test changes.

Validation: the unchanged owner and Gateway sibling selection passed all
173 cases on both original and candidate. Lifecycle controls passed on both
roles and detected omitted timer cancellation, reordered notification, and
omitted startup stopping.

The configured changed-check command completed its 29-check local fallback
with exit 0 after the remote wrapper hit a cleanup-status TLS timeout.
Remote cleanup exit 1 is retained; no separate remote command success is
claimed. No real updater service or Gateway restart was exercised.
@steipete
steipete force-pushed the codex/update-campaign-reset-owner9 branch from b139ee1 to 6ed954d Compare September 13, 2026 17:51
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete steipete self-assigned this Sep 14, 2026
@steipete
steipete merged commit 069710f into main Sep 14, 2026
185 of 186 checks passed
@steipete
steipete deleted the codex/update-campaign-reset-owner9 branch September 14, 2026 07:53
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to SunnyShu0925/openclaw that referenced this pull request Sep 14, 2026
* commit '069710f909f0a7158777d0fc0bf1eab84e20c699': (45 commits)
  refactor(infra): consolidate update campaign reset ownership (openclaw#146555)
  refactor: simplify Gateway health response parsing (openclaw#147834)
  fix: avoid Gateway stalls when renaming sessions (openclaw#147869)
  refactor(plugins): reuse worker optional-method validation (openclaw#147925)
  refactor(infra): remove unreachable firewall diagnostic fallback (openclaw#147882)
  fix(ui): open attached automations from session hovercards (openclaw#147749)
  refactor(reply): share usage-bar numeric coercion (openclaw#147863)
  fix(doctor): report warnings for keyed agent configs (openclaw#123058)
  perf(plugins): reuse complete registry comparisons (openclaw#147893)
  fix(workboard): await lifecycle sweep completion in tests (openclaw#147950)
  fix: reduce stalls when browsing large session inventories (openclaw#147911)
  refactor(onboard): share custom model definition (openclaw#147915)
  feat(ios): collapse completed chat work above replies (openclaw#148002)
  fix(voice-call): retain state runtime for deferred streams (openclaw#147689)
  test(qa): compare Telegram entities semantically (openclaw#147752)
  fix(plugins): preserve runtime scope for deferred CLI actions (openclaw#147688)
  test(qa): keep Slack progress marker visible (openclaw#147748)
  test(qa): finish channel picker prompts (openclaw#147730)
  test(tui): handle auth restriction prompt (openclaw#147729)
  fix(qa): retain onboarding prompts across redraw bursts (openclaw#147687)
  ...
vincentkoc added a commit that referenced this pull request Sep 14, 2026
* commit 'a08cdc50bc049074ed7ad2db9e18e0ed3f5415ec': (81 commits)
  perf: reuse stateless plugin scope defaults (#148080)
  fix(gateway): flush slow-consumer 1008 close frame before terminating socket (#147707)
  fix: keep model catalogs loading during other session updates (#147878)
  fix: show queued external chat messages and their source (#147848)
  refactor(chat): share math label configuration (#148073)
  perf(ui): trim eager debug overlay icon payload (#147954)
  improve(logbook): sample batch frame metadata in SQLite (#147999)
  fix(ui): dismiss suggested task cards without waiting (#148021)
  fix(maturity): cover governance, interoperability, fleet, and state (#143528)
  chore(ui): restore core lint and startup budget checks (#148010)
  fix: chat startup loads unnecessary session setup text (#147973)
  perf: speed up fresh cloud worker activation (#147945)
  fix: recover PR preparation after committed merge conflicts (#148063)
  test(plugins): isolate ClawHub Docker fixture identity (#148074)
  fix(release): acknowledge ClawHub risk on moving installs (#148041)
  fix: restore context reads for installed official Discord and Slack plugins (#143341)
  fix: identify source capsule filesystem failures (#147778)
  fix(linux): keep Quick Chat widgets bound to their Gateway (#146049)
  refactor(infra): consolidate update campaign reset ownership (#146555)
  refactor: simplify Gateway health response parsing (#147834)
  ...
vincentkoc added a commit to nvtoroy/openclaw that referenced this pull request Sep 15, 2026
* commit '7d485aa2e89af7fdbd09e8ed0489b06d250b07e3':
  test(scripts): check the configurable ClawHub sweep spec
  fix: show queued external chat messages and their source (openclaw#147848)
  refactor(chat): share math label configuration (openclaw#148073)
  perf(ui): trim eager debug overlay icon payload (openclaw#147954)
  improve(logbook): sample batch frame metadata in SQLite (openclaw#147999)
  fix(ui): dismiss suggested task cards without waiting (openclaw#148021)
  fix(maturity): cover governance, interoperability, fleet, and state (openclaw#143528)
  chore(ui): restore core lint and startup budget checks (openclaw#148010)
  fix: chat startup loads unnecessary session setup text (openclaw#147973)
  perf: speed up fresh cloud worker activation (openclaw#147945)
  fix: recover PR preparation after committed merge conflicts (openclaw#148063)
  test(plugins): isolate ClawHub Docker fixture identity (openclaw#148074)
  fix(release): acknowledge ClawHub risk on moving installs (openclaw#148041)
  fix: restore context reads for installed official Discord and Slack plugins (openclaw#143341)
  fix: identify source capsule filesystem failures (openclaw#147778)
  fix(linux): keep Quick Chat widgets bound to their Gateway (openclaw#146049)
  refactor(infra): consolidate update campaign reset ownership (openclaw#146555)
  refactor: simplify Gateway health response parsing (openclaw#147834)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
…w#146555)

Inline the single-use campaign reset into clear and remove the redundant
test reset call. Keep the startup reset API, synchronous observer ordering,
timer cancellation, and lifecycle-owned joining unchanged.

Production: +5/-14, net -9. No shipping test changes.

Validation: the unchanged owner and Gateway sibling selection passed all
173 cases on both original and candidate. Lifecycle controls passed on both
roles and detected omitted timer cancellation, reordered notification, and
omitted startup stopping.

The configured changed-check command completed its 29-check local fallback
with exit 0 after the remote wrapper hit a cleanup-status TLS timeout.
Remote cleanup exit 1 is retained; no separate remote command success is
claimed. No real updater service or Gateway restart was exercised.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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