Skip to content

fix: guard setDeep against empty keys array in Chrome profile decoration#98138

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
zhangLei99586:fix/empty-keys-setdeep
Jul 2, 2026
Merged

fix: guard setDeep against empty keys array in Chrome profile decoration#98138
vincentkoc merged 1 commit into
openclaw:mainfrom
zhangLei99586:fix/empty-keys-setdeep

Conversation

@zhangLei99586

@zhangLei99586 zhangLei99586 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Related: #98465

What Problem This Solves

setDeep() with empty keys creates obj[""] = value via keys[-1] ?? "".

Why This Change Was Made

Add early if (keys.length === 0) return; guard.

User Impact

No user-visible change. Defensive guard.

Evidence

Runtime terminal proof (Node v24.13.1):

screenshot

  • 36/36 tests passed (profiles.test.ts) — setDeep(obj,[],"v") → keys: [ ]

@clawsweeper

clawsweeper Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 1, 2026, 8:25 PM ET / 00:25 UTC.

Summary
The branch adds an early return for empty key arrays in the browser Chrome profile-decoration setDeep helper and removes the empty-string fallback assignment.

PR surface: Source +3. Total +3 across 1 file.

Reproducibility: yes. at source level: current main's final assignment writes obj[""] = value for an empty key array. No high-confidence production user-flow reproduction is shown because all current callers pass non-empty literal paths.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #98465
Summary: The open linked issue is the canonical report for the same private setDeep empty-key behavior, and this PR is the candidate fix.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit ✨ media proof bonus
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] The report is source-level only: current production callers pass non-empty literal paths, so maintainers should decide whether landing defensive no-op semantics is worthwhile without a demonstrated user-flow failure.

Maintainer options:

  1. Decide the mitigation before merge
    Land this narrow guard as the candidate fix for browser: setDeep creates empty-string property on empty keys #98465 if maintainers want empty key paths to be a no-op for the private helper.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] The PR already contains the narrow candidate fix and has no actionable repair findings; the remaining action is maintainer review and merge or close judgment.

Security
Cleared: The diff only changes a private TypeScript object-path helper and adds no dependency, workflow, package, permission, secret, or code-execution surface.

Review details

Best possible solution:

Land this narrow guard as the candidate fix for #98465 if maintainers want empty key paths to be a no-op for the private helper.

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

Yes at source level: current main's final assignment writes obj[""] = value for an empty key array. No high-confidence production user-flow reproduction is shown because all current callers pass non-empty literal paths.

Is this the best way to solve the issue?

Yes for the helper-level behavior: an early return before final indexing is the narrow local fix. A wider caller refactor is not justified because the helper is private and the only current call sites are local non-empty literal paths.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3558391a75fd.

Label changes

Label changes:

  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The contributor's terminal screenshot is sufficient for this non-visual helper change because it shows the after-fix empty-key no-op, normal nested behavior, profile decoration path exercise, and focused test output.

Label justifications:

  • P3: This is a low-risk defensive browser helper fix with no demonstrated user-facing failure in current callers.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The contributor's terminal screenshot is sufficient for this non-visual helper change because it shows the after-fix empty-key no-op, normal nested behavior, profile decoration path exercise, and focused test output.
  • proof: sufficient: Contributor real behavior proof is sufficient. The contributor's terminal screenshot is sufficient for this non-visual helper change because it shows the after-fix empty-key no-op, normal nested behavior, profile decoration path exercise, and focused test output.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The contributor's terminal screenshot is sufficient for this non-visual helper change because it shows the after-fix empty-key no-op, normal nested behavior, profile decoration path exercise, and focused test output.
Evidence reviewed

PR surface:

Source +3. Total +3 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 4 1 +3
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 4 1 +3

What I checked:

Likely related people:

  • Eva: git blame attributes the current setDeep() helper and fallback assignment to the commit that added the browser profile-decoration file in current main history. (role: introduced current helper path; confidence: high; commits: 48974b5765d3; files: extensions/browser/src/browser/chrome.profile-decoration.ts, extensions/browser/src/browser/chrome.ts, extensions/browser/src/browser/chrome.test.ts)
  • obviyus: GitHub commit metadata lists obviyus as the committer for the current-main commit that contains the helper path. (role: committer of introducing commit; confidence: medium; commits: 48974b5765d3; files: extensions/browser/src/browser/chrome.profile-decoration.ts)
  • vincentkoc: The PR timeline shows vincentkoc assigned the item and force-pushed the current contributor branch head for maintainer follow-up. (role: current PR follow-up owner; confidence: medium; commits: c6a5303d666c; files: extensions/browser/src/browser/chrome.profile-decoration.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jun 30, 2026

@zhangLei99586 zhangLei99586 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clawsweeper re-review

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@zhangLei99586 zhangLei99586 force-pushed the fix/empty-keys-setdeep branch from 2c51b19 to 0a2139c Compare July 1, 2026 06:30
@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

1 similar comment
@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

Runtime behavior proof — terminal output from after-fix execution:

proof

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

Runtime behavior proof (terminal output):

proof

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

2 similar comments
@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 1, 2026
@vincentkoc vincentkoc self-assigned this Jul 1, 2026
@vincentkoc vincentkoc force-pushed the fix/empty-keys-setdeep branch from 0a2139c to 342b845 Compare July 2, 2026 00:08
When keys is empty, keys[keys.length - 1] returns undefined, and the
previous ??  fallback would silently create a property with an empty
string key on the target object. Add an early return so empty keys are
a no-op instead of silently polluting the object.
@vincentkoc vincentkoc force-pushed the fix/empty-keys-setdeep branch from 342b845 to c6a5303 Compare July 2, 2026 00:20
@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Jul 2, 2026
@vincentkoc vincentkoc merged commit 273729b into openclaw:main Jul 2, 2026
97 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 2, 2026
* origin/main:
  test(gateway): isolate live release agent state
  test(plugins): repair prerelease validation fixtures
  fix(discord): guard JSON.parse against malformed API response bodies (#97889)
  fix(codex): preserve app approvals in side forks (#98812)
  fix(agents): don't inject A2A turns into isolated-cron sessions_send (#92257) (#92283)
  fix(browser): guard setDeep against empty keys array (#98138)
  docs(telegram): move maintainer decisions into scoped AGENTS.md
  fix(ios): generate light app store screenshots only
  fix(gateway): distinguish reachable gateway from failed status probe (#98183)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 2, 2026
When keys is empty, keys[keys.length - 1] returns undefined, and the
previous ??  fallback would silently create a property with an empty
string key on the target object. Add an early return so empty keys are
a no-op instead of silently polluting the object.
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 3, 2026
When keys is empty, keys[keys.length - 1] returns undefined, and the
previous ??  fallback would silently create a property with an empty
string key on the target object. Add an early return so empty keys are
a no-op instead of silently polluting the object.
sheyanmin pushed a commit to sheyanmin/openclaw that referenced this pull request Jul 8, 2026
When keys is empty, keys[keys.length - 1] returns undefined, and the
previous ??  fallback would silently create a property with an empty
string key on the target object. Add an early return so empty keys are
a no-op instead of silently polluting the object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

2 participants