Skip to content

fix(config): preserve secret ownership when configuration rows move - #118149

Merged
steipete merged 1 commit into
mainfrom
codex/fix-110658-redacted-array-identity
Aug 2, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-110658-redacted-array-identity

Conversation

@steipete

@steipete steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Closes #110658

What Problem This Solves

Fixes an issue where editing configuration arrays in the Control UI could silently assign a deleted or reordered row secret to another row. The original report reproduced the corruption with agent entries; the same shipped and current defect also affects sensitive hook mapping session keys.

Why This Change Was Made

Restore redacted values by each uniquely identifiable array item instead of its previous position. Keep positional behavior only for genuinely unidentifiable or ambiguous rows, reserve already-identified source rows so their secrets cannot be reused, and preserve authored environment-template identity behavior. This repairs the single shared configuration owner used by config set, apply, and patch without adding compatibility shims or exposing secrets.

User Impact

Removing or reordering a configuration row no longer changes which secret belongs to the remaining row. Mixed arrays with optional IDs, duplicate IDs, nested arrays, scalar arrays, new rows, explicit new secrets, and environment-authored IDs retain safe behavior.

Evidence

  • Confirmed the same positional corruption on the latest shipped stable release, beta, and current main.
  • Before the fix, owner regressions failed for deletion, reorder, mixed optional-ID arrays, and guessing/hinted restore paths; real Gateway WebSocket config.get/config.set calls persisted the wrong secret.
  • After the fix: 103 focused configuration restore, redaction, and generated-schema regressions passed.
  • Three real Gateway WebSocket-to-isolated-disk regressions passed for deletion, reorder, and deleting an optional-ID sibling.
  • On a Linux Blacksmith Testbox, built the production Control UI, launched a real isolated Gateway, drove Chromium through Settings, and verified the submitted WebSocket payload remained redacted while the persisted remaining hook mapping retained its own original secret.
  • Full Linux pnpm check:changed passed, including production/test typechecks, formatting, lint, import cycles, and boundary guards.
  • A fresh independent xhigh reviewer found and helped correct the mixed-ID edge case before approving; fresh xhigh autoreview reported no actionable findings.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Aug 2, 2026
@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. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 3:45 PM ET / 19:45 UTC.

ClawSweeper review

What this changes

Changes configuration secret restoration so uniquely identified objects in edited arrays retain their own redacted value after deletion or reordering instead of inheriting the value formerly at the same array position.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this PR open for explicit maintainer review: current main restores redacted array entries by position, while the branch matches uniquely identified rows by id at the shared write boundary and adds focused owner-preservation coverage. The linked report remains valid; the protected maintainer label and still-running exact-head checks require human handling rather than cleanup closure.

Priority: P1
Reviewed head: 81058cb5d7765f5a070636856594f10fdcba8dfc
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused shared-boundary repair with strong regression coverage and reported real behavior proof; protected owner review and pending checks are workflow gates, not patch defects.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body reports real Gateway WebSocket-to-disk regressions and a production Control UI/Gateway browser run, and the supplied exact-head checks include successful Real behavior proof runs.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body reports real Gateway WebSocket-to-disk regressions and a production Control UI/Gateway browser run, and the supplied exact-head checks include successful Real behavior proof runs.
Evidence reviewed 6 items Current-main defect: Current main's mapRedactedArray passes each incoming array item the original item at the same index. Both lookup and guessing restoration paths consequently restore redacted nested values from positional entries, which establishes the reported deletion/reorder failure mechanism.
Shared owner boundary: config.set and config.apply use the common raw-config validation helper, while config.patch restores the merged configuration through the same restoreRedactedValues owner. A repair in this module therefore covers all three write routes without UI-only compensation.
Proposed repair: The branch indexes usable object id values, restores a row from a unique matching original row, and reserves uniquely matched originals before positional fallback so a retained identified row cannot reuse another row's secret.
Findings None None.
Security None None.

How this fits together

The Gateway returns redacted configuration to the Control UI and restores placeholders before saving operator edits. The shared restoration path feeds config.set, config.apply, and config.patch, so its array matching rules determine which persisted secret or session key follows each edited configuration row.

flowchart LR
  A[Persisted configuration] --> B[Gateway redacted snapshot]
  B --> C[Control UI edits arrays]
  C --> D[Gateway write request]
  D --> E[Restore redacted values]
  E --> F[Match unique row identities]
  F --> G[Validated persisted configuration]
Loading

Decision needed

Question Recommendation
Should the config owner approve the shared id-based restoration rule, including positional fallback for ambiguous or environment-authored identities, once the current head's remaining checks are green? Approve shared repair: Approve the identity-aware restoration rule after remaining exact-head checks pass, retaining positional fallback only where a stable identity is unavailable or ambiguous.

Why: The patch is a focused repair for silent secret/session-key misassociation, but it changes the generic configuration write boundary and carries the repository's protected maintainer label.

Before merge

  • Resolve merge risk (P1) - The generic restoration rule changes the write semantics for every configuration object array with a unique id; the intended compatibility boundary is that only uniquely identifiable rows use identity matching, while ambiguous or unidentifiable rows remain positional.
  • Resolve merge risk (P1) - bestSolution is supported by focused source and real-behavior evidence, but the protected maintainer label and in-progress exact-head checks should clear through the normal owner review path before merge.
Agent review details

Security

None.

PR surface

Source +51, Tests +380. Total +431 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 80 29 +51
Tests 2 380 0 +380
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 460 29 +431

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #110658
Summary: This PR is the concrete candidate repair for the linked report's same positional redacted-array restoration defect.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Merge the shared identity-aware restoration path after the config owner confirms its documented fallback boundary and the remaining exact-head checks finish successfully; do not add a separate Control UI workaround or a parallel config-write path.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Merge the shared identity-aware restoration path after the config owner confirms its documented fallback boundary and the remaining exact-head checks finish successfully; do not add a separate Control UI workaround or a parallel config-write path.

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

Yes—source inspection gives a high-confidence current-main path: the redacted snapshot preserves rows while mapRedactedArray restores by their current array index, so deleting or reordering uniquely identified rows misassociates sensitive values. The linked report and PR body also describe Gateway/UI reproductions, but this read-only review did not execute them.

Is this the best way to solve the issue?

Yes—the branch repairs the shared restore owner used by raw set/apply and merged patch writes, rather than compensating in the Control UI. Matching unique IDs and reserving those originals is the narrowest canonical fix; UI-only matching would leave other Gateway write routes inconsistent.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2970ccb53fb7.

Labels

Label changes:

  • add P1: Deleting or reordering a normal configuration row can silently assign a credential or hook session key to the wrong owner through the shared Gateway write path.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports real Gateway WebSocket-to-disk regressions and a production Control UI/Gateway browser run, and the supplied exact-head checks include successful Real behavior proof runs.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports real Gateway WebSocket-to-disk regressions and a production Control UI/Gateway browser run, and the supplied exact-head checks include successful Real behavior proof runs.

Label justifications:

  • P1: Deleting or reordering a normal configuration row can silently assign a credential or hook session key to the wrong owner through the shared Gateway write path.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports real Gateway WebSocket-to-disk regressions and a production Control UI/Gateway browser run, and the supplied exact-head checks include successful Real behavior proof runs.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports real Gateway WebSocket-to-disk regressions and a production Control UI/Gateway browser run, and the supplied exact-head checks include successful Real behavior proof runs.

Evidence

What I checked:

  • Current-main defect: Current main's mapRedactedArray passes each incoming array item the original item at the same index. Both lookup and guessing restoration paths consequently restore redacted nested values from positional entries, which establishes the reported deletion/reorder failure mechanism. (src/config/redact-snapshot.ts:619, 2970ccb53fb7)
  • Shared owner boundary: config.set and config.apply use the common raw-config validation helper, while config.patch restores the merged configuration through the same restoreRedactedValues owner. A repair in this module therefore covers all three write routes without UI-only compensation. (src/gateway/server-methods/config.ts:486, 2970ccb53fb7)
  • Proposed repair: The branch indexes usable object id values, restores a row from a unique matching original row, and reserves uniquely matched originals before positional fallback so a retained identified row cannot reuse another row's secret. (src/config/redact-snapshot.ts:644, 81058cb5d776)
  • Regression and boundary coverage: The branch adds unit coverage for deletion, reorder, mixed/duplicate/environment identities, nested arrays, and scalar fallback, plus Gateway config.set persistence tests for hook mapping session keys. (src/config/redact-snapshot.restore.test.ts:257, 81058cb5d776)
  • Feature-history provenance: Blame attributes the current positional mapper and its Gateway restore call sites to the recent current-main commit below, making its author the strongest available routing candidate. Broader history and the release blob could not be fully read because this partial checkout attempted an unavailable promisor fetch. (src/config/redact-snapshot.ts:619, efaf46c677c0)
  • Release ancestry check: The stated latest release commit is an ancestor of current main. The locally available tag tree could not supply the historical source blob without network access, so this review does not independently claim the precise release implementation beyond the supplied reproduction context. (2d2ddc43d0dc)

Likely related people:

  • Shakker: Current-main blame assigns the positional array-restoration logic and the shared Gateway restoration call sites to this recent config-area commit. (role: recent area contributor; confidence: medium; commits: efaf46c677c0; files: src/config/redact-snapshot.ts, src/gateway/server-methods/config.ts)

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.

@steipete
steipete merged commit c79dcff into main Aug 2, 2026
131 of 140 checks passed
@steipete
steipete deleted the codex/fix-110658-redacted-array-identity branch August 2, 2026 21:14
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 2, 2026
* origin/main:
  feat(gateway): track event-loop degradation persistence and add concurrency benchmark (#118193)
  fix(config): preserve secret ownership when configuration rows move (#118149)
  fix(cron): deliver failure alerts after persistence (#118200)
  chore(lint): clear 172 lint:all baseline violations in five batches (#118098)
  perf(gateway): remove streaming hot-path rescans (#118192)
  test(gateway): use in-memory task registry (#118191)
  test(macos): fix three races in the bounded process suites (#118196)
  refactor(migrate-hermes): consolidate test fixtures (#118182)
  test(android): share Wear transport fixtures (#118177)
  test(ui): deduplicate control UI e2e setup (#118180)
  fix(plugins): unblock prerelease validation (#118103)
  test(cli): reduce redundant process launches (#118141)
  test(gateway): compact terminal observer fixtures (#118179)
  fix(agents): make requested threads sidebar-visible (#118073)
  test(plugins): canonicalize native resolver fixtures (#118174)
  test: deduplicate agent runner fixtures (#118176)
  refactor(policy): consolidate doctor test fixtures (#118173)
  fix(plugins): remove disabled channel plugin configuration on uninstall (#118127)
  refactor(matrix): consolidate monitor test fixtures (#118175)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* origin/main:
  feat(gateway): track event-loop degradation persistence and add concurrency benchmark (openclaw#118193)
  fix(config): preserve secret ownership when configuration rows move (openclaw#118149)
  fix(cron): deliver failure alerts after persistence (openclaw#118200)
  chore(lint): clear 172 lint:all baseline violations in five batches (openclaw#118098)
  perf(gateway): remove streaming hot-path rescans (openclaw#118192)
  test(gateway): use in-memory task registry (openclaw#118191)
  test(macos): fix three races in the bounded process suites (openclaw#118196)
  refactor(migrate-hermes): consolidate test fixtures (openclaw#118182)
  test(android): share Wear transport fixtures (openclaw#118177)
  test(ui): deduplicate control UI e2e setup (openclaw#118180)
  fix(plugins): unblock prerelease validation (openclaw#118103)
  test(cli): reduce redundant process launches (openclaw#118141)
  test(gateway): compact terminal observer fixtures (openclaw#118179)
  fix(agents): make requested threads sidebar-visible (openclaw#118073)
  test(plugins): canonicalize native resolver fixtures (openclaw#118174)
  test: deduplicate agent runner fixtures (openclaw#118176)
  refactor(policy): consolidate doctor test fixtures (openclaw#118173)
  fix(plugins): remove disabled channel plugin configuration on uninstall (openclaw#118127)
  refactor(matrix): consolidate monitor test fixtures (openclaw#118175)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

Control UI can restore redacted array values to the wrong item after removing a row

1 participant