Skip to content

fix(gateway): converge monitors after config publication - #139509

Merged
steipete merged 2 commits into
mainfrom
codex/130706-extract-publication-main-20260905
Sep 6, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/130706-extract-publication-main-20260905

Conversation

@steipete

@steipete steipete commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Config reload could change persisted heartbeat or Workshop monitors before accepting the new runtime config. If a later row write failed, the Gateway could roll back config/secrets while rows and a retry still represented the rejected candidate.

Publish runtime config and policy before converging monitor rows, remove the internal config-override reconciliation path, and bind each pass/retry to current accepted config. Partial convergence keeps that config authoritative and uses the existing recovery-required outcome. Cron replacement also owns predecessor cleanup after commit: cleanup now runs even when policy publication fails, while lifecycle/accepted-owner checks prevent retired services from reconciling monitors or restarting. Pending candidates do not interrupt an accepted owner's work.

This is the focused publication/scheduler repair extracted from #130706. Current Workshop execution remains an ordinary isolated agent turn with canonical declaration-key identity. No new config option, protocol, SQLite schema, or public API is added.

Validation:

  • Original current-main source failed the three real managed-secrets/CronService/SQLite and accepted-config replacement regressions before the repair.
  • Additional failures were reproduced for stale scheduler startup, skipped predecessor drain, monitor-only publication ownership loss, and post-commit policy rejection. Precommit rejection and pending-candidate controls remain covered.
  • All 426 tests passed across reload handlers, managed reload status, Gateway cron, and lazy cron. Real supervised on-exit children survive eager and lazy handoff exactly once.
  • Independent P2 review is scoped-clean, and the full changed-file gate passed. The compiled real Gateway proof passed: config.patch → cron.list, combined scheduler changes, stable IDs/PID/boot/socket, no-op update, added-agent monitors, a normal isolated Workshop turn reading seeded material through the real tool boundary, final disablement, health, and cleanup.

Production: +94/-86, net +8. Tests/support: +463/-84, net +379. Documentation: net 0. The small production growth enforces accepted cron/lifecycle ownership and commit-bound cleanup; the config-override and pre-publication reconciliation paths are removed. Gateway recovery behavior and monitor ownership are the merge-sensitive surfaces.

Live proof used the QA Lab mock OpenAI provider with an actual compiled Gateway, authenticated RPC, SQLite, and normal tools. The live-tested publication tree was 1bf51d1ae2771c60a421177dde7cd145a39e465e. After the mechanical rebase onto frozen main f284a91, all three publication production files remain byte-for-byte identical to that live-tested source. Testbox run: final command exited0; lease was stopped and native status confirmed completed. The first attempt exposed missing synthetic Workshop material for the mock's generic reader; seeding SKILL.md at the canonical execution root fixed the fixture, with no production change.

{
  "passed": true,
  "sourceTree": "1bf51d1ae2771c60a421177dde7cd145a39e465e",
  "sourceVerified": true,
  "samePid": true,
  "sameBoot": true,
  "connections": 1,
  "monitorObservations": 11,
  "workshopRun": "ok",
  "workshopReadObserved": true,
  "leaseStatus": "completed"
}

The first PR CI run inherited a stale assertion from current main: the storage-failure test referenced input.failover.maybeRetryTransient after that member was removed from the owner contract and fixture. This caused both TS2339 and the runtime matcher failure. Remove that one obsolete assertion; retain the storage outcome/counter and both credential-rotation assertions. The failure reproduced on the rebased main, then all 23 tests in the affected file and its canonical agents-other TypeScript graph passed. Independent P2 review of the test-only repair is clean. This follow-up changes no production code, configuration, API, or schema.

Current head 8c84e255ee661f48c9e0ffddd05003a63dcab887 rebases the publication repair onto f284a91e0aca674ed4771a39415fdaee201c621c. The live proof above remains tied to its original tree; it is not represented as a new live run of the rebased aggregate.

At landing, main already contained the identical test repair from #139519. The resulting merge therefore introduces only the eight publication-related paths: production net +8, tests/support net +380, documentation net 0.

@clawsweeper

clawsweeper Bot commented Sep 5, 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 gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Sep 5, 2026
@steipete steipete self-assigned this Sep 5, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 8:00 PM ET / September 6, 2026, 00:00 UTC.

ClawSweeper review

What this changes

The PR publishes accepted Gateway configuration before updating heartbeat and Workshop schedules, fences scheduler follow-up work, and removes an obsolete test assertion.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused repair: current main retains the problematic publication order. No blocking defect was found in the introduced changes, and the prior review supplied no unresolved findings.

Priority: P2
Reviewed head: 8c84e255ee661f48c9e0ffddd05003a63dcab887

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused ownership repair with meaningful failure coverage and relevant recorded Gateway proof, with no blocking finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied compiled-Gateway evidence exercises authenticated config.patch through persisted monitor observation and an actual Workshop tool read, with stable process continuity and successful disablement. It names the original proof tree and reports unchanged production files after rebase; artifact access and independent byte comparison were unavailable to this reviewer.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied compiled-Gateway evidence exercises authenticated config.patch through persisted monitor observation and an actual Workshop tool read, with stable process continuity and successful disablement. It names the original proof tree and reports unchanged production files after rebase; artifact access and independent byte comparison were unavailable to this reviewer.
Evidence reviewed 9 items Current main still needs the repair: Current main reconciles candidate monitor rows inside the commit callback before marking runtime publication committed; a non-converged result throws. This retains the failure mechanism described in the PR.
Release comparison: The latest supplied release, v2026.9.2, has the same server-reload-hot.ts blob as inspected current main: ec17d72c28b82b0fcdd7dddf54185fb5fd5eb5c4. The publication repair is therefore not already present in that release.
Publication and lifecycle ownership: The reviewed head publishes runtime state first, drains the predecessor in finally after commitment, and checks current lifecycle and scheduler identity before monitor reconciliation and replacement startup. Managed secret publication retains its precommit validation and rollback boundary.
Findings None None.
Security None None.

How this fits together

The Gateway turns accepted configuration into persisted heartbeat and Workshop schedules. Its reload coordinator also manages scheduler replacement, cancellation, and recovery when those schedules cannot converge.

flowchart TD
  A[Configuration change] --> B[Validate and prepare]
  B --> C[Publish accepted runtime]
  C --> D[Check scheduler ownership]
  D --> E[Update persisted monitors]
  E --> F[Scheduled agent work]
  E --> G[Recovery and current-config retry]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +8, Tests +379, Docs 0. Total +387 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 3 94 86 +8
Tests 5 463 84 +379
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 558 171 +387

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +8 lines; tests/support net +379 lines The small production increase implements publication ownership and cleanup, while most growth exercises failure and lifecycle boundaries.

Technical review

Best possible solution:

Keep accepted runtime configuration authoritative and let the existing scheduler owner converge derived monitor rows with explicit recovery on failure.

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

Yes, source establishes a concrete path: fail a later monitor write after an earlier row succeeds, then reject publication while the candidate retry remains. The PR supplies targeted failing-before regressions; this review did not execute them.

Is this the best way to solve the issue?

Yes. Moving convergence behind acceptance and removing config overrides repairs the existing ownership boundary without adding a competing scheduler, public API, setting, or schema.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8964a4d8dc2f.

Labels

Label justifications:

  • P2: This repairs a bounded configuration-reload failure that can leave scheduled monitors inconsistent with accepted runtime state.
  • 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. Sufficient (live_output): The supplied compiled-Gateway evidence exercises authenticated config.patch through persisted monitor observation and an actual Workshop tool read, with stable process continuity and successful disablement. It names the original proof tree and reports unchanged production files after rebase; artifact access and independent byte comparison were unavailable to this reviewer.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied compiled-Gateway evidence exercises authenticated config.patch through persisted monitor observation and an actual Workshop tool read, with stable process continuity and successful disablement. It names the original proof tree and reports unchanged production files after rebase; artifact access and independent byte comparison were unavailable to this reviewer.

Evidence

What I checked:

  • Current main still needs the repair: Current main reconciles candidate monitor rows inside the commit callback before marking runtime publication committed; a non-converged result throws. This retains the failure mechanism described in the PR. (src/gateway/server-reload-hot.ts:206, 8964a4d8dc2f)
  • Release comparison: The latest supplied release, v2026.9.2, has the same server-reload-hot.ts blob as inspected current main: ec17d72c28b82b0fcdd7dddf54185fb5fd5eb5c4. The publication repair is therefore not already present in that release. (src/gateway/server-reload-hot.ts, 3928bad9badf)
  • Publication and lifecycle ownership: The reviewed head publishes runtime state first, drains the predecessor in finally after commitment, and checks current lifecycle and scheduler identity before monitor reconciliation and replacement startup. Managed secret publication retains its precommit validation and rollback boundary. (src/gateway/server-reload-hot.ts:233, 8c84e255ee66)
  • Retry and mutation fencing: Reconciliation captures the pinned runtime configuration, checks its identity and the reconciliation epoch, and retries against current runtime state. Heartbeat and Workshop reconcilers pass the guard through the existing cron mutation owner; stopping cron invalidates the epoch and timer. (src/gateway/server-cron.ts:1566, 8c84e255ee66)
  • Failure and replacement coverage: Inspected regressions inject a real SQLite row-write failure through managed reload, verify retained accepted config and eventual monitor convergence, and cover rejected/no-op successors. Additional cases distinguish shutdown or scheduler replacement from a merely pending candidate and check predecessor cleanup after policy failure. Tests were inspected, not executed during this read-only review. (src/gateway/server-reload-handlers.test.ts:2569, 8c84e255ee66)
  • Recorded real Gateway proof: The complete supplied body records compiled Gateway execution through authenticated config.patch and cron.list with SQLite, 11 monitor observations, unchanged PID/boot/socket, and a normal isolated Workshop turn reading seeded material. Proof names tree 1bf51d1ae2771c60a421177dde7cd145a39e465e and reports unchanged publication production files after rebase. The linked run is https://github.com/openclaw/openclaw/actions/runs/33997409538. Network access and the unavailable older tree prevented independent artifact inspection and byte comparison; these are reviewer limitations, not missing contributor proof.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: 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 (1 earlier review cycle)
  • reviewed 2026-09-05T23:35:43.880Z sha bc86ad1bc365cdf69ff13757fcc6493872c5243c :: needs maintainer review before merge. :: none

Keep accepted runtime config authoritative when system monitor convergence
partially fails. Remove candidate config overrides from reconciliation and
bind retries to the current accepted config.

Tie predecessor scheduler cleanup to runtime commit, including later policy
publication failures. Fence monitor and startup follow-ups by accepted cron
ownership and Gateway lifecycle while allowing pending config candidates.

Ref #130706.
The assistant-failure input no longer exposes maybeRetryTransient. Remove
the stale matcher while retaining the storage outcome, retry counter, and
credential-rotation assertions.

Ref #139509.
@steipete
steipete force-pushed the codex/130706-extract-publication-main-20260905 branch from bc86ad1 to 8c84e25 Compare September 5, 2026 23:53
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 5, 2026
@steipete
steipete merged commit 26178af into main Sep 6, 2026
182 checks passed
@steipete
steipete deleted the codex/130706-extract-publication-main-20260905 branch September 6, 2026 00:10
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
…9509)

* fix(gateway): publish config before reconciling monitors

Keep accepted runtime config authoritative when system monitor convergence
partially fails. Remove candidate config overrides from reconciliation and
bind retries to the current accepted config.

Tie predecessor scheduler cleanup to runtime commit, including later policy
publication failures. Fence monitor and startup follow-ups by accepted cron
ownership and Gateway lifecycle while allowing pending config candidates.

Ref openclaw#130706.

* test(agents): drop obsolete storage-failure retry assertion

The assistant-failure input no longer exposes maybeRetryTransient. Remove
the stale matcher while retaining the storage outcome, retry counter, and
credential-rotation assertions.

Ref openclaw#139509.
necromman pushed a commit to necromman/openclaw that referenced this pull request Sep 20, 2026
…9509)

* fix(gateway): publish config before reconciling monitors

Keep accepted runtime config authoritative when system monitor convergence
partially fails. Remove candidate config overrides from reconciliation and
bind retries to the current accepted config.

Tie predecessor scheduler cleanup to runtime commit, including later policy
publication failures. Fence monitor and startup follow-ups by accepted cron
ownership and Gateway lifecycle while allowing pending config candidates.

Ref openclaw#130706.

* test(agents): drop obsolete storage-failure retry assertion

The assistant-failure input no longer exposes maybeRetryTransient. Remove
the stale matcher while retaining the storage outcome, retry counter, and
credential-rotation assertions.

Ref openclaw#139509.

(cherry picked from commit 26178af)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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