Skip to content

fix(setup): activate saved credentials against committed config shape - #170165

Open
crwvrosenblum wants to merge 1 commit into
openclaw:mainfrom
crwvrosenblum:fix/setup-activation-committed-shape
Open

crwvrosenblum wants to merge 1 commit into
openclaw:mainfrom
crwvrosenblum:fix/setup-activation-committed-shape

Conversation

@crwvrosenblum

Copy link
Copy Markdown

Related: #92232, #166965

What Problem This Solves

Fixes: setup fails to activate a saved sign-in whenever the setup flow also installed a provider plugin — the post-commit ownership check reports false configuration drift and activation fails.

User Impact

After plugin-mediated setup (for example, onboarding a provider that the app installs on demand), the user's verified credential could not be activated: the saved sign-in stayed inactive and setup reported a spurious "connection changed" failure instead of completing.

Why This Change Was Made

When setup installs a provider, the config commit moves pending install records into the canonical plugin index and strips them from authored config. The credential-activation revalidation compared the committed snapshot against a route projection still carrying the pending records, so every such activation read as concurrent drift. The comparison now runs against the committed configuration shape, matching how installation-record ownership already normalizes the post-commit view.

This was split out of #166965 so the fix can land independently of the catalog-admission decision pending there. It repairs activation for any installed provider, including the existing external catalog entry.

Evidence

  • Red/green through the real owners: the install-owner suite's fixture returned authProfiles: [], so no credential was ever saved and the activation path never ran. Supplying a real auth profile reproduces the bug on this base: replace during probe: false fails with the false-drift activation error (the failed rollback additionally trips the config write guard: size-drop:1355->641). With the fix, both cases pass — the saved credential is promoted (its setup marker cleared), the install record lands in the canonical index, and authored config is committed without plugins.installs remnants.
  • The replace during probe: true case still fails at the intended earlier boundary (artifact substitution detected during verification) and passes.
  • Opening the module mock to importOriginal passthrough is required by the newly exercised save path (applyProviderPluginAuthMethodResultConfig) and removes the stale closed-mock baseline row.
  • node scripts/run-vitest.mjs src/system-agent/setup-inference.provider-install-owner.test.ts --maxWorkers=1: 2/2 pass; shard wall time 36s (tests 11.5s).
  • oxfmt, oxlint (0 warnings/errors), git diff --check, and all core-test tsgo shards pass. check:test-mock-exports --prune regenerated the shrink-only baseline (9814 → 9813 rows).
  • Auth acquisition and provider responses are synthetic; installation-artifact ownership, configuration commit, credential staging/promotion, and activation checks use the real owners.
  • Broader suites were not run locally; PR CI runs them.

When setup installs a provider plugin, the config commit moves pending
install records into the plugin index and strips them from authored
config. The post-commit credential check compared the committed state
against a route projection that still carried the pending records, so
install-mediated credential activation reported false owner drift,
failed activation, and rolled back through a write the config guard
rejected.

Compare against the committed shape instead so activation succeeds,
and extend the install-owner coverage to a saved credential: the prior
fixture returned no auth profiles, so the activation path never ran.
Opening the mock to importOriginal passthrough also removes its stale
closed-mock baseline row.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@clawsweeper

clawsweeper Bot commented Oct 12, 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 P1 High-priority user-facing bug, regression, or broken workflow. 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 Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR compares credential activation against the config shape produced after pending plugin installation records are committed.

Example: Setup installs fixture-provider and verifies fixture-provider/fixture-model using a saved API-key credential.

  • Before: Activation reports “The connection changed before credential activation” because the committed config no longer contains plugins.installs.
  • After: The comparison accepts the committed config and the saved credential is promoted.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch has useful regression coverage and no identified correctness defect, but the external-PR behavior-proof gate remains unmet.
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 verified sign-in remains inactive and setup reports false connection drift when the same flow installs a provider plugin.
Reason: This restores the existing shared setup contract with a narrow repair independent of the sibling's provider-admission decision.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR repairs a concrete current-main setup failure with a focused change; no introduced correctness defect was found.

Priority: P1
Reviewed head: 723dca98533406e0b326a57696822bbfb6e0fda0

Before merge

  • Add real behavior proof - The supplied installation-owner tests exercise real config commits and credential promotion with mocked acquisition and inference, but no shipped CLI or Gateway setup run demonstrates the changed activation path; provide redacted terminal output, logs, or a recording showing plugin installation, verification, activation, and a successful reply, excluding API keys, IPs, phone numbers, and non-public endpoints. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Findings

None.

Tests

  • Missing end-to-end proof: Supply shipped CLI or Gateway setup evidence starting with the provider plugin absent and ending with successful credential activation and a usable connection.
Agent review details

How this fits together

The shared setup coordinator prepares and verifies an inference route, commits config and plugin installation records through their owners, and then activates the selected saved credential.

flowchart LR
  A[Provider selection] --> B[Credential staging]
  B --> C[Inference verification]
  C --> D[Config commit owner]
  D --> E[Canonical plugin index]
  D --> F[Activation revalidation]
  F --> G[Credential promotion]
Loading

Technical review

Best possible solution:

Retain the focused committed-shape comparison while preserving existing route, artifact, consent, and credential ownership checks.

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

Current-main source establishes the deterministic mismatch between pending and committed install-record shapes; the contributor reports a matching base-fail/head-pass regression, which was not executed during this read-only review.

Is this the best way to solve the issue?

The repair addresses the mismatched representation at the existing activation owner without introducing another installer, changing provider selection, or weakening the separate artifact and credential checks.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Post-commit credential activation comparison keeps the original intent (fix(auth): keep setup replacements inactive until activation #144524: Saved replacements must remain inactive until verification, confirmation, and config application; later Gateway-reload coordination preserves that ordering.)
  • Direct route equality check keeps the original intent (b53d7a3: The runtime refactor replaced the private comparison wrapper with direct deep equality while preserving route authority.)
  • Installation-owner regression fixture keeps the original intent (64bf824: Explicit provider selection uses the managed installer and independently verifies installed artifacts before activation.)
  • Closed-mock baseline removal keeps the original intent (unknown: The documented baseline records closed first-party mocks; export passthrough makes this exact entry obsolete. Historical baseline blame was unavailable in the supplied provenance.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit dd33833 adds src/system-agent/setup-inference-activate.ts:511 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: dd3383345724; files: src/system-agent/setup-inference-activate.ts)

PR surface

Source +5, Tests +26, Other -1. Total +30 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 6 1 +5
Tests 1 29 3 +26
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 3 35 5 +30

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +6/-1 lines; tests +29/-3 lines. The small comparison repair is supported by extending an existing fixture to exercise real credential staging and promotion.

Root-cause cluster

Relationship: canonical
Canonical: #170165
Summary: This PR is the focused activation repair extracted from the broader provider-catalog proposal.

Members:

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

Labels

Label changes:

  • add P1: The current-main defect prevents plugin-mediated provider setup from completing credential activation after successful verification.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P1: The current-main defect prevents plugin-mediated provider setup from completing credential activation after successful verification.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • 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.

Reviewed October 12, 2026, 3:36 PM ET / 19:36 UTC.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant