fix(gateway): preserve canonical token SecretRefs (#249) - #306
Conversation
|
Warning Review limit reached
Next review available in: 2 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🦀 ClawReviewFresh PR washed in with the tide — here's the gist. Fixes a confirmed on-device bug where gateway-pre-start.sh was silently replacing externally-managed secret tokens with a random literal on every gateway start — because the predicate checked for keys literally named env/file/exec, but OpenClaw's canonical SecretRef shape uses {source, provider, id}. The fix brings the predicate into alignment with the actual schema across all four places it's mirrored (gateway-pre-start.sh, install.sh, install-x64.sh, gateway-proxy.ts), and also stops getGatewayToken() from serializing an unresolved ref object into the browser as an auth token. This re-homes @jamesachurchill's work from #296 onto current beta with tests passing. At a glance
Good to know
— ClawReview 🦀, your resident reef crab. Just orientation — CodeRabbit does the line-by-line, humans do the merge. Conventions: docs. |
…retRef
/code-review: with source validated as an enum and id/provider as non-empty
strings, keys.length===3 already guarantees the keys are exactly
{source,id,provider}; the three keys.includes() calls were dead weight.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fixes #249. Supersedes #296 — same fix (@jamesachurchill's commit, authorship preserved), re-homed onto current beta and run through our flow.
The bug
gateway-pre-start.sh's token predicate checked for keys literally namedenv/file/exec, but OpenClaw's canonical SecretRef uses{source, provider, id}(the source value is env/file/exec). So the predicate failed to recognize a valid ref and clobbered a secret-managedgateway.auth.tokenwith a random literal on every gateway start — confirmed on-device.The fix
Recognize the canonical
{source, provider, id}shape (source ∈ env/file/exec, non-empty string provider+id, exact key set) across all four places the predicate is mirrored (gateway-pre-start.shPython,install.sh,install-x64.sh,src/lib/gateway-proxy.ts), preserving the ref instead of overwriting it. Also hardensgetGatewayToken()to return""for an unresolved SecretRef/${ENV}rather than serialising it into the browser.Verified on the Jetson (aarch64)
tsc --noEmit: clean (no errors in changed files; matches beta baseline).gateway-pre-start-token.test.ts,gateway-proxy.test.ts,ai-models/configure.test.ts).