Skip to content

fix(cli): explain failed local secret resolution - #141395

Merged
obviyus merged 1 commit into
mainfrom
fix/command-secret-local-guidance
Sep 7, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/command-secret-local-guidance

Conversation

@obviyus

@obviyus obviyus commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

When Gateway secret resolution is unavailable and local resolution also fails, strict commands only advised starting the Gateway. The final error now identifies the local failure too and advises checking configured secret sources and Gateway access. Strict rejection, the JSON error shape and the existing Gateway context stay intact; no local error, reference or secret value is added to output.

Validation:

  • The new regression assertion fails on main 4b1f467dff76; five focused strict, local-success and incomplete-snapshot controls pass with the fix.
  • Real source CLI models status --json --check: a missing secret file still exits 1 with both resolution failures explained; a valid local file still exits 0 without a Gateway. Both outputs preserve secret-value masking.
  • Pinned formatting, syntax-only lint, assertion-safety and max-lines ratchets pass. Full type checks remain CI-owned.

Production changes one message with no net line growth. AI-assisted.

@obviyus obviyus self-assigned this Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 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.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS maintainer Maintainer-authored PR labels Sep 7, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 1:34 PM ET / 17:34 UTC.

ClawSweeper review

What this changes

The PR updates CLI secret-resolution errors to explain that local fallback also failed and extends the existing regression test.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still gives incomplete recovery guidance. The focused patch has no actionable correctness findings and remains useful.

Priority: P3
Reviewed head: 5f29c564f29c9d9e72a29c12d0c05059c524c297

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused diagnostic repair with appropriate regression assertions and no identified merge-blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external proof gate; its body reports real models-status failure and local-success runs through the changed resolver, though raw output was not supplied.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external proof gate; its body reports real models-status failure and local-success runs through the changed resolver, though raw output was not supplied.
Evidence reviewed 8 items Introduced change and failure boundary: The final error follows a failed Gateway request and unsuccessful local fallback. The patch changes only its static guidance; the original Gateway error and cause remain intact, and no local exception or secret reference is interpolated.
Current main still needs the change: Fetched main retains the instruction to start the Gateway after local resolution fails; it does not contain the proposed explanation.
Focused regression coverage: The existing strict-failure case now checks both recovery hints and excludes the synthetic environment reference from the error. Adjacent coverage still exercises successful local fallback. These tests were inspected, not executed.
Findings None None.
Security None None.

How this fits together

CLI commands resolve configured secret references through the Gateway, then try local resolution when the Gateway request fails. The resulting configuration lets commands proceed, while unresolved required secrets produce an error.

flowchart TD
  A[CLI command and secret references] --> B[Gateway resolution]
  B -->|Success| E[Resolved command configuration]
  B -->|Failure| C[Local resolution]
  C -->|Success| E
  C -->|Required secrets unresolved| D[Error with recovery guidance]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +4. Total +4 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 1 14 10 +4
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 15 11 +4

Review metrics

None.

Technical review

Best possible solution:

Keep recovery guidance at the shared failure boundary while preserving strict rejection, successful local fallback, and secret masking.

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

Yes, source establishes the path: an unavailable Gateway plus an unresolved required local secret reaches the misleading current-main error. Runtime reproduction was not performed during this read-only review.

Is this the best way to solve the issue?

Yes, updating the existing shared error is a narrow solution, and extending its existing failure test protects the observable guidance without adding a parallel resolution path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2a6df250c911.

Labels

Label changes:

  • add P3: This improves diagnostic recovery guidance without changing credential resolution or command success behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external proof gate; its body reports real models-status failure and local-success runs through the changed resolver, though raw output was not supplied.

Label justifications:

  • P3: This improves diagnostic recovery guidance without changing credential resolution or command success behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external proof gate; its body reports real models-status failure and local-success runs through the changed resolver, though raw output was not supplied.

Evidence

What I checked:

  • Introduced change and failure boundary: The final error follows a failed Gateway request and unsuccessful local fallback. The patch changes only its static guidance; the original Gateway error and cause remain intact, and no local exception or secret reference is interpolated. (src/cli/command-secret-gateway.ts:994, 5f29c564f29c)
  • Current main still needs the change: Fetched main retains the instruction to start the Gateway after local resolution fails; it does not contain the proposed explanation. (src/cli/command-secret-gateway.ts:994, 2a6df250c911)
  • Focused regression coverage: The existing strict-failure case now checks both recovery hints and excludes the synthetic environment reference from the error. Adjacent coverage still exercises successful local fallback. These tests were inspected, not executed. (src/cli/command-secret-gateway.test.ts:687, 5f29c564f29c)
  • Production CLI connection: Model commands load their configuration through the shared command-secret resolver without overriding its strict default, connecting the reported models-status scenario to the changed error owner. (src/commands/models/load-config.ts:30, 5f29c564f29c)
  • Captured validation account: The complete supplied PR body reports a failing pre-fix assertion, five passing focused controls, and real models status --json --check runs: missing-file failure exits 1 with revised guidance, while valid local resolution exits 0 without a Gateway. Raw runtime output is not attached in the captured body. Repository State identifies the author as MEMBER, so the external-contributor proof gate does not apply. (5f29c564f29c)
  • Area-history routing: Current-main file history identifies recent work by weiqinl and repeated maintenance by Peter Steinberger. These are routing signals, not verified introduction attribution. (src/cli/command-secret-gateway.ts, 2a6df250c911)

Likely related people:

  • weiqinl: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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.

@obviyus
obviyus merged commit d4f89ae into main Sep 7, 2026
183 checks passed
@obviyus
obviyus deleted the fix/command-secret-local-guidance branch September 7, 2026 17:41
@obviyus

obviyus commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

Verified landing: d4f89aede2689c8d9eb90645b758c80a4d8cbc52.

Proof: Real source CLI models status --json --check keeps exit 1 for a missing secret file and exit 0 for an available local file without a Gateway. The failure now explains both resolution routes without adding local error details or secret values.

Before After
Failed local resolution ended with Gateway-only advice. The error also names local resolution failure and advises checking configured secret sources and Gateway access.

Five focused controls passed. Exact-head local ClawSweeper passed at tier B with no findings. Required CI passed.

AI-assisted.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
When Gateway secret resolution is unavailable and local resolution also fails, strict commands only advised starting the Gateway. The final error now identifies the local failure too and advises checking configured secret sources and Gateway access. Strict rejection, the JSON error shape and the existing Gateway context stay intact; no local error, reference or secret value is added to output.

Validation:

- The new regression assertion fails on main `aeb9557d4092`; five focused strict, local-success and incomplete-snapshot controls pass with the fix.
- Real source CLI `models status --json --check`: a missing secret file still exits 1 with both resolution failures explained; a valid local file still exits 0 without a Gateway. Both outputs preserve secret-value masking.
- Pinned formatting, syntax-only lint, assertion-safety and max-lines ratchets pass. Full type checks remain CI-owned.

Production changes one message with no net line growth. AI-assisted.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant