Repository navigation
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 20, 2026, 12:56 PM ET / 16:56 UTC. Summary PR surface: Source +81, Tests +267, Docs 0. Total +348 across 10 files. Reproducibility: yes. from source: current-main hot-mode RPC behavior directly restarts restart-required writes, while this branch changes the same path to warn-and-keep for routine reasons. The reported watcher staleness path is also covered by focused branch tests, but this review did not execute them. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Keep direct restart for routine hot-mode RPC writes unless gateway owners explicitly choose parity with watcher warn-and-keep; then add redacted final-head runtime evidence for routine RPC, gateway-auth, auth-profile/order, and live provider-secret rotation behavior. Do we have a high-confidence way to reproduce the issue? Yes, from source: current-main hot-mode RPC behavior directly restarts restart-required writes, while this branch changes the same path to warn-and-keep for routine reasons. The reported watcher staleness path is also covered by focused branch tests, but this review did not execute them. Is this the best way to solve the issue? Unclear: the shared helper is a maintainable implementation shape, but applying watcher semantics to an explicit RPC write is not proven to be the best product contract. Preserve the current RPC behavior unless gateway owners intentionally approve the change. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e0206b4967a6. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +81, Tests +267, Docs 0. Total +348 across 10 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (12 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review Added a full |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Thanks for the pushback. I want to leave a counter-position for the maintainer rather than reshape the PR yet, because the "preserve hot as no-restart" interpretation is at odds with what Why the current PR shape: hot mode never advertised no-automatic-restart.
That sentence describes the operation Treating "apply changes in-process" as a strict ban on restart for restart-required edits is what produced the silent staleness. The alternative — "if it can't be done in-process, fall back to the existing restart path" — is what Why I do not want to collapse this into If Alternative I will accept: explicit writer restart intent. The If maintainers prefer that direction, I can:
Doc alignment. Will hold off on either path until a maintainer weighs in on which contract they want |
|
@clawsweeper re-review PR body now contains the after-fix live capture you asked for: the new |
|
🦞👀 Command router queued. I will update this comment with the next step. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
496b58d to
acffef6
Compare
acffef6 to
2669153
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Rebased onto current main ( Local verification after rebase: gateway-config shard 360/360 (incl. the three branch-behavior regressions), schema tests 29+51, all passing. The open maintainer question stands: sign-off wanted on the new |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Rebased onto current P1 — carve-out missed
P2 —
Rebase: resolved the one conflict in Verification (local, macOS, Node 24, at Known proof gap (called out in the body): the earlier live sandbox captures (scenarios A/B/C) were taken at |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
There was a problem hiding this comment.
Pull request overview
Tightens gateway.reload.mode: "hot" restart behavior by sharing a single hot-mode restart decision across file-watcher reloads and config.patch/config.apply, preserving the existing warn-and-keep default while adding an opt-in for auto-restart and an always-on security-critical restart carve-out.
Changes:
- Introduces
gateway.reload.autoRestartOnRequired(defaultfalse) and uses it to optionally escalate routine restart-required hot-mode edits into supervised restarts. - Ensures security-critical restart reasons (
gateway.auth.*,auth.profiles.*/auth.order.*,secrets.*) trigger restarts in hot mode even without the opt-in, including explicitly classifyingsecrets.providers.*as restart-required. - Adds regression coverage for the three-way hot-mode behavior (warn-and-keep, opt-in restart, security-critical restart) and updates gateway reload docs/help/labels.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/gateway/server-methods/config.shared-auth.test.ts | Adds RPC write-path tests for warn-and-keep vs opt-in restart vs security-critical restart in hot mode. |
| src/gateway/server-methods/config-write-flow.ts | Aligns RPC restart scheduling with the shared hot-mode restart decision. |
| src/gateway/config-reload.ts | Applies the shared hot-mode decision to the file-watcher reload path (warn-and-keep vs scheduling restart). |
| src/gateway/config-reload.test.ts | Adds tests for default hot-mode behavior, opt-in auto-restart, and security-critical restarts (auth + secrets). |
| src/gateway/config-reload-settings.ts | Introduces resolveHotModeRestartDecision and plumbs autoRestartOnRequired into resolved reload settings. |
| src/gateway/config-reload-plan.ts | Marks secrets.providers.* as restart-required to activate the security-critical carve-out for provider secret rotations. |
| src/config/zod-schema.ts | Adds strict-schema support for gateway.reload.autoRestartOnRequired. |
| src/config/types.gateway.ts | Adds the new GatewayReloadConfig.autoRestartOnRequired type + documentation. |
| src/config/schema.labels.ts | Adds label for the new config field. |
| src/config/schema.help.ts | Updates help text for reload mode and documents the new opt-in field. |
| docs/gateway/index.md | Updates the hot reload modes table to mention the opt-in. |
| docs/gateway/configuration.md | Updates reload mode documentation to mention the opt-in behavior. |
| docs/gateway/configuration-reference.md | Updates reference docs to describe warn-and-keep default, opt-in, and security carve-out. |
| | `gateway.reload.mode` | Behavior | | ||
| | --------------------- | ----------------------------------------------------------------------------------------------------- | | ||
| | `off` | No config reload | | ||
| | `hot` | Hot-apply safe changes; warn on restart-required (set `reload.autoRestartOnRequired: true` to opt in) | |
| @@ -137,6 +137,14 @@ const BASE_RELOAD_RULES_TAIL: ReloadRule[] = [ | |||
| { prefix: "session", kind: "none" }, | |||
| { prefix: "talk", kind: "none" }, | |||
| { prefix: "skills", kind: "none" }, | |||
| // Provider SecretRef storage rotations need a supervised restart so the | |||
| // running runtime stops resolving the old credential. The hot-mode | |||
| // security carve-out at config-reload.ts:79 relies on this classification | |||
|
Addressed the Copilot review nits (amended into head d9ea589545405aefeea091854204ad71f0d9d2b1):
Wording-only change (one doc cell, one comment). Locally verified: |
|
Addressed the review findings; new head is
Local verification at |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Rebased onto current
|
…t config edits Hot reload mode (gateway.reload.mode: "hot") kept the shipped warn-and-keep contract even when gateway.auth.*, auth.profiles.*/auth.order.*, or secrets.providers.* changed on disk, so a credential rotated in response to a leak stayed accepted by the running gateway until a manual restart. Hot mode now schedules a supervised restart for those security-critical prefixes while routine restart-required edits keep warn-and-keep; blanket auto-restart stays the hybrid mode's job. The decision is shared between the file watcher and the config.patch/config.apply RPC write path via resolveHotModeRestartDecision, so routine restart-required RPC writes in hot mode now return a requiresRestart notice instead of direct-restarting. secrets.providers.* is now classified restart-required in the reload planner so provider SecretRef rotations reach the carve-out.
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: [codex] fix gateway hot-mode restart reloads This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Closing as superseded by This PR's premise was refining the hot-mode warn-and-keep contract: keep routine restart-required edits on warn-and-keep, and auto-restart only security-critical ones (
Reopen-worthy evidence would be a maintainer decision to bring back a warn-and-keep mode for hot reloads; the shared-decision plumbing in this branch would be the starting point for that. |
Summary
Closes the silent-staleness hole in
gateway.reload.mode: "hot"for security-critical config, without adding any config surface. Hot mode keeps the shipped warn-and-keep contract for routine restart-required edits; restart reasons undergateway.auth.*,auth.profiles.*/auth.order.*, andsecrets.providers.*now always schedule a supervised restart. Without this, agateway.auth.tokenrotation, a doctor batch that renamesauth.profiles.openai-codex:*profiles, or asecrets.providers.*credential rotation on disk sits behind warn-and-keep while the runtime keeps honoring the stale credential/profile state.Design trim per review: earlier revisions of this PR added a
gateway.reload.autoRestartOnRequiredopt-in key. Review correctly pointed out thatgateway.reload.mode: "hybrid"(the default) already provides exactly hot-then-restart for restart-required edits, so the key duplicated an existing mode on a compatibility-sensitive config surface. The key is now removed entirely (types, zod schema, schema help/labels, docs, tests); operators who want blanket auto-restart for restart-required edits usemode: "hybrid", and the docs say so. What remains is the PR's unique value: the always-on security carve-out in hot mode, plus watcher/RPC decision parity.The hot-mode restart policy is one shared decision (
resolveHotModeRestartDecision) used by both the file watcher and theconfig.patch/config.applyRPC write path, so the two write surfaces cannot diverge. Maintainer call-out: this deliberately changes current RPC behavior in hot mode: onmain,config-write-flow.tsschedules a direct restart for any restart-requiredconfig.patch/config.applywrite whenmode === "hot"; with this PR, routine restart-required RPC writes return arequiresRestartnotice without bouncing the gateway (matching the watcher's warn-and-keep contract), while security-critical writes still direct-restart. If maintainers prefer the RPC surface to keep direct-restarting unconditionally, that is a one-line change inresolveConfigRestartRequirement.Details
src/gateway/config-reload-settings.ts:33:SECURITY_CRITICAL_RESTART_PREFIXES = ["gateway.auth", "auth.profiles", "auth.order", "secrets"]. Theauth.profiles/auth.orderentries cover the production repro (doctor batch renamingauth.profiles.openai-codex:*with model routes): those paths are unmatched in the reload-plan rules, default to restart-required, and default hot mode dropped them with a warn.schema.helpnow saysecrets.providers.*, which is the onlysecrets.*prefix the reload planner classifies restart-required (src/gateway/config-reload-plan.ts:148); othersecrets.*namespaces stay hot/no-op.SECURITY_CRITICAL_RESTART_PREFIXESkeeps the broadersecretsprefix deliberately: it only ever sees planner-emitted restart reasons, so the conservative superset is inert today and stays correct if moresecrets.*paths become restart-required later (documented at the constant).src/gateway/config-reload-settings.ts:55:resolveHotModeRestartDecision(restartReasons)returns"security-critical" | "warn-and-keep"and is the single owner of the hot-mode policy.src/gateway/config-reload.ts:319: the watcher's restart-required hot branch routes through the shared decision; the existing idle-aware restart machinery (queueRestart) remains the only watcher restart path.src/gateway/server-methods/config-write-flow.ts:178:resolveConfigRestartRequirementroutes hot-mode RPC writes through the same decision instead of unconditionally direct-restarting.auth.profiles/auth.orderrename auto-restarts in hot mode (src/gateway/config-reload.test.ts:1835);secrets.providers.*is restart-required in the planner while othersecrets.*stays no-op; and the RPC path is pinned both ways insrc/gateway/server-methods/config.shared-auth.test.ts:366(routine write keeps running withrequiresRestart: true; auth-token write direct-restarts).docs/gateway/configuration-reference.md,docs/gateway/configuration.md,docs/gateway/index.mddescribe the hot-mode carve-out (secrets.providers.*wording), that the policy applies to both file edits andconfig.patch/config.applywrites, and that blanket auto-restart is"hybrid"'s job. Thedocs/gateway/index.mdtable is regenerated throughscripts/format-docs.mjs, fixing thecheck-docsfailure on the previous head.Real behavior proof
Behavior addressed: in hot reload mode, a config write touching any restart-required key was dropped with a single
log.warnwhile the gateway kept serving from the stale in-memory snapshot. Observed in production as a 4-hour silent outage where the agent kept resolving the legacyopenai-codex/gpt-5.5model id afteropenclaw doctor --fixhad migrated the on-disk config (includingauth.profiles.openai-codex:*renames) toopenai/gpt-5.5. With this patch, security-critical edits (gateway auth, auth profiles/order, provider secrets) self-heal via restart in hot mode.Real environment tested: live sandbox gateway on macOS (Node 24, loopback port 19777), run from this PR's final-head worktree at
b6206ec825vianode --import tsx src/entry.ts gateway run, with isolatedOPENCLAW_STATE_DIR+OPENCLAW_CONFIG_PATHandgateway.reload: { mode: "hot", debounceMs: 100 }.Exact steps or command run after this patch: start the sandbox gateway, then per scenario: edit the sandbox
openclaw.jsonon disk and watch the reload log, or drive the RPC path withopenclaw gateway call config.get/config.patch:Evidence after fix: redacted live log capture from the sandbox gateway at
b6206ec825:At the same head, locally (macOS, Node 24):
plus
tsgocore and core-test lanes clean,oxfmt --check/run-oxlint.mjsclean on touched files, and the docs chain green (format-docs.mjs --check,check-docs-mdx.mjs,docs-link-audit.mjs0 broken links,generate-docs-map.mjs --check).Observed result after fix: scenario (c) proves existing hot-mode deployments keep the shipped warn-and-keep contract. Scenario (d) proves the RPC write path makes the same decision as the watcher and surfaces
requiresRestart: trueinstead of bouncing the gateway. Scenarios (a) and (b) prove auth-profile batch renames and provider secret rotations propagate by restart in default hot mode, closing the credential-rotation-bypass gap at the exact prefixes that caused the production incident.What was not tested:
markdownlint-cli2was not run locally (networkpnpm dlx; covered by CIcheck-docs). Launchd auto-respawn end-to-end on hosts usingKeepAlive: { SuccessfulExit: false }(see operator note below; not a regression, the pre-fix path also required manual intervention); the sandbox exercised the unmanaged in-process restart path shown above.Operator note: launchd
SuccessfulExit=falsehostsHosts that set
KeepAlive: { Crashed=true, SuccessfulExit=false }(to dodge an unrelated respawn cascade) will not auto-respawn after a restart hand-off that exits cleanly. The deployment fork pairs this with a 30s interval watchdog (launchctl printstate AND port-binding check, thenlaunchctl kickstart -k). Hosts on default launchdKeepAlivesemantics respawn normally and need nothing.