Skip to content

fix: path set resets numbers to zero for blank values - #178692

Merged
steipete merged 20 commits into
openclaw:mainfrom
LinzeShi:daily/2026-10-20
Oct 26, 2026
Merged

steipete merged 20 commits into
openclaw:mainfrom
LinzeShi:daily/2026-10-20

Conversation

@LinzeShi

@LinzeShi LinzeShi commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: an empty or whitespace-only numeric replacement in openclaw path set silently overwrites the existing number with zero.

User Impact

Blank numeric replacements return parse-error, exit unsuccessfully, and leave the file unchanged. An explicit 0 still writes zero; valid numeric syntax and empty string fields retain their behavior.

Why This Change Was Made

JavaScript converts blank text to zero. Classify blank input as nonnumeric in the shared numeric coercion owner and reuse its existing finite-number rejection. The CLI regressions cover JSONC and JSONL at the file-writing boundary, and the command documentation states how to write zero deliberately.

Thanks @LinzeShi for the original repair and before/after CLI evidence. The original contributor commit is preserved.

Evidence

  • Four actual CLI cases fail on main 0dc12b926cf8a9e3fc693e6fc472fc1c7d4d61a5: empty/whitespace input for JSONC/JSONL exits successfully and writes zero. The repaired tests assert exit 1, the existing structured error, and unchanged bytes.
  • Final integrated head 9df3c4085c9330c15491bf1d62d87cd572834c05 passes all 123 CLI and universal tests with one worker. Numeric controls include 0, 1e2, 0x10, 1., and padded 2.
  • The contributor's official Windows CLI ten-command replay showed zero overwrites before the fix and parse-error with unchanged files afterward, while valid numeric syntax and empty string values remained supported. This is retained contributor evidence; a fresh installed CLI build was not repeated on this Mac. Local regression tests cover the repository CLI command boundary.
  • Matching extension type-aware oxlint, oxfmt, and scoped diff checks pass. Independent Codex review with complete owner/test/documentation context found no actionable P0–P2 findings.
  • Production +1/-1 (net 0); tests +25/-0; docs +2/-1. The original guard is simplified to one expression; blank-input coverage reuses the CLI rejection table instead of duplicating unit setup.

Retained contributor capture: clean Windows base 63444538b5d8 versus clean fixed commit 5f19fd19c904, Node 24.19.0, isolated home/config/state and disposable files. Both build stamps matched their heads with inputsClean: true. Final-head regression results are listed above.

Captured CLI reproduction and output

Each case starts from this file:

{"retries":3,"label":"keep"}

The reproduction launches the standard CLI through pnpm. An argv array preserves the actual empty string on Windows:

spawn(process.execPath, [
  pnpmJs, "--silent", "openclaw", "path", "set",
  "oc://settings.json/retries", "",
  "--file", fixtureFile, "--json"
], { cwd: checkout, env: isolatedEnv, windowsHide: true });

JSONL uses oc://settings.jsonl/L1/retries. The whitespace case passes " \t " as the replacement.

Base stdout (only the temporary path is normalized):

{
  "ok": true,
  "dryRun": false,
  "bytesWritten": 29,
  "fsPath": "<fixture>/settings.json"
}

Base exit code: 0. File afterward:

{"retries":0,"label":"keep"}

Fixed stdout:

{
  "ok": false,
  "reason": "parse-error",
  "detail": "cannot coerce \"\" to number"
}

Fixed exit code: 1. File afterward, byte-for-byte identical to the original:

{"retries":3,"label":"keep"}

Focused test command:

pnpm test extensions/oc-path/src/oc-path/tests/universal.test.ts --maxWorkers=1

Enforced security review still requires a maintainer approval for this head. Its notice flags src/gateway/tool-resolution-authority.ts in the integrated history.

@clawsweeper

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

@LinzeShi
LinzeShi marked this pull request as ready for review October 20, 2026 19:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T18:10:59.053790Z
We couldn’t complete this review. Comment @codex review to try again.
9df3c40 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Reject blank numeric replacements in path edits before writing the file.

Example: Run openclaw path set oc://settings.json/retries "" against {"retries":3}.

  • Before: The command succeeds and replaces 3 with 0.
  • After: The command exits 1 with parse-error and preserves the original file.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused repair is sound, but the historical runtime capture is no longer inspectable.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A blank replacement silently changes an existing number to zero while reporting success.
Reason: Preventing unintended numeric overwrites warrants this narrow plugin-local repair.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: current main still permits silent blank-to-zero overwrites, and this PR provides a focused shared-owner repair with no identified code defect.

Priority: P2
Reviewed head: 9df3c4085c9330c15491bf1d62d87cd572834c05

Before merge

  • Add real behavior proof - LinzeShi's previously accepted Windows replay exercised the correct CLI scenario, but the current body and discussion retain only its summary rather than inspectable output or an artifact; restore that existing capture with sensitive addresses and credentials redacted, without requiring a fresh full-app run. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Await maintainer action - Approve the enforced security-sensitive review for head 9df3c40 after reviewing the flagged surface.

Findings

None.

Tests

  • Missing end-to-end proof: Restore the existing Windows CLI capture showing blank JSONC/JSONL refusal, unchanged file bytes, and successful numeric controls.
Agent review details

How this fits together

The optional oc-path plugin passes CLI replacement text through type-directed JSONC/JSONL coercion, then writes the edited bytes only after successful validation.

flowchart TD
A[Path set CLI] --> B[Load structured file]
B --> C[Resolve existing leaf]
C --> D[Shared numeric coercion]
D --> E[Reject blank input]
D --> F[Write valid replacement]
Loading

Technical review

Best possible solution:

Keep blank-input rejection in the existing shared coercion owner and preserve the CLI's unchanged-file refusal contract.

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

Current-main source establishes the blank-to-zero conversion through the shipped CLI's write path; this read-only review executed no target code.

Is this the best way to solve the issue?

The one-expression repair fixes the shared JSONC/JSONL producer without adding a parallel validator or narrowing accepted nonblank numeric syntax.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7d0c51217491.

Provenance checked

  • Shared JSONC/JSONL numeric coercion changes intended behavior with a stated reason (e3b33a2: The verified plugin move retained type-directed coercion and Number(valueText); its merged PR establishes plugin ownership without an intentional blank-to-zero contract.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Current main retains the defect: The numeric coercion branch directly calls Number(valueText), which converts empty and whitespace-only strings to zero. (extensions/oc-path/src/oc-path/universal.ts:565, 7d0c51217491)
  • Shared-owner repair: The introduced expression classifies blank text as NaN and reuses finite-number rejection; string values and nonblank numeric conversion retain their existing paths. (extensions/oc-path/src/oc-path/universal.ts:565, 9df3c4085c93)
  • Refusal precedes file mutation: The CLI catches OcPathEditError, sets exit code 1, and returns before fs.writeFile; added JSONC/JSONL cases assert structured refusal and unchanged source bytes. (extensions/oc-path/src/cli.ts:359, 9df3c4085c93)
  • Broad diff reconciled with merged main history: The verified shared ancestor of fetched main and this head is 0969d13, confirmed as merged by refactor: deslop UI, MCP and config fixtures #184815. Comparing that ancestor with the head leaves only the path implementation, its two test files, and its documentation; the broader security, memory, and UI hunks are inherited upstream work. (9df3c4085c93)
  • Historical ownership and intent: refactor: replace core oc-path with bundled plugin #79328 deliberately placed this capability in the bundled plugin. Its plugin-move commit retained Number(valueText); subsequent merged history includes Gio Della-Libera's YAML support and LinzeShi's numeric round-trip repair. Local historical blame encountered a missing blob, so commit patches were checked through REST instead. (extensions/oc-path/src/oc-path/universal.ts, e3b33a26cdb1)
  • Retained proof record: The current body credits LinzeShi's Windows CLI replay and reports matching before/after behavior, but contains neither its terminal capture nor an artifact link; the previous review records historical acceptance. (9df3c4085c93)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Labels

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦞 diamond lobster.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • remove proof: sufficient: Current real behavior proof status is insufficient, not sufficient.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🧂 unranked krab, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P2: An empty script argument can silently overwrite a numeric file value, with impact limited to explicit path edits.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦞 diamond lobster.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-20T19:24:03.892Z sha 5f19fd1 :: needs maintainer review before merge. :: none

Reviewed October 26, 2026, 2:18 PM ET / 18:18 UTC (Revision 2).

LinzeShi and others added 17 commits October 26, 2026 01:14
…penclaw#184142)

* test(memory): define paired embedding prefix contract

* fix(memory): format Nemotron inputs and refresh aliased vectors

* test(memory): narrow the embedding fixture provider

* fix(memory): honor explicit document formats in Gemini

* fix(memory): distinguish explicit raw document identity

* fix(memory): preserve vectors when adopting Ollama digests
…4775)

sortAndLimitSessionEntries used compareSessionEntryPairs as its comparator, which derived pin and timestamp facts on every comparison and allocated a lazily built pinnable set and closure for each list.

The sort now computes each entry's timestamp and effective pin once per list into typed arrays, sorts indices, and maps back. Ordering, including ties, pins and activity sorting, is unchanged. compareSessionEntryPairs loses its optional pinnable callback.

Evidence, 11 interleaved pairs: sort-path allocation 12,291 -> 10,845 bytes/list (-11.8%, 9/11 better); whole-list allocation flat; CPU inconclusive. The warm benchmark reuses cached selections, so the live effect is likely larger but unproven. 17 focused tests pass. Runtime +3 LOC.
Register the documented session-actor receipt measurement as an exact Knip entry so unused-file analysis recognizes the maintained command without altering runtime behavior.
…kends, and session jobs can't yield (openclaw#183987)

* fix(cron): scheduled runs take their automations scope and requester yield from the execution context

Scheduled occurrences on embedded and CLI runtimes read the automations scope
from context.toolPolicy.automations: the tool is restricted to the run's own job
(status, list, get, remove, runs), and a run with no scope gets none. The CLI
loopback now carries that self scope, which replaces the automations denial
0d5.10 left on scheduled CLI runs. A self-and-parent-wake scope offers the same
self actions; the parent wake action is a follow-up.

sessions_yield is refused for every scheduled placement, so session: jobs match
isolated ones. The exec target pin also reads from the context. Ingress turns
keep their existing CLI surface and yield.

Refs openclaw#178812

* fix(cron): session-target runs keep sessions_yield listed and refuse the call

A session: run shares its session's tool catalog, and CLI backends hash that
catalog for native session reuse, so the definition stays listed and the
scheduled callback refuses the call. Child and detached runs still get no
sessions_yield. Adds coverage that a CLI run's retained self-scoped automations
tool refuses its own job's removal once the run closes, including a close
during an awaited Gateway call.

* fix(agents): keep the scheduled exec pin on its existing tool-policy source

The context copies the same stored exec target, so reading it there changed
nothing; keep the existing source until a consumer needs the context's pin.

* test(cron): CLI self-removal through the real Gateway cron handler

A scheduled CLI run's self-scoped automations tool removes its own job through
the in-process Gateway dispatch and cron.remove handler, and the job stays when
the run settles while the removal awaits the store.

* test(cron): pin the self-and-parent-wake scope to self actions; name session-job losses in Doctor

The context can name a parent wake for an owner child, but the wake action is
deferred to the automations wake design; a test pins that both runtimes offer
own-job self actions only. Doctor's access review describes the CLI automations
narrowing and the sessions_yield loss for session-target jobs, under a heading
that no longer attributes every loss to creator authority.

* test(cron): CLI self-removal settles against the real cron service and store

The scheduled CLI run's automations tool removes its own job through the real
Gateway cron handlers, CronService and store. When the run settles while the
service's removal is held before persistence, the removal is refused and the
stored job is unchanged.
…penclaw#184120)

Sanitize completion installation status paths and suppress unsafe shell reload hints while preserving literal profile writes and ordinary shell commands.

Validation: the regression fails on base and all 30 runtime tests plus 13 CLI consumer tests pass on the reviewed head. Targeted lint/format and exact-head CI pass.

Co-authored-by: Alix-007 <[email protected]>
…claw#184157)

* fix(sessions): preserve agent transcript IDs across automatic resets

Append the existing reset boundary at admitted command persistence so idle and daily resets keep historical messages indexed. Preserve terminal recovery rotation and explicit session-ID resume behavior.

Co-authored-by: SeungTaek Lim <[email protected]>

* fix(sessions): preserve Gateway automatic reset boundaries

Keep the durable transcript ID through Gateway agent preparation, share reset metadata cleanup, and commit the boundary with the renewed lifecycle. Preserve the triggering RPC source during cleanup and the ended transcript window for hooks.

