Skip to content

fix(cli): redact sessionKey from starter CLI JSON output - #8

Merged
steipete merged 1 commit into
openclaw:mainfrom
SebTardif:fix/f002-redact-cli-json
Sep 5, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
SebTardif:fix/f002-redact-cli-json

Conversation

@SebTardif

@SebTardif SebTardif commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

The standalone CLI starters now apply the cookbook's established redaction policy to result, status, and cancellation JSON. Local helpers keep the examples independently copyable; assistant text remains verbatim.

Independently rebased onto main at 6deea84fc44138676bdf0d4b99dae98ec33d43ff. The CLI source and README exactly match the previously proven combined resolution with the already-landed #7 lifecycle. This PR has no changelog changes; #12 owns the complete Unreleased section. Contributor credit is preserved in the commit.

Previous live compiled-CLI proof for the same output behavior: #8 (comment)

@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

🦞👀
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 added P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. 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 Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 4:32 PM ET / 20:32 UTC.

ClawSweeper review

What this changes

The two standalone CLI starters mask sensitive fields in structured JSON output, with local helpers, documentation, and regression tests.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main still prints unredacted starter JSON. The focused patch follows the existing recipe policy, and the recorded compiled-CLI proof supports the intended masking behavior. No blocking defect was found.

Likely related people: Vincent Koc and SebTardif (low-confidence routing suggestions from relevant merged history).

Priority: P2
Reviewed head: a4a28b5d4be65af3f2a003f8ef243a47885fbb36

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable patch with relevant compiled-CLI before/after evidence and no blocking findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The captured macOS/Node run exercised both real compiled CLI entrypoints with the documented workspace shim and observed the synthetic session value replaced by [REDACTED]. This supports the changed serialization boundary; Gateway behavior is outside the claim, and independent comparison to the earlier proof revision was unavailable.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured macOS/Node run exercised both real compiled CLI entrypoints with the documented workspace shim and observed the synthetic session value replaced by [REDACTED]. This supports the changed serialization boundary; Gateway behavior is outside the claim, and independent comparison to the earlier proof revision was unavailable.
Evidence reviewed 8 items Current main still needs the fix: The fetched main revision prints quickstart results directly through JSON.stringify; the coding-agent CLI likewise prints result, cancellation, and status objects without masking. The merged cancellation work does not implement this output change.
Established redaction policy: The recipe wrapper already masks token, password, secret, authorization, and key-named fields recursively. Both new helpers match this implementation. README.md and CONTRIBUTING.md require independently copyable starters, which explains keeping the helpers local.
Introduced output boundary: The verified base-to-head diff changes four JSON output sites and adds two local helpers. SDK request parameters, session state, streamed assistant text, and cancellation control flow remain unchanged. No dependency, workflow, or persisted-format change is introduced.
Findings None None.
Security None None.

How this fits together

The cookbook’s terminal starters turn prompts into SDK runs and print their events and results. This change filters structured results before terminal output while preserving the session values sent to the SDK.

flowchart LR
  A[Prompt and session settings] --> B[CLI starter]
  B --> C[SDK run]
  C --> D[Structured results]
  D --> E[Sensitive field masking]
  E --> F[Terminal output]
  C --> G[Assistant text]
  G --> F
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test growth production +64 net lines; tests +61 lines The two local helpers preserve independently copyable starters, with three tests covering policy alignment and both executable entrypoints.

Technical review

Best possible solution:

Apply the established masking policy at each starter’s JSON display boundary while keeping SDK inputs and streamed text intact.

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

Yes: current-main source passes the SDK result containing sessionKey directly to JSON.stringify in both starters. The recorded compiled-CLI comparison corroborates the exposure; this review did not execute target code.

Is this the best way to solve the issue?

Yes: local copies of the existing recipe redactor are a narrow fit for independently copyable starters, and the patch changes display output without mutating SDK state.

AGENTS.md: not found in the target repository.

Codex review notes: model internal, reasoning medium; reviewed against 6deea84fc441.

Labels

Label justifications:

  • P2: This is a bounded correction to sensitive structured-output handling in two cookbook starters.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured macOS/Node run exercised both real compiled CLI entrypoints with the documented workspace shim and observed the synthetic session value replaced by [REDACTED]. This supports the changed serialization boundary; Gateway behavior is outside the claim, and independent comparison to the earlier proof revision was unavailable.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured macOS/Node run exercised both real compiled CLI entrypoints with the documented workspace shim and observed the synthetic session value replaced by [REDACTED]. This supports the changed serialization boundary; Gateway behavior is outside the claim, and independent comparison to the earlier proof revision was unavailable.

Evidence

What I checked:

  • Current main still needs the fix: The fetched main revision prints quickstart results directly through JSON.stringify; the coding-agent CLI likewise prints result, cancellation, and status objects without masking. The merged cancellation work does not implement this output change. (sdk/quickstart/src/index.ts:41, 6deea84fc441)
  • Established redaction policy: The recipe wrapper already masks token, password, secret, authorization, and key-named fields recursively. Both new helpers match this implementation. README.md and CONTRIBUTING.md require independently copyable starters, which explains keeping the helpers local. (recipes/_shared/run-main.ts:21, a4a28b5d4be6)
  • Introduced output boundary: The verified base-to-head diff changes four JSON output sites and adds two local helpers. SDK request parameters, session state, streamed assistant text, and cancellation control flow remain unchanged. No dependency, workflow, or persisted-format change is introduced. (sdk/coding-agent-cli/src/index.ts:113, a4a28b5d4be6)
  • Recorded compiled-CLI proof: The captured comment fix(cli): redact sessionKey from starter CLI JSON output #8 (comment) records both compiled entrypoints running on macOS with Node 24.20.0 and the documented workspace SDK shim. Baseline output exposed a synthetic session value; after-fix output contained [REDACTED] and omitted that value. This exercises the actual terminal serialization owner, without claiming Gateway/provider validation. (3f7df4f590a6)
  • Proof continuity and inspection limitation: The captured PR body explicitly states that the CLI source and README match the previously proven resolution. An independent comparison with that proof revision could not complete because the historical object was unavailable and GitHub DNS resolution failed. The supplied proof classification is preserved; this is a reviewer limitation, not missing contributor evidence. The immediately preceding completed review covered the current head and retained no findings. (a4a28b5d4be6)
  • Documented SDK boundary: The starters directly import @openclaw/sdk, which this workspace supplies through its own shim. README.md documents that arrangement; the shim returns sessionKey in run results. The reviewed behavior is local output formatting and does not claim compatibility validation against an external Gateway or Codex implementation. (README.md:21, a4a28b5d4be6)

Likely related people:

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

History

Review history (16 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-02T18:34:40.222Z sha 2b8206c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T22:24:05.517Z sha 2b8206c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-03T11:05:36.284Z sha 2b8206c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-03T13:29:33.204Z sha 2b8206c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-04T15:00:07.201Z sha 2b8206c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-05T08:00:37.359Z sha 2b8206c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-05T20:08:07.101Z sha 3f7df4f :: needs maintainer review before merge. :: none
  • reviewed 2026-09-05T20:27:54.064Z sha a4a28b5 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 31, 2026
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Verified at 3f7df4f590a6527c65ac1b4d89effca1bb72cc7a on macOS with Node 24.20.0 and the documented workspace SDK shim.

Set OPENCLAW_SESSION_KEY=cookbook-synthetic-session, then ran the real compiled entrypoints:

node sdk/coding-agent-cli/dist/index.js 'Cookbook proof'
node sdk/quickstart/dist/index.js 'Cookbook proof'

Both completed normally and printed "sessionKey": "[REDACTED]"; neither printed the synthetic value. On baseline afff526464987148d792fddea8c63626cd8f0d11, both compiled entrypoints printed that value. pnpm check passed, including all 10 tests, formatting, types, lint, documentation, all starter builds, and compiled CLI smokes. Independent autoreview through P2 is clean.

Brought this branch's dependency manifests/lockfile forward to the already-landed main toolchain, documented the JSON-only masking boundary, and added an Unreleased entry crediting @SebTardif. Streamed assistant text remains verbatim. No live Gateway/provider behavior is claimed. Prepared for maintainer approval; not merged.

Apply the established redaction policy to standalone result, status, and cancellation JSON while preserving the cancellation lifecycle already on main. Keep each starter independently copyable.

Release notes are consolidated in PR openclaw#12.

Co-authored-by: Sebastien Tardif <[email protected]>
@steipete
steipete force-pushed the fix/f002-redact-cli-json branch from 3f7df4f to a4a28b5 Compare September 5, 2026 20:24
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Restacked independently onto main 6deea84fc44138676bdf0d4b99dae98ec33d43ff at a4a28b5d4be65af3f2a003f8ef243a47885fbb36.

This PR has no changelog diff; the complete Unreleased section is in #12. The four PRs touch disjoint files and reconstruct the previously proven combined source tree exactly (56576a9cc5b03069b71700b776279ba19763d030).

The full cookbook gate passed (20 tests, formatting, types, lint, docs, all four starter builds, and both compiled CLI smokes). Branch autoreview through P2 is clean. Exact-head CI: https://github.com/openclaw/cookbook/actions/runs/33990013809

Local runs were serialized using short private macOS temp directories after concurrent subprocess timeouts and a too-long tsx socket path. No test timeouts or product code were weakened. No merge or release performed.

@steipete
steipete merged commit 9e1866b into openclaw:main Sep 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants