Skip to content

fix(gateway): register TLS renewal with sidecar owner - #146412

Merged
steipete merged 1 commit into
mainfrom
codex/tls-renewal-sidecar-registration
Sep 12, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/tls-renewal-sidecar-registration

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Related: #146275, #146267

What Problem This Solves

Concurrent changes left TLS renewal using the old array-based Gateway sidecar registration call after the stop owner switched to variadic handles. The merged source fails core typechecking because the array has no stop() method. A TLS-enabled Gateway would register the array itself and fail to stop its renewal watcher through the lifetime owner during shutdown.

Why This Change Was Made

Pass the TLS renewal handle directly to the existing sidecar stop owner. This is a one-line caller correction; TLS enablement, certificate renewal, and shutdown ownership remain unchanged.

User Impact

TLS renewal participates in normal Gateway shutdown cleanup. No configuration, schema, stored-format, dependency, or public API change; no migration is needed.

Evidence

  • Original merged main reproduced TS2741 in server-startup-finish.ts: the registered array lacks the required stop method.
  • The corrected source passes core typechecking and targeted lint.
  • Independent review through P2 found no actionable defect.
  • The full build passed on e3386ff2f238832f9b2c23e93f396c300aed57ae.
  • A real isolated TLS Gateway passed certificate/hostname-validated HTTPS and WSS over TLS 1.3. Health confirmed the config reloader was active after TLS sidecar registration. SIGTERM closed the retained WebSocket with code 1012 and exited cleanly in 103 ms with no sidecar-stop or shutdown errors. The process stopped, the port was reusable, and the synthetic private key was removed.
  • Canonical package integrity/import checks passed. A fresh published 2026.9.4 updater upgraded its isolated prefix to this exact candidate in 81.6 seconds: all 12 steps, plugin convergence, existing synthetic state preservation, installed Gateway health/build RPC, four CLI lock cases, and clean shutdown passed. The standard installed-package cell used HTTP; the separate cell above provides TLS-specific proof. Package SHA-256: 1361c9a70291258a9699c71715998f31907eefc72241da766ce400e3a7bde18c.
  • Upgrade proof reused the verified task-owned npm cache. The earlier cleanup candidate's cold native-package download exceeded the unchanged canary deadline and safely refused before activation, preserving the published installation/config. No timeout or assertion was relaxed. Managed-service restart, provider inference, and the unchanged certificate-rotation matrix were not exercised.

@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.

@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 5:02 PM ET / 21:02 UTC (Revision 2).

ClawSweeper review

What this changes

Pass the TLS certificate renewal handle directly to the Gateway’s background-service owner so shutdown can stop its watcher.

Merge readiness

✅ Ready for maintainer review

The canonical repair remains necessary on current main. No actionable defect was found, and the supplied TLS shutdown and published-version upgrade evidence supports the narrow change.

Priority: P2
Reviewed head: e3386ff2f238832f9b2c23e93f396c300aed57ae

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A minimal, correct caller repair with relevant real Gateway shutdown and upgrade evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied exact-head observations exercise TLS-enabled Gateway startup and SIGTERM through the production lifetime owner, reporting validated HTTPS/WSS, clean shutdown without sidecar errors, and a reusable port; separate published-driver upgrade evidence covers preserved installation state.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied exact-head observations exercise TLS-enabled Gateway startup and SIGTERM through the production lifetime owner, reporting validated HTTPS/WSS, clean shutdown without sidecar errors, and a reusable port; separate published-driver upgrade evidence covers preserved installation state.
Evidence reviewed 7 items Verified introduced change: The merge-base-to-head diff contains only the correction from an array argument to the existing renewal handle.
Existing lifetime contract: The owner accepts variadic handles, registers each handle directly, and invokes its stop method. The renewal handle stops its timer, removes file watchers, and joins pending work; the shutdown coordinator invokes this owner.
Current main still needs the repair: Fetched main still passes [tlsRenewal], despite the variadic owner contract. The renewal and sidecar-owner modules have no differences from the reviewed head.
Findings None None.
Security None None.

How this fits together

Gateway startup creates a watcher for accepted TLS certificate files. Its lifetime owner collects background-service handles and stops them during shutdown.

flowchart LR
  A[Accepted TLS configuration] --> B[Certificate renewal watcher]
  B --> C[HTTPS listeners]
  B --> D[Lifetime handle registration]
  E[Gateway shutdown] --> F[Background-service stop owner]
  D --> F
  F --> G[Stop watcher and join pending work]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0. Total 0 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
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 1 1 1 0

Review metrics

None.

Root-cause cluster

Relationship: canonical
Canonical: #146412
Summary: The discussion explicitly selects this PR as the canonical repair for the TLS registration mismatch.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep TLS renewal cleanup with the existing lifetime owner through this direct caller correction, preserving certificate policy and configuration.

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

Yes, source establishes the failure: TLS-enabled startup registers an array as a handle, and shutdown calls its nonexistent stop method. Runtime execution was not performed during this read-only review.

Is this the best way to solve the issue?

Yes. Adapting the caller to the existing variadic contract is the smallest repair and avoids another cleanup owner or compatibility wrapper.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 43f38256a7b3.

Labels

Label changes:

  • add P2: Repairs a source-proven TLS watcher shutdown defect with a limited runtime blast radius.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied exact-head observations exercise TLS-enabled Gateway startup and SIGTERM through the production lifetime owner, reporting validated HTTPS/WSS, clean shutdown without sidecar errors, and a reusable port; separate published-driver upgrade evidence covers preserved installation state.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.

Label justifications:

  • P2: Repairs a source-proven TLS watcher shutdown defect with a limited runtime blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied exact-head observations exercise TLS-enabled Gateway startup and SIGTERM through the production lifetime owner, reporting validated HTTPS/WSS, clean shutdown without sidecar errors, and a reusable port; separate published-driver upgrade evidence covers preserved installation state.

Evidence

What I checked:

  • Verified introduced change: The merge-base-to-head diff contains only the correction from an array argument to the existing renewal handle. (src/gateway/server-startup-finish.ts:416, e3386ff2f238)
  • Existing lifetime contract: The owner accepts variadic handles, registers each handle directly, and invokes its stop method. The renewal handle stops its timer, removes file watchers, and joins pending work; the shutdown coordinator invokes this owner. (src/gateway/server-sidecar-owners.ts:13, e3386ff2f238)
  • Current main still needs the repair: Fetched main still passes [tlsRenewal], despite the variadic owner contract. The renewal and sidecar-owner modules have no differences from the reviewed head. (src/gateway/server-startup-finish.ts:416, 43f38256a7b3)
  • Latest release boundary: The v2026.9.4 startup file has no TLS renewal registration and retains the older array-based sidecar call. This is a repair to subsequent main-branch integration, not an already-shipped fix. (src/gateway/server-startup-finish.ts, 3a9d69db306c)
  • Feature history and routing: Recent path history identifies the merged TLS renewal and sidecar consolidation work. GitHub’s commit API confirms steipete authored the consolidation and shows the array-to-variadic contract change against its recorded parent. Local deeper blame encountered unavailable objects, so no unsupported introduction claim is made. (src/gateway/server-sidecar-owners.ts:13, ad08bd71ff1b)
  • After-fix runtime and upgrade evidence: The complete supplied PR body records certificate/hostname-validated HTTPS and WSS using TLS 1.3 on the exact head, an active config reloader, WebSocket closure code 1012, and clean SIGTERM exit in 103 ms without sidecar-stop errors. It also records a published 2026.9.4 updater completing all 12 upgrade steps in 81.6 seconds with synthetic state preserved. These are contributor-reported live observations; this read-only review did not rerun them. The media manifest contains images belonging to unrelated related PRs. (e3386ff2f238)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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-12T20:46:50.432Z sha e3386ff :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

I am taking the native landing workflow for this exact green head, e3386ff2f238832f9b2c23e93f396c300aed57ae, as the canonical repair for the TLS lifetime-owner mismatch. The source diff is the required one-line caller adaptation, and the existing build, live TLS shutdown proof, and CI are complete. I will verify the merged commit before closing duplicate #146411; no further repair branch is needed.

@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant