Skip to content

perf(doctor): parallel I/O for repair sequence and plugin dep cleanup (A1) - #85670

Closed
samson1357924 wants to merge 1 commit into
openclaw:mainfrom
samson1357924:fix/A1
Closed

samson1357924 wants to merge 1 commit into
openclaw:mainfrom
samson1357924:fix/A1

Conversation

@samson1357924

@samson1357924 samson1357924 commented May 23, 2026 •

Copy link
Copy Markdown
Contributor

Performance optimization for doctor repair sequence (Phase 1A — adapted)

Issue: #85333

Changes

Parallelize 3 I/O-only repair steps in
epair-sequencing.ts:

  • \cleanupLegacyPluginDependencyState, \maybeRepairLegacyOAuthSidecarProfiles,
    epairStaleOAuthProfileShadows\ now run concurrently via \Promise.all\ instead of sequentially
  • These are filesystem-only operations independent of config state, so concurrent execution is safe
  • \openAIAuthProviderRepair\ kept serial (depends on sidecar results)

Note: The \plugin-dependency-cleanup.ts\ per-plugin parallelization from the original A1 branch was already integrated upstream in a later refactor. This version includes only the remaining repair-sequencing optimization, adapted for the current upstream code structure.

Behavior or issue addressed

\openclaw doctor --fix\ runs 3 filesystem-only repair steps in parallel instead of serial, reducing wall-clock time from sum to max.

Safety

  • All existing tests pass
  • Each function handles its own I/O errors internally
  • Safety contract documented at Promise.all call site
  • No change to checks executed — only how they execute (serial → parallel)

What was not tested (delegated per commander instruction)

  • Real environment performance measurement (requires live openclaw runtime)
  • End-to-end wall-clock measurement

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: M triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 23, 2026
@clawsweeper

clawsweeper Bot commented May 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 24, 2026, 7:46 AM ET / 11:46 UTC.

Summary
The PR changes runDoctorRepairSequence so plugin dependency cleanup, legacy OAuth sidecar repair, and stale OAuth shadow cleanup run together in one Promise.all.

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

Reproducibility: yes. for the PR-introduced defect from source inspection: stale-shadow cleanup skips legacy sidecar refs, and sidecar migration removes those refs. I did not live-reproduce the original VPS doctor timing regression.

Review metrics: 1 noteworthy metric.

  • Doctor repair ordering changed: 3 repair calls moved into 1 Promise.all. Two of the moved calls repair OAuth data in persisted profile stores, so ordering and upgrade behavior matter before merge.

Stored data model
Persistent data-model change detected: migration/backfill/repair: src/commands/doctor/repair-sequencing.ts, unknown-data-model-change: src/commands/doctor/repair-sequencing.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #85333
Summary: This PR is an A1 candidate for the open doctor performance regression; an earlier broad PR is closed as superseded, and the merged session snapshot repair covers only a partial overlapping path.

Members:

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

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🧂 unranked krab
Result: blocked until real behavior proof is added.

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

Rank-up moves:

  • [P1] Keep legacy OAuth sidecar repair before stale OAuth shadow cleanup, or prove an equivalent dependency-aware design with focused tests.
  • [P1] Add redacted patched-run openclaw doctor --fix --yes output or before/after timing evidence from a real setup.

Proof guidance:

  • [P1] Needs real behavior proof before merge: No after-fix real behavior proof is present; the contributor should add redacted patched-run openclaw doctor --fix --yes output or before/after timing evidence, update the PR body, and redact private details such as IPs, keys, phone numbers, and non-public endpoints.

Risk before merge

  • [P1] Existing first-run doctor --fix upgrade behavior can change because stale OAuth profile shadows may survive until a later doctor run.
  • [P1] The patch changes persisted credential repair ordering without focused coverage for the sidecar-to-shadow dependency.
  • [P1] The claimed wall-clock improvement is unverified because there is no redacted patched-run doctor --fix output or before/after timing proof from a real setup.

Maintainer options:

  1. Preserve First-Run Auth Cleanup (recommended)
    Keep legacy OAuth sidecar migration before stale OAuth shadow cleanup, and only parallelize cleanup work that is independent of persisted auth profile stores.
  2. Accept Second-Run Cleanup
    Maintainers could intentionally accept that some stale OAuth shadows survive until a later doctor run, but that needs explicit approval and focused tests.
  3. Pause for Real Timing Proof
    If patched doctor timing proof cannot be supplied, keep the linked performance issue open and wait for a smaller measured optimization.

Next step before merge

  • [P1] The branch has a concrete code blocker, but missing real behavior proof is a contributor-side merge gate that automation cannot supply for this external PR.

Security
Needs attention: The diff changes credential repair ordering and can leave stale OAuth auth profile shadows in place after a first doctor repair.

Review findings

  • [P1] Keep OAuth shadow cleanup after sidecar migration — src/commands/doctor/repair-sequencing.ts:160-173
Review details

Best possible solution:

Keep dependent OAuth repairs serial, parallelize only repair steps that do not read or write the same auth profile stores, add focused sequencing coverage, and require redacted patched-run doctor timing proof before merge.

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

Yes for the PR-introduced defect from source inspection: stale-shadow cleanup skips legacy sidecar refs, and sidecar migration removes those refs. I did not live-reproduce the original VPS doctor timing regression.

Is this the best way to solve the issue?

No; this is not the best merge shape because it parallelizes auth repairs that share persisted auth profile state. The safer fix is to keep the auth dependency ordered and parallelize only independent cleanup work.

Full review comments:

  • [P1] Keep OAuth shadow cleanup after sidecar migration — src/commands/doctor/repair-sequencing.ts:160-173
    repairStaleOAuthProfileShadows skips profiles while they still contain a legacy sidecar oauthRef, and maybeRepairLegacyOAuthSidecarProfiles removes that field after importing credentials. Running both in one Promise.all can leave stale local OAuth shadows behind until a later doctor run, changing first-run upgrade behavior.
    Confidence: 0.91

Overall correctness: patch is incorrect
Overall confidence: 0.91

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1069c60e1e25.

Label changes

Label justifications:

  • P1: The PR targets a high-priority doctor/update regression but currently risks breaking first-run credential cleanup for existing users.
  • merge-risk: 🚨 compatibility: The changed repair ordering can alter shipped upgrade behavior by leaving stale OAuth profile shadows for a later doctor run.
  • merge-risk: 🚨 auth-provider: The diff changes OAuth sidecar and stale auth profile shadow repair ordering around persisted credentials.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: No after-fix real behavior proof is present; the contributor should add redacted patched-run openclaw doctor --fix --yes output or before/after timing evidence, update the PR body, and redact private details such as IPs, keys, phone numbers, and non-public endpoints.
Evidence reviewed

PR surface:

Source +7. Total +7 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 18 11 +7
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 18 11 +7

Security concerns:

  • [medium] Credential cleanup may not converge on first run — src/commands/doctor/repair-sequencing.ts:160
    Running stale OAuth shadow cleanup concurrently with legacy sidecar migration can preserve stale local credential shadows that current main removes after migration in the same doctor run.
    Confidence: 0.84

What I checked:

Likely related people:

  • steipete: Recent commit history shows repeated work on stale OAuth shadow repair, auth profile SQLite migration, OpenAI provider identity, and doctor repair sequencing around the affected files. (role: recent auth and stale-shadow contributor; confidence: high; commits: c462e68df756, 145882982212, e16ac0433092; files: src/commands/doctor/shared/stale-oauth-profile-shadows.ts, src/commands/doctor/repair-sequencing.ts, src/commands/doctor-auth-oauth-sidecar.ts)
  • joshavant: Commit history shows the OAuth sidecar runtime support removal that introduced or shaped the doctor sidecar migration surface this PR reorders. (role: legacy OAuth sidecar behavior contributor; confidence: medium; commits: 8d3027dffa7d; files: src/commands/doctor-auth-oauth-sidecar.ts, src/commands/doctor/shared/stale-oauth-profile-shadows.ts, src/commands/doctor/repair-sequencing.ts)
  • vincentkoc: Recent file history includes doctor repair sequencing and related doctor performance or helper work by this person near the changed surface. (role: recent doctor sequencing contributor; confidence: medium; commits: 21728777dfa0, 497685111b29, ee2d4e1f7923; files: src/commands/doctor/repair-sequencing.ts, src/commands/doctor-auth-oauth-sidecar.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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels May 23, 2026
@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

Phase 1A optimizations for openclaw#85333:

repair-sequencing.ts:
- Run cleanupLegacyPluginDependencyState, maybeRepairLegacyOAuthSidecarProfiles,
  and repairStaleOAuthProfileShadows in parallel via Promise.all
- These are filesystem-only operations with no config dependencies,
  so concurrent execution is safe
- openAIAuthProviderRepair kept sequential (depends on sidecar results)

All existing tests pass (repair-sequencing)
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed stale Marked as stale due to inactivity labels Jul 14, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@samson1357924 thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward.

Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive.

Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it.

@steipete

Copy link
Copy Markdown
Contributor

Closing per ClawSweeper review verdict stalled_unproven_pr (decision packet 2026-07-14T15:11:01.234Z). This item was part of the audited close backlog (openclaw/clawsweeper#920) stranded by an apply-lane defect, drained manually after re-verification. If this is wrong, reopen and ClawSweeper will re-review.

@steipete steipete closed this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants