Skip to content

fix(secrets): retain confirmed writes when inventory refresh fails - #199414

Merged
vyctorbrzezowski merged 2 commits into
mainfrom
fix/defensive-ui-secrets-confirmed-receipts
Nov 15, 2026
Merged

vyctorbrzezowski merged 2 commits into
mainfrom
fix/defensive-ui-secrets-confirmed-receipts

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: Settings → Secrets treats a confirmed save, completed import or deletion as unfinished when the following inventory refresh fails.

User Impact

Successful changes keep their confirmation and runtime warnings. Saved dialogs close instead of inviting another write, while the real inventory error and Retry remain available. A newly saved entry also stops the old empty inventory from claiming “No secrets yet.” Genuine failed writes, incomplete imports and deletion safeguards are unchanged.

Why This Change Was Made

The existing store owner already has the acknowledged receipt and saved-entry count. Those facts—not a later read error—now decide whether the write completed. Acknowledged changes invalidate the existing inventory-readiness flag until the next accepted list. Previously read rows remain visible during recovery; no new cache, request, state owner or permission rule is added.

The empty-state view uses the same accepted-inventory boundary as #199116. That small guard is included here so this draft works directly on main; the existing draft has not been modified. Gateway-reported write/runtime-refresh failures still keep their original recovery because they are not successful mutation receipts.

Evidence

  • Main baseline e345d2240d2869b fails the three owning receipt regressions and the three actual-browser save/delete/import scenarios.
  • Final independent branch: 20 focused tests and 10 compiled Chromium scenarios pass, including protected/readable values, partial and rejected writes, warnings, Retry, explicit deletion, reconnect/client replacement and narrow layouts. The campaign checkout additionally passes its existing accepted-empty regression.
  • UI typecheck and formatting pass. Targeted lint has one existing view-fixture reactivity warning, reproduced on the pinned baseline; no new warning or raised limit.
  • Source, authoritative mutation response and original feat(secrets): manage team secrets in Control UI #121724/refactor(ui): consolidate shared UI and terminal handling #167925 history reviewed. Self-simplification retained the existing receipt/count/readiness facts; no extra helper or state.
  • Proof uses synthetic Gateway responses and a clearly labeled fake value, not real credentials or live secret-store writes. Broad CI, independent automated review and cross-browser behavior are not claimed.

Actual compiled Control UI, light theme, 1280×1000 viewport; matching 960×920 annotated crops. Orange marks the already-saved dialog still offering Save. Green marks the preserved completion; the real inventory error remains above it.

Before — main

Before: confirmed secret save is still presented as an unsaved dialog

After — this change

After: confirmed save retained with inventory Retry and no false empty claim

Requested and co-authored by @vyctorbrzezowski.

Work sessions

Linked for team reference; these sessions aren’t public.

Maintainer CI repair: receipt mock typing

The test's inferred mock return type omitted the valid warningCount field. Reused the existing typed Gateway request/client test helpers and removed the local double cast. Production, fixture response values and all assertions are unchanged. All 11 focused tests, the relevant core-test-ui-other type graph, lint and formatting passed.

@clawsweeper

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

@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. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 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 Nov 15, 2026
@clawsweeper

clawsweeper Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves confirmed save, delete, and completed-import outcomes when the subsequent inventory read fails.

Example: Saving AUDIT_API_KEY succeeds, then secrets.store.list fails.

  • Before: The Add secret dialog remains open with Save enabled and the inventory error presented as a save failure.
  • After: The dialog closes, the saved confirmation and runtime warning remain, and the inventory error offers Retry without claiming the store is empty.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct repair with directly inspectable browser proof of the central scenario and regression coverage for related outcomes.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after captures exercise the compiled Control UI save path with synthetic Gateway responses: an acknowledged save followed by inventory failure closes the dialog and retains confirmation, warning, and Retry; focused browser regressions cover deletion and completed import.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A successful Secrets change appears unfinished when its follow-up inventory read fails.
Reason: The maintainer-authored direction restores accurate completion feedback while preserving failed-write handling, sequential imports, and deletion safeguards.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current Secrets UI bug with a focused change and no actionable correctness or security findings; it remains a draft.

Priority: P2
Reviewed head: 976f0561f27a87368c67c853f0bdeed6eedd3562

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI Secrets store sends Gateway mutations and inventory reads, then supplies receipts, cached rows, and errors to the Secrets page.

flowchart LR
  A[Secrets page] --> B[Existing store owner]
  B --> C[Gateway mutation]
  C --> D[Confirmed receipt]
  B --> E[Inventory read]
  D --> F[Completion notice]
  E --> G[Rows or error with Retry]
Loading

Technical review

Best possible solution:

Use acknowledged receipts and saved counts to determine completion, and retain inventory failure recovery in the existing store owner.

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

Current main demonstrably discards a successful mutation receipt after a list rejection, matching the supplied before screenshot; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The violated invariant is that a failed read cannot undo an acknowledged write; preserving the existing receipt/count and invalidating inventory readiness is the smallest complete fix without another owner or cache.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5fbdf6989130.

Provenance checked

  • Mutation completion and sequential bulk refresh changes intended behavior with a stated reason (ea06d72: The original feature provided visible mutation outcomes and deliberately refreshed after each sequential bulk write; the later consolidation preserved those policies.)
  • Partial-import wording keeps the original intent (ff093b5: Separate saved counts from failure detail; this PR retains that wording for incomplete imports and avoids applying it to fully acknowledged imports.)
  • Secrets empty-state presentation changes intended behavior with a stated reason (545d290: Use the shared Settings empty card for empty inventories; this PR explains why only an accepted inventory can establish emptiness.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 9394889 adds ui/src/lib/secrets-store/index.ts:110 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9394889ffad1; files: ui/src/lib/secrets-store/index.ts)

PR surface

Source +6, Tests +269. Total +275 across 5 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 2 22 16 +6
Tests 3 269 0 +269
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 291 16 +275

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test LOC Production +22/-16; tests +269/-0 The small production change reuses existing state; tests cover receipt settlement, rejected writes, partial imports, and visible browser recovery.

Labels

Label changes:

  • add P2: A failed inventory read misrepresents successful Secrets mutations and invites repeated writes, but recovery remains available in the UI.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • 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.

Label justifications:

  • P2: A failed inventory read misrepresents successful Secrets mutations and invites repeated writes, but recovery remains available in the UI.
  • 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.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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.

Reviewed November 14, 2026, 11:16 PM ET / November 15, 2026, 04:16 UTC.

@vyctorbrzezowski vyctorbrzezowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the complete mutation/read owner, caller identity guard, test cases and before/after images. Acknowledged save, delete and complete bulk-write results survive a later inventory-read failure; rejected writes and partial imports remain failures. Context changes still retire old receipts. Fixed the test mock's narrow inferred return type using existing Gateway helpers, removing a double cast without changing production, responses or assertions. All 11 focused tests, the relevant type graph, lint and final-head CI passed.

@vyctorbrzezowski
vyctorbrzezowski merged commit 5370661 into main Nov 15, 2026
91 of 92 checks passed
@vyctorbrzezowski
vyctorbrzezowski deleted the fix/defensive-ui-secrets-confirmed-receipts branch November 15, 2026 08:12
@vyctorbrzezowski

Copy link
Copy Markdown
Member

Reviewed and merged. Confirmed secret-store writes remain confirmed when a later inventory refresh fails, while rejected writes and partial imports keep their failure behavior. I corrected the test mock typing using the existing Gateway helpers and removed the double cast. All assertions were preserved and final-head CI passed. Thanks for the fix.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 16, 2026
…penclaw#199414)

Preserve acknowledged secret-store mutations when a later inventory refresh fails. Keep rejected writes, partial imports, identity guards and error recovery distinct. Use the existing Gateway test helpers for valid receipt typing.

Co-authored-by: vyctorbrzezowski <[email protected]>
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
…penclaw#199414)

Preserve acknowledged secret-store mutations when a later inventory refresh fails. Keep rejected writes, partial imports, identity guards and error recovery distinct. Use the existing Gateway test helpers for valid receipt typing.

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

(cherry picked from commit 5370661)

Release adaptation: Keep release-line partial-import copy and existing receipt owner; retain acknowledged save/delete/bulk receipts across inventory errors. Three behavioral baseline failures plus one unrelated source-copy assertion, fixed 10 tests. Browser interaction qualification remains outstanding.

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

Labels

app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. 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: 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.

2 participants