Skip to content

fix(doctor): persist default agent roster during repair - #117115

Merged
fuller-stack-dev merged 1 commit into
mainfrom
codex/doctor-roster-persistence-audit
Aug 1, 2026
Merged

fuller-stack-dev merged 1 commit into
mainfrom
codex/doctor-roster-persistence-audit

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where operators running openclaw doctor --fix could be told that the explicit default-agent roster was persisted even though openclaw.json still omitted agents.entries.<id>.default: true.

Why This Change Was Made

Doctor now carries its accepted roster migration as explicit write intent through the existing atomic config writer, which otherwise correctly preserves authored roster omissions during unrelated writes. The intent is limited to the pending migration write, so declined previews, include-owned rosters, later health writes, and legacy update handoffs keep their existing boundaries. The pre-write message now says the roster was prepared for persistence; the normal post-write message remains the durability signal.

User Impact

openclaw doctor --fix now durably records the normalized default-agent roster before reporting the config update. Legacy update parents that intentionally cannot accept doctor writes still report the explicit skip without claiming persistence.

Evidence

  • Focused tests: node scripts/run-vitest.mjs src/commands/doctor-config-flow.test.ts src/flows/doctor-health-contributions.test.ts — 158 passed.
  • Changed gates: core typecheck, core test typecheck, lint, formatting, API/boundary/dead-code/schema guards passed. The remote hydration attempt failed before checks because its temporary install could not resolve typescript; the trusted local fallback completed successfully.
  • Black-box Testbox proof: ordinary doctor persisted the default, a second run retained it, legacy handoff left it absent, and neither path emitted the premature Persisted agents.entries claim: https://github.com/openclaw/openclaw/actions/runs/30673646693
  • Structured autoreview: clean, no accepted/actionable findings (gpt-5.6-sol, high reasoning).

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S maintainer Maintainer-authored PR labels Jul 31, 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 8:28 PM ET / August 1, 2026, 00:28 UTC.

ClawSweeper review

What this changes

The PR passes an accepted Doctor roster migration as an explicit write path so openclaw doctor --fix persists the normalized default-agent roster and reports durability only after the write succeeds.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

The patch follows the existing atomic-writer contract and the supplied black-box proof covers the durability path. It should remain open for maintainer review because it intentionally makes an implicit roster explicit during openclaw doctor --fix, and this member-authored, maintainer-labeled PR is protected from automated cleanup.

Priority: P2
Reviewed head: 9017fa26ca811e4a9347800b9809abeab170bc76
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong focused tests and black-box proof support a contained repair; the remaining gate is maintainer acceptance of the intentional config canonicalization.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body links a successful black-box Testbox run covering persistence, repeat-run retention, legacy handoff, and corrected messaging; the supplied context also marks real behavior proof successful.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body links a successful black-box Testbox run covering persistence, repeat-run retention, legacy handoff, and corrected messaging; the supplied context also marks real behavior proof successful.
Evidence reviewed 7 items Current-main behavior: Doctor detects a persisted implicit main-roster migration and labels the change as persisted, but current main does not attach an explicit write path to the returned config result.
Atomic-writer contract: The writer’s existing contract preserves a default-derived roster omission unless explicitSetPaths names agents.entries; its focused test proves the runtime roster can contain main.default while the persisted file still omits entries.
Branch owner-boundary fix: The branch records agents.entries only after Doctor accepts the roster repair, returns it only when a config write remains pending, and forwards it only to that first atomic write.
Findings None None.
Security None None.

How this fits together

openclaw doctor --fix turns detected configuration repairs into a candidate config, then the Doctor health contribution calls the atomic writer. That writer normally preserves authored omissions equal to defaults, so the repair must carry narrowly scoped intent when persistence is required.

flowchart LR
  A[Authored openclaw.json] --> B[Doctor roster migration]
  B --> C[Accepted repair intent]
  C --> D[Doctor health write]
  D --> E[Atomic config writer]
  E --> F[Canonical default roster]
  E --> G[Post-write operator message]
Loading

Decision needed

Question Recommendation
Should openclaw doctor --fix canonically persist a root-authored implicit default agent as explicit agents.entries, while preserving include-owned rosters and ordinary writes? Accept Doctor canonicalization: Merge the scoped explicit-write intent so accepted Doctor roster repairs become durable and retain the current include and later-write boundaries.

Why: The patch is mechanically contained and tested, but deciding whether Doctor may make this durable upgrade-time config transformation is a product and compatibility boundary rather than a purely technical correction.

Before merge

  • Resolve merge risk (P1) - Merging makes openclaw doctor --fix rewrite a root-authored implicit default roster as explicit agents.entries; the patch confines that upgrade-time canonicalization to accepted pending repairs, but maintainers must accept that persisted-config change.
Agent review details

Security

None.

PR surface

Source +10, Tests +50. Total +60 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 13 3 +10
Tests 2 50 0 +50
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 63 3 +60

Review metrics

Metric Value Why it matters
Persistent-config canonicalization 1 config subtree made explicit during one pending Doctor write The migration changes upgrade-time persistence semantics for agents.entries, so maintainer acceptance matters beyond the small code diff.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-config-flow.test.ts, migration/backfill/repair: src/commands/doctor-config-flow.ts, migration/backfill/repair: src/flows/doctor-health-contribution-runners.config.ts, migration/backfill/repair: src/flows/doctor-health-contribution-types.ts, migration/backfill/repair: src/flows/doctor-health-contributions.test.ts, serialized state: src/commands/doctor-config-flow.test.ts, and 2 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Accept the bounded migration (recommended)
    Merge after a maintainer explicitly accepts that an operator-invoked Doctor repair converts the implicit root roster into the canonical explicit form.
  2. Keep the current persistence policy
    Do not merge this change; instead correct Doctor’s pre-write wording so it never promises persistence that the writer deliberately omits.

Technical review

Best possible solution:

Keep the atomic writer’s authored-omission default and merge this narrowly scoped Doctor-only intent if maintainers accept explicit roster canonicalization as the supported doctor --fix migration outcome.

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

Yes, from source: current main prepares the normalized default roster, while the atomic-writer test shows the same default-derived agents.entries is omitted unless explicitly named for persistence. The supplied Testbox run reports the corresponding after-fix real behavior.

Is this the best way to solve the issue?

Yes, conditionally: carrying explicit write intent from the accepted Doctor migration to the existing atomic writer is narrower than changing the writer default or adding a fallback; a maintainer must first accept the canonicalization policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4f7fbcb34da2.

Labels

Label justifications:

  • P2: This is a bounded Doctor repair for configuration durability with limited blast radius.
  • merge-risk: 🚨 compatibility: An operator running doctor --fix will have an implicit root roster rewritten as an explicit agents.entries subtree.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body links a successful black-box Testbox run covering persistence, repeat-run retention, legacy handoff, and corrected messaging; the supplied context also marks real behavior proof successful.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body links a successful black-box Testbox run covering persistence, repeat-run retention, legacy handoff, and corrected messaging; the supplied context also marks real behavior proof successful.

Evidence

What I checked:

  • Current-main behavior: Doctor detects a persisted implicit main-roster migration and labels the change as persisted, but current main does not attach an explicit write path to the returned config result. (src/commands/doctor-config-flow.ts:198, 4f7fbcb34da2)
  • Atomic-writer contract: The writer’s existing contract preserves a default-derived roster omission unless explicitSetPaths names agents.entries; its focused test proves the runtime roster can contain main.default while the persisted file still omits entries. (src/config/io.write-config.test.ts:1348, 4f7fbcb34da2)
  • Branch owner-boundary fix: The branch records agents.entries only after Doctor accepts the roster repair, returns it only when a config write remains pending, and forwards it only to that first atomic write. (src/commands/doctor-config-flow.ts:222, 9017fa26ca81)
  • Write lifecycle containment: The PR forwards explicit paths only while the Doctor result is pending and marks the result committed after the atomic write; the accompanying test also checks that a later health write does not reuse the path. (src/flows/doctor-health-contribution-runners.config.ts:36, 9017fa26ca81)
  • Include boundary: The existing writer rejects explicit paths that overlap include-owned configuration unless a specific override is supplied; Doctor avoids this roster repair when an include owns the roster. (src/config/io.write-prepare.ts:791, 4f7fbcb34da2)
  • Proof and checks: The PR body links a successful Black-box Testbox run that reports ordinary persistence, repeat-run retention, legacy handoff non-persistence, and corrected messaging; the supplied context also records successful focused checks and a passing Real behavior proof check. (9017fa26ca81)

Likely related people:

  • Koduri Mahesh Bhushan Chowdary: Current-main blame attributes the explicit-path insertion and writer-call option plumbing to this history root, making this the closest established owner of the persistence contract. (role: atomic config-writer contract contributor; confidence: medium; commits: 9878bfc8e5; files: src/config/io.write-prepare.ts, src/config/io.write.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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-07-31T23:56:15.554Z sha 9017fa2 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T00:06:25.795Z sha 9017fa2 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 1, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Aug 1, 2026
@fuller-stack-dev
fuller-stack-dev merged commit af687f9 into main Aug 1, 2026
134 of 147 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the codex/doctor-roster-persistence-audit branch August 1, 2026 01:06
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit to pacocartones/openclaw that referenced this pull request Aug 1, 2026
* origin/main: (217 commits)
  fix(messages): reply actions leak citation markers and reply/poll answers draw the no-reply fallback (openclaw#116909)
  fix(slack): let durable ingress retry transient thread lookups (openclaw#117135)
  refactor(doctor): consolidate shipped state migration ownership (openclaw#117142)
  fix(ai): Codex stream shows internal parser text on a malformed frame (openclaw#116966)
  fix: guard every migrated session accessor path (openclaw#117140)
  fix(terminal): measure unicode display width consistently (openclaw#117062)
  fix(openai): clear ChatGPT SSE fallback per session (openclaw#117123)
  fix(mistral): reject incomplete streamed tool terminals (openclaw#117137)
  fix(ai): preserve structured chat content and refusals (openclaw#117136)
  fix(doctor): persist normalized agent roster (openclaw#117115)
  fix(signal): avoid replay after ambiguous quote delivery errors (openclaw#117134)
  fix(cron): reject disabled delivery accounts when scheduling (openclaw#116899)
  fix(gateway): honor HTTP If-Modified-Since media validators (openclaw#117133)
  fix(config): delete one array element per config patch delete (openclaw#116463)
  fix(plugins): report installed dependency health authoritatively (openclaw#117029)
  fix(ui): recover moving sessions across paged gateway rosters (openclaw#117016)
  fix(ui): clear hidden session selection before bulk deletion (openclaw#117015)
  fix(discord): avoid replaying ambiguous voice deliveries (openclaw#117127)
  fix(ui): scope Gateway reconnect lineage to its target (openclaw#117125)
  fix(models): expose runtime provider catalogs in browse views (openclaw#116857)
  ...
vincentkoc added a commit to yetval/openclaw that referenced this pull request Aug 1, 2026
* commit 'c41f033b87545b658215a9c3bbe03f88fbaa867d': (347 commits)
  refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146)
  fix(messages): reply actions leak citation markers and reply/poll answers draw the no-reply fallback (openclaw#116909)
  fix(slack): let durable ingress retry transient thread lookups (openclaw#117135)
  refactor(doctor): consolidate shipped state migration ownership (openclaw#117142)
  fix(ai): Codex stream shows internal parser text on a malformed frame (openclaw#116966)
  fix: guard every migrated session accessor path (openclaw#117140)
  fix(terminal): measure unicode display width consistently (openclaw#117062)
  fix(openai): clear ChatGPT SSE fallback per session (openclaw#117123)
  fix(mistral): reject incomplete streamed tool terminals (openclaw#117137)
  fix(ai): preserve structured chat content and refusals (openclaw#117136)
  fix(doctor): persist normalized agent roster (openclaw#117115)
  fix(signal): avoid replay after ambiguous quote delivery errors (openclaw#117134)
  fix(cron): reject disabled delivery accounts when scheduling (openclaw#116899)
  fix(gateway): honor HTTP If-Modified-Since media validators (openclaw#117133)
  fix(config): delete one array element per config patch delete (openclaw#116463)
  fix(plugins): report installed dependency health authoritatively (openclaw#117029)
  fix(ui): recover moving sessions across paged gateway rosters (openclaw#117016)
  fix(ui): clear hidden session selection before bulk deletion (openclaw#117015)
  fix(discord): avoid replaying ambiguous voice deliveries (openclaw#117127)
  fix(ui): scope Gateway reconnect lineage to its target (openclaw#117125)
  ...
vincentkoc added a commit to chenyangjun-xy/openclaw that referenced this pull request Aug 1, 2026
* origin/main: (3706 commits)
  refactor(ui): unify filtered session list ownership (openclaw#117158)
  refactor(agents): consolidate context budgets and compaction recovery (openclaw#117149)
  fix(net-policy): redact sig and x-* auth params in URLs and bodies (openclaw#116957)
  refactor(agents): remove duplicate generated-media delivery fallbacks (openclaw#117150)
  refactor(reply): unify turn lifecycle state ownership (openclaw#117145)
  fix(ui): preserve emoji agent avatar initials (openclaw#104912)
  refactor(auto-reply): unify command and directive ownership (openclaw#117143)
  refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146)
  fix(messages): reply actions leak citation markers and reply/poll answers draw the no-reply fallback (openclaw#116909)
  fix(slack): let durable ingress retry transient thread lookups (openclaw#117135)
  refactor(doctor): consolidate shipped state migration ownership (openclaw#117142)
  fix(ai): Codex stream shows internal parser text on a malformed frame (openclaw#116966)
  fix: guard every migrated session accessor path (openclaw#117140)
  fix(terminal): measure unicode display width consistently (openclaw#117062)
  fix(openai): clear ChatGPT SSE fallback per session (openclaw#117123)
  fix(mistral): reject incomplete streamed tool terminals (openclaw#117137)
  fix(ai): preserve structured chat content and refusals (openclaw#117136)
  fix(doctor): persist normalized agent roster (openclaw#117115)
  fix(signal): avoid replay after ambiguous quote delivery errors (openclaw#117134)
  fix(cron): reject disabled delivery accounts when scheduling (openclaw#116899)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
* commit '31f24547a94a8bd74a32e42cde1783591c5804d9': (347 commits)
  refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146)
  fix(messages): reply actions leak citation markers and reply/poll answers draw the no-reply fallback (openclaw#116909)
  fix(slack): let durable ingress retry transient thread lookups (openclaw#117135)
  refactor(doctor): consolidate shipped state migration ownership (openclaw#117142)
  fix(ai): Codex stream shows internal parser text on a malformed frame (openclaw#116966)
  fix: guard every migrated session accessor path (openclaw#117140)
  fix(terminal): measure unicode display width consistently (openclaw#117062)
  fix(openai): clear ChatGPT SSE fallback per session (openclaw#117123)
  fix(mistral): reject incomplete streamed tool terminals (openclaw#117137)
  fix(ai): preserve structured chat content and refusals (openclaw#117136)
  fix(doctor): persist normalized agent roster (openclaw#117115)
  fix(signal): avoid replay after ambiguous quote delivery errors (openclaw#117134)
  fix(cron): reject disabled delivery accounts when scheduling (openclaw#116899)
  fix(gateway): honor HTTP If-Modified-Since media validators (openclaw#117133)
  fix(config): delete one array element per config patch delete (openclaw#116463)
  fix(plugins): report installed dependency health authoritatively (openclaw#117029)
  fix(ui): recover moving sessions across paged gateway rosters (openclaw#117016)
  fix(ui): clear hidden session selection before bulk deletion (openclaw#117015)
  fix(discord): avoid replaying ambiguous voice deliveries (openclaw#117127)
  fix(ui): scope Gateway reconnect lineage to its target (openclaw#117125)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
* origin/main: (3706 commits)
  refactor(ui): unify filtered session list ownership (openclaw#117158)
  refactor(agents): consolidate context budgets and compaction recovery (openclaw#117149)
  fix(net-policy): redact sig and x-* auth params in URLs and bodies (openclaw#116957)
  refactor(agents): remove duplicate generated-media delivery fallbacks (openclaw#117150)
  refactor(reply): unify turn lifecycle state ownership (openclaw#117145)
  fix(ui): preserve emoji agent avatar initials (openclaw#104912)
  refactor(auto-reply): unify command and directive ownership (openclaw#117143)
  refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146)
  fix(messages): reply actions leak citation markers and reply/poll answers draw the no-reply fallback (openclaw#116909)
  fix(slack): let durable ingress retry transient thread lookups (openclaw#117135)
  refactor(doctor): consolidate shipped state migration ownership (openclaw#117142)
  fix(ai): Codex stream shows internal parser text on a malformed frame (openclaw#116966)
  fix: guard every migrated session accessor path (openclaw#117140)
  fix(terminal): measure unicode display width consistently (openclaw#117062)
  fix(openai): clear ChatGPT SSE fallback per session (openclaw#117123)
  fix(mistral): reject incomplete streamed tool terminals (openclaw#117137)
  fix(ai): preserve structured chat content and refusals (openclaw#117136)
  fix(doctor): persist normalized agent roster (openclaw#117115)
  fix(signal): avoid replay after ambiguous quote delivery errors (openclaw#117134)
  fix(cron): reject disabled delivery accounts when scheduling (openclaw#116899)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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