Repository navigation
fix(gateway): close TLS renewal with the gateway lifetime - #146504
Conversation
Pass the renewal handle directly to variadic sidecar registration after the ownership cutover in #146275. This restores production typechecks and clean TLS-enabled Gateway shutdown. Cover the real startup and close path with a regression.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 6:00 PM ET / 22:00 UTC (Revision 2). ClawSweeper reviewWhat this changesRegisters TLS certificate renewal directly with Gateway shutdown cleanup and adds a test that starts and closes a TLS-enabled Gateway. Merge readiness✅ Ready for maintainer review No actionable defects found. The production correction already landed through #146412, but this PR retains meaningful regression coverage missing from main. Its maintainer ownership also precludes automatic closure. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway watches its configured TLS certificate files and updates HTTPS listeners when valid replacement material arrives. Its shutdown owner must stop those watchers and join pending renewal work before releasing the server. flowchart TD
A[Configured certificate files] --> B[TLS renewal watcher]
B --> C[HTTPS listeners]
B --> D[Gateway lifetime owner]
E[Gateway shutdown] --> D
D --> F[Stop watches and join pending work]
F --> G[Release server resources]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +60. Total +60 across 2 files. View PR surface stats
Review metricsNone. 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: Retain main's existing cleanup owner and add the startup-to-shutdown regression that protects its TLS registration boundary. Do we have a high-confidence way to reproduce the issue? No current-main failure is established: main already contains the correction. The original array-registration failure is source-explained and documented by the submitted failing-before test output. Is this the best way to solve the issue? Yes. Direct registration uses the existing variadic cleanup contract, and the added test covers the real startup caller that helper-level tests missed. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 38d95fbbb457. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…46504) Protect clean TLS-enabled Gateway shutdown by covering registration of certificate renewal with the Gateway lifetime owner through real startup and close. openclaw#146267 added TLS renewal registration using an array; openclaw#146275 changed sidecar registration to variadic handles and missed that caller. Passing the renewal handle directly prevents failed production typechecks and shutdown errors (sidecar.stop is not a function). Current main already carries the one-line correction; this landing preserves the integrated regression that detects the caller-contract mismatch. The test uses isolated synthetic TLS material, closes the real Gateway, and observes the real renewal cleanup. The recorded regression failed before the repair and passed afterward; focused sibling coverage passed 22 tests. Exact-head CI and lead Codex review passed. No configuration, storage, or protocol changes. Refs openclaw#146267, openclaw#146275, openclaw#144587, openclaw#146246.
Refs #146275, #146267, #144587, #146246.
What Problem This Solves
Protects TLS-enabled Gateway shutdown from the registration mismatch that caused
sidecar.stop is not a functionand failed production typechecks. Current main contains the corrected registration; this PR adds the integrated startup-to-shutdown regression coverage.User Impact
TLS-enabled Gateways can close cleanly and release certificate-renewal watches and pending work. This restores the intended lifecycle behavior without configuration, storage, or protocol changes. The installed updater is unchanged; a candidate Gateway uses the existing shutdown owner.
Why This Change Was Made
#146267 introduced TLS renewal with a complete
stop()implementation. The subsequent sidecar ownership cutover in #146275 (ad08bd71ff1) changed registration from an array to variadic handles but missed this caller. Startup therefore registered the array itself as a sidecar.Pass the existing renewal handle directly to the lifetime owner. The regression starts a real isolated TLS-enabled Gateway and verifies that shutdown completes and invokes the real renewal cleanup. Existing renewal tests cover joining pending reads, removing watches, and fencing stale publication.
Evidence
The reported check-prod-types job fails with the same TS2741 reproduced locally.
Before the production fix:
After the fix:
pnpm tsgo: passed.node scripts/run-vitest.mjs src/gateway/server-startup-lifetime.test.ts src/gateway/server-tls-renewal.test.ts src/gateway/server-lifetime-sidecars.test.ts --silent: 3 files, 22 tests passed (including the TLS shutdown regression).node scripts/check-changed.mjs: passed. An initial lint finding in the test observer was fixed by binding the real cleanup method; the complete gate then passed.git diff --check: passed.9b4ad129b4935178f15abd30f3f7a9c7baef36e1; the repository watcher reportedrollup=green,github_rollup=SUCCESS, andpending=0.Full release/update validation, including a published-updater/candidate run, is outside this narrow CI repair lane. Lead Codex autoreview of the exact head is scoped-clean at P1. The landing worker independently verified the variadic registration owner and rechecked exact-head CI with the repository watcher (
rollup=green,pending=0). No code from other contributors was adopted into this patch; related PRs are credited above as context.ClawSweeper review
The completed review of
9b4ad129b4935178f15abd30f3f7a9c7baef36e1found no actionable defects. No items needed fixes or skips. The integrated Gateway shutdown regression remains useful on current main. No code changed during landing preparation, so no re-review request was posted.