Skip to content

fix(models): wait for catalog publication during API-key saves - #176195

Merged
steipete merged 1 commit into
mainfrom
steipete/auth-save-catalog-publication
Oct 18, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/auth-save-catalog-publication

Conversation

@steipete

@steipete steipete commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes API-key saves that fail when a model-catalog refresh begins while the credential store is preparing the write.

User Impact

Saving a key waits for an in-flight credential publication to settle, then revalidates authority before writing. Unknown publication outcomes, revoked callers, retired owners, and agent overrides still reject the save.

Why This Change Was Made

Follow-up to #176166, found while checking #175837. Waiting during initial preparation and configuration application did not cover a new catalog publication beginning before the asynchronous credential-store updater called its validation callback.

The credential owner distinguishes that temporary pending state from unavailable authority and supplies its existing settlement wait. The save retries only the refused pre-write operation and separately validates configuration. A committed key is never replayed. Synchronous authority checks remain in place.

Evidence

  • Temporary instrumentation reproduced the failure on main production with the same Gateway auth fixture on macOS and Linux: models.authSetApiKey rejected during its pre-write callback after the model-catalog worker began a credential batch. The captured root/source identities remained current; neither outcome was unknown. Instrumentation was removed after diagnosis.
  • The deterministic pre-write regression fails on unmodified main (f585b0421821) with the same authority error and zero committed key writes. The repaired auth API-key suite passes all 46 cases, including settlement, unknown results, owner closure, revoked callers, competing overrides, and cleanup-error propagation. The complete file took 173s including preparation on the shared worker; the new failing baseline case took 2.6s.
  • The unchanged Gateway auth fixture also passes on Linux after applying only this production repair: 5/5 tests (13.4s test time, 104s including preparation). Before the repair it reproduced the pending-publication refusal on Linux as well as macOS.
  • Targeted production/test typechecks, lint, formatting, and local P2 review pass. Existing auth command and credential-authority sibling suites also pass: 92 tests, including SDK commit/rollback and retained-authority paths. Committed-branch P2 review also passes with the surrounding store/admission implementations included.

Production delta: +93/−70 lines (net +23); tests: +148/−49 (net +99). Existing publication waiters and synchronous effect checks remain the only owners.

Retry only a direct pending-publication refusal before credential writes or configuration preparation. Reuse the credential owner settlement wait and preserve revocation, unknown outcomes, overrides, and cleanup failures.
@clawsweeper

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 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 ✅ Completed 2026-10-18T11:35:55.234467Z caadce3 PR opened
ℹ️ 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.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: M labels Oct 18, 2026
@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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

API-key saves wait for pending credential publication and retry only operations refused before writing.

Example: Saving sample:manual while a catalog refresh begins inside credential-write preparation.

  • Before: The save rejects with unavailable credential authority before committing the new key.
  • After: The save waits for publication, revalidates authority, and commits synthetic-new-key once.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, useful repair with no actionable defects and meaningful persisted-state authority coverage; independently inspectable proof remains at the harness boundary.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (none): For this maintainer-authored PR, the authority-boundary harness exercises real credential and configuration owners with injected publication and revocation: allowed settlement commits once, while revoked callers, retired owners, uncertainty, and competing overrides prevent the subsequent effect; the PR reports the harness passing.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Saving an API key can fail when a background catalog refresh begins while the credential writer is preparing its update.
Reason: The maintainer-authored change restores documented shared save behavior without adding options, storage, or a competing owner.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a current API-key save failure, preserves the existing authority boundaries, and has no actionable findings.

Priority: P2
Reviewed head: caadce30b367cf2ac4f473485c1b75f6cda71834

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The reported Gateway fixture run has no linked runtime trace demonstrating publication overlap; directly inspectable coverage is the production-owner harness.
Agent review details

How this fits together

Models and the CLI share an API-key save owner that validates credential authority, persists the key, and applies its provider binding through the configuration writer.

flowchart TD
  A[Models or CLI] --> B[Shared API key save]
  B --> C[Credential authority]
  D[Catalog publication] --> C
  C --> B
  B --> E[Credential writer]
  B --> F[Configuration writer]
  F --> G[Gateway provider binding]
Loading

Technical review

Best possible solution:

Land the focused repair using the existing publication waiter, pre-write validation, and separate configuration application.

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

Current-main source exposes the pre-write failure ordering, and the PR reports a failing baseline regression plus macOS and Linux Gateway reproductions; this review executed no target code.

Is this the best way to solve the issue?

The patch is the smallest complete repair supported by the inspected owners: distinguish temporary publication refusal, release the refused operation before waiting, then retry with current authority while preserving cleanup failures and committed-write semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1507c89eaa51.

Provenance checked

  • Credential publication denial and settlement keeps the original intent (5822af6: Deny credential effects during pending publication and unknown outcomes, and install committed facts before releasing denial.)
  • Publication waiting during API-key saves keeps the original intent (c3af75f: Wait for known publication during configuration application while retaining synchronous effect checks and genuine partial-save failures.)
  • Shared Models and CLI credential persistence keeps the original intent (09e2b15: Share credential persistence while preserving model selection, external references, metadata, and agent overrides.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 0636e55 adds src/commands/models/auth-api-key.ts:133 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0636e5523960; files: src/commands/models/auth-api-key.ts)

PR surface

Source +23, Tests +99. Total +122 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 93 70 +23
Tests 1 148 49 +99
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 241 119 +122

Review metrics

Metric Value Why it matters
Production versus test changes Production +93/−70; tests +148/−49 The production growth distinguishes a retryable pre-write refusal; test growth covers distinct settlement, authority, persistence, and cleanup outcomes.

Labels

Label changes:

  • add P2: A catalog-publication overlap can reject a valid API-key save, with limited blast radius and an existing retry path.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: A catalog-publication overlap can reject a valid API-key save, with limited blast radius and an existing retry path.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach a redacted Gateway RPC trace showing publication overlap followed by one successful key save.

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 October 18, 2026, 7:51 AM ET / 11:51 UTC.

@steipete
steipete merged commit 9f666d5 into main Oct 18, 2026
149 checks passed
@steipete
steipete deleted the steipete/auth-save-catalog-publication branch October 18, 2026 13:13
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
…law#176195)

Retry only a direct pending-publication refusal before credential writes or configuration preparation. Reuse the credential owner settlement wait and preserve revocation, unknown outcomes, overrides, and cleanup failures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

1 participant