#22980: Gateway: add manual secrets reload command
gateway
cli
maintainer
size: S
Cluster:
Gateway Hot-Reload Improvements
## Summary
- add `secrets.reload` gateway RPC to re-resolve refs from the active unresolved config snapshot
- add `openclaw secrets reload` CLI command to trigger runtime secret re-activation
- classify/list the new method in gateway method metadata and add tests
## Validation
- pnpm check
- pnpm vitest src/gateway/server-methods/secrets.test.ts src/cli/secrets-cli.test.ts src/secrets/runtime.test.ts
- pnpm vitest src/gateway/method-scopes.test.ts src/gateway/server-methods.control-plane-rate-limit.test.ts
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added `secrets.reload` RPC method to manually re-resolve secret references from the active snapshot's source config. The implementation reuses the existing `activateRuntimeSecrets` helper to prepare and activate a new snapshot from `sourceConfig`, preserving the unresolved configuration for subsequent reloads. The CLI command properly handles both human-readable and JSON output formats, with appropriate error handling and permission scoping to `operator.admin`.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The implementation follows existing patterns, includes comprehensive unit tests for both gateway handlers and CLI commands, properly handles error cases, and correctly integrates with the existing secrets runtime system. The addition of `sourceConfig` to the snapshot structure enables the reload functionality without breaking changes.
- No files require special attention
<sub>Last reviewed commit: 3b463cb</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#22858: Gateway: add eager secrets runtime snapshot activation
by joshavant · 2026-02-21
84.9%
#7747: Gateway: add zero-latency hot-reload for agent bindings
by NikolasP98 · 2026-02-03
73.8%
#11280: fix(gateway): add meta prefix to reload rules to prevent double SIG...
by cheenu1092-oss · 2026-02-07
72.0%
#13537: Gateway: add commands.list slash command metadata API
by Pyiner · 2026-02-10
71.6%
#4108: gateway: hot-reload heartbeat when agents.list changes
by jifanchn · 2026-01-29
71.6%
#22720: fix: notify sessions on invalid config during hot-reload
by jayleekr · 2026-02-21
70.9%
#16663: feat: GCP Secret Manager integration for external secrets management
by amor71 · 2026-02-15
70.7%
#22765: docs(gateway): add secrets providers guide (env/keyring/1Password/c...
by alexmelges · 2026-02-21
70.6%
#23364: Gateway: add risk-ack interlock for dangerous Control UI flags
by bmendonca3 · 2026-02-22
70.6%
#13408: fix(gateway): skip SIGUSR1 restart in config.patch for noop reload ...
by rwmjhb · 2026-02-10
70.6%