Repository navigation
refactor(gateway): invert config reloader ownership - #122004
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 7:10 AM ET / 11:10 UTC. ClawSweeper reviewWhat this changesThe PR routes Gateway configuration-reload state changes, plugin reload, and request-context reloader access through kernel-owned operations instead of direct mutable-state access. Merge readinessNo blocking findings. This focused, maintainer-owned Gateway refactor preserves the existing reload sequence while moving mutable-state access to the kernel boundary; retain it for exact-head CI and normal maintainer merge review. Priority: P3 Review scores
Verification
How this fits togetherGateway startup creates a kernel around live server state, then starts the configuration reloader and exposes an RPC request context. Reloads update cron, heartbeat, plugin, and health-monitor handles that Gateway services subsequently read. flowchart LR
A[Configuration or plugin change] --> B[Gateway config reloader]
B --> C[Gateway kernel]
C --> D[Live Gateway state]
C --> E[Plugin services and discovery]
D --> F[Health and RPC request context]
E --> F
Before merge
Agent review detailsSecurityNone. PR surfaceSource +31, Tests -14. Total +17 across 6 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep reloader-owned operations behind the Gateway kernel and merge once exact-head required checks complete. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors an internal ownership boundary rather than reporting a user-facing failure. Is this the best way to solve the issue? Yes: adjacent Gateway lifecycle operations already use the kernel boundary, so moving the reloader and request-context access there avoids retaining a reverse dependency on raw live state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bcaec0cf145c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready proof:
This is phase-2 PR 6 of the Gateway kernel split. Next is the final composition and import-boundary PR, then the authorized sequence stops. |
|
Merged via squash.
|
What Problem This Solves
Phase-2 PR 6 removes the config reloader’s reverse dependency on raw Gateway kernel state after the resident registry landed in #121996.
Why This Change Was Made
The kernel now owns reload snapshots and the named
swapHeartbeatRunner()andswapCronState()operations, including the livedeps.cronpublication. The reloader calls those methods in the same synchronous order as the prior field assignments. Plugin replacement is exposed only askernel.reloadPlugins(), while plugin-service publication also stays behind the kernel setter.Request-context plugin metadata notifications and hot-reload status no longer reach into
runtimeState.configReloader. They call kernel bridges that resolve the currentGatewayConfigReloaderHandle, whose pre-start inert implementation remains unchanged. There are no config, protocol, default, ordering, or user-visible behavior changes.This is phase-2 PR 6 of the Gateway kernel split. The next and final authorized step is PR 7: final composition plus the kernel import-boundary invariant.
User Impact
No user-visible change. Config reload, cron/heartbeat swaps, plugin reload, and metadata refresh keep their existing behavior behind an explicit kernel ownership boundary.
Evidence
node scripts/check-changed.mjs -- <touched>: formatting, dead exports, lint, plugin boundaries, schema/runtime/import-cycle/auth guards passed locally after remote backend fallbackpnpm build: passedThe default local multi-project Gateway runner still reproduces the current-main stale state-schema inlining issue recorded on PR 5; the focused proof uses
OPENCLAW_GATEWAY_PROJECT_SHARDS=0without changing assertions. Exact-head hosted CI remains the heal-check.ClawSweeper review metrics: production
+61/-30(net+31) for kernel-owned reload state, plugin reload, and resident-handle bridges; tests+20/-34(net-14). AI-assisted; implementation and evidence were reviewed directly.