Co-authored-by: SeungTaek Lim <[email protected]>

* fix(sessions): preserve reset consumer contracts

Keep Gateway explicit-ID expiry semantics while preserving transcript IDs. Align voice and Gateway consumer assertions, adapt the in-memory lifecycle fixture, and retain the original patch accessor binding used by restart-settlement tests.

* test(gateway): decouple accessor fixture types

Define the fixture dependency surface from the accessor contracts instead of importing its parent mock module. This removes the type-only import cycle without changing fixture execution or production code.

---------

Co-authored-by: SeungTaek Lim <[email protected]>
…claw#184842)

Transfer the fresh scanner result map to reconciliation, reuse tracked path membership, and avoid repeated logical-path lookups on unchanged files. Preserve failed-read retries and cached directory fingerprints.
…w#176941)

Prevent the replacement Stop button from accepting an accidental second Send tap for its first 700 ms, while retaining deliberate cancellation and the existing abort owner.

Preserve the shared native composer path, view-bound task cancellation/reset and voice-note behavior. Existing native production-timing red/green proof is retained; the web Control UI is unchanged.

Co-authored-by: Solvely-Colin <[email protected]>
Co-authored-by: Marvinthebored <[email protected]>
…nclaw#184672)

Keep accepted workspace preparation pending during temporary source contention, sharing the existing wait budget through checkout and final session binding without repeating setup.

Fixes openclaw#184272.
…claw#183770)

Load private conversations in native macOS chat through the existing private session-entry document route instead of the public conversation document. Preserve canonical mounted return paths, escaped drafts, authentication and native draft/focus ownership.

Validation: five exact-blob Foundation route tests, SwiftLint and repository-pinned SwiftFormat pass; exact-head CI 40257600942 is green. Signed contributor native evidence shows the baseline unavailable document and the final WebView receiving a fresh synthetic chat.inject message. This maintenance pass did not relaunch the native session.

Co-authored-by: pstarkgit <[email protected]>
…penclaw#184754)

* perf(ui): trim Settings search dependencies

Move shared Memory keys into config sections and register only shared session labels for Settings targets, preserving the full catalog order and synchronous registration.

* test(ui): measure native Settings root cold loads

* perf(ui): keep Settings search out of optional session chunk

Share the dependency-free dedupe helper through the existing boot group and keep shared session English copy with the existing English group. Settings retains its search labels without evaluating optional session UI.

* test(ui): await lazy chat details before assertions
@openclaw-barnacle openclaw-barnacle Bot added app: macos App: macos app: web-ui App: web-ui gateway Gateway runtime extensions: memory-core Extension: memory-core cli CLI command changes scripts Repository scripts commands Command implementations agents Agent runtime and tooling extensions: codex extensions: google extensions: ollama labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ Maintainer security changes approved

A maintainer approved this revision with an explicit security approval comment.

A later push requires a fresh approval comment for an external contributor's PR.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@steipete

Copy link
Copy Markdown
Contributor

/allow-security-sensitive-change

@steipete
steipete merged commit 2944740 into openclaw:main Oct 26, 2026
132 of 149 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
Reject blank numeric path values without converting them to zero.

Regression tests cover the original defect and expected supported behavior.

Co-authored-by: LinzeShi <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 28, 2026
Reject blank numeric path values without converting them to zero.

Regression tests cover the original defect and expected supported behavior.

Co-authored-by: LinzeShi <[email protected]>

(cherry picked from commit 2944740)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 298cb55f8ea6792c3dcd1927e7bb8340b6198bb7)
RomneyDa added a commit that referenced this pull request Oct 28, 2026
Reject blank numeric path values without converting them to zero.

Regression tests cover the original defect and expected supported behavior.

Co-authored-by: LinzeShi <[email protected]>

Beta.5 baseline adaptation: Retain the native beta.5 owners, fixtures and public contracts; add focused regression controls and bounded fixture extraction; apply checkout formatting.

(cherry picked from commit 2944740)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 2714b9a708411ecdacc6181251a35a517eaed7e3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: ios App: ios app: macos App: macos app: web-ui App: web-ui clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: codex extensions: google extensions: memory-core Extension: memory-core extensions: oc-path extensions: ollama gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts security-sensitive-changed size: XL 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.

8 participants