Skip to content

fix(models): keep status plugin metadata isolated - #140506

Merged
steipete merged 1 commit into
mainfrom
codex/plugin-metadata-scope-cleanup
Sep 6, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/plugin-metadata-scope-cleanup

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where running models status could cause concurrent operations to read plugin metadata from that command's workspace while it waited for model information.

Why This Change Was Made

Run the status operation inside the existing asynchronous metadata scope. Remove the temporary process-global lease stack, its capture/restore helpers, and the policy state stored only for lease restoration. Gateway startup publication restrictions and CLI metadata revision checks remain intact.

Migrate fixture consumers to operation scopes while retaining their behavioral assertions. Production code shrinks by 162 lines; tests and support grow by 58 lines, with one obsolete assertion-baseline entry removed.

User Impact

Concurrent operations keep their own plugin metadata. The status command's model selection, output and CLI options are preserved. This is an independent cleanup of the existing metadata API, with no new configuration or persistence changes.

Evidence

  • Causal regression: while status waits for its catalog, an unrelated reader incorrectly sees the command's workspace snapshot on the old implementation. The identical test passes with scoped metadata and still protects newer publications.
  • Rebased head: all 40 models-status tests pass, including the upstream case-distinct route cases and the held-snapshot isolation regression. Metadata publication, model-normalization and CLI-lifetime checks add 87 passing tests (127 total).
  • Earlier broad validation on the original base passed 688 affected tests across 22 files, including system-agent, Gateway, onboarding, transcript metadata and music-generation QA coverage. This remains supporting pre-rebase evidence.
  • Isolated real pnpm openclaw models status --json: a synthetic plugin's alias resolves correctly, its default utility model is reported, and its runtime entry is never imported.
  • Independent P2 autoreview: no actionable findings. Normal changed-code gate passes on the rebased head, including all selected typechecks, lint, formatting and guards.

No live provider credentials or operator Gateway were used.

@steipete steipete self-assigned this Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime commands Command implementations size: XL maintainer Maintainer-authored PR labels Sep 6, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 7:20 PM ET / 23:20 UTC.

ClawSweeper review

What this changes

Keep model-status plugin metadata inside its asynchronous operation, remove temporary global publication helpers, and migrate affected test fixtures to scoped metadata.

Merge readiness

✅ Ready for maintainer review

This remains a useful fix for a current-main metadata isolation defect. The pinned diff introduces no actionable correctness findings, and the maintainer-authored PR is protected from cleanup closure.

Priority: P2
Reviewed head: ba9a3879f5a0f047072a14a7cc84d54ba2917864

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with useful regression coverage and coherent fixture migrations; no actionable introduced defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored exemption applies. The body reports an isolated models-status run preserving alias and utility-model output; concurrency isolation is supported separately by the causal regression test, not that smoke run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored exemption applies. The body reports an isolated models-status run preserving alias and utility-model output; concurrency isolation is supported separately by the causal regression test, not that smoke run.
Evidence reviewed 9 items Pinned production change: The whitespace-insensitive merge-base-to-head diff replaces temporary global publication with the existing asynchronous scope; the remaining status logic is preserved. The associated removals eliminate lease restoration machinery.
Current main still contains the defect mechanism: The fetched main implementation still installs command-specific metadata through the temporary process-global lease when no matching snapshot exists. The requested isolation is therefore still necessary.
Causal regression coverage: The test pauses catalog loading after the command captures metadata, checks that an unrelated reader sees no command snapshot, publishes a replacement, and verifies that replacement survives command completion. Existing scope tests cover concurrent operations and rejection cleanup.
Findings None None.
Security None None.

How this fits together

Model status combines workspace plugin metadata, model catalogs, and credential availability into a diagnostic report. Metadata scopes let its nested lookups share one inventory without exposing that inventory to concurrent operations.

flowchart TD
  A[Workspace configuration] --> B[Prepared plugin metadata]
  B --> C[Asynchronous status scope]
  C --> D[Model and credential lookups]
  D --> E[Status report]
  F[Concurrent operations] --> G[Their own metadata context]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -162, Tests +58, Other -1. Total -105 across 29 files.

View PR surface stats
Area Files Added Removed Net
Source 4 1251 1413 -162
Tests 24 919 861 +58
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 29 2170 2275 -105

Review metrics

None.

Technical review

Best possible solution:

Use the existing asynchronous metadata owner consistently while preserving Gateway publication guards, CLI revision fencing, and model-status output.

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

Yes, from source: pause model-status catalog loading and read metadata from an unrelated asynchronous operation; current main publishes the command's snapshot globally. The regression test encodes that ordering, but this review did not execute it.

Is this the best way to solve the issue?

Yes. Reusing the existing asynchronous scope repairs the ownership boundary and permits removal of the global lease machinery without adding another metadata path.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs a bounded concurrency defect in model-status metadata without evidence of an urgent widespread runtime outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored exemption applies. The body reports an isolated models-status run preserving alias and utility-model output; concurrency isolation is supported separately by the causal regression test, not that smoke run.

Evidence

What I checked:

  • Pinned production change: The whitespace-insensitive merge-base-to-head diff replaces temporary global publication with the existing asynchronous scope; the remaining status logic is preserved. The associated removals eliminate lease restoration machinery. (src/commands/models/list.status-command.ts:350, ba9a3879f5a0)
  • Current main still contains the defect mechanism: The fetched main implementation still installs command-specific metadata through the temporary process-global lease when no matching snapshot exists. The requested isolation is therefore still necessary. (src/commands/models/list.status-command.ts:254, 422b8c0ec786)
  • Causal regression coverage: The test pauses catalog loading after the command captures metadata, checks that an unrelated reader sees no command snapshot, publishes a replacement, and verifies that replacement survives command completion. Existing scope tests cover concurrent operations and rejection cleanup. (src/commands/models/list.status.test.ts:679, ba9a3879f5a0)
  • Lifecycle and public-contract boundaries: Gateway publication guards remain, and state publication still advances the revision consumed by CLI registration fencing. The removed helper has no remaining references in the searched source, plugins, packages, or docs; no public SDK export was identified. (src/plugins/current-plugin-metadata-state.ts:42, ba9a3879f5a0)
  • Documented ownership model: Plugin architecture documents stable Gateway inventory, operation-owned cache generations, lazy runtime imports, and prepared normalization policies. The changed boundary is OpenClaw's metadata lifecycle; unchanged Codex-related consumers and synthetic fixtures do not establish a dependency on the sibling Codex implementation. Public docs: docs/plugins/architecture.md. (docs/plugins/architecture.md:139, ba9a3879f5a0)
  • Contributor evidence and review continuity: The supplied body reports 127 focused checks on the rebased head, 688 earlier supporting tests, and an isolated real models-status run resolving a synthetic plugin alias and utility model without importing its runtime. These are contributor-reported results, not reviewer execution. The previous completed review retained no findings or published rank-up moves. (ba9a3879f5a0)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (1 earlier review cycle)
  • reviewed 2026-09-06T22:59:22.509Z sha da764f8 :: needs maintainer review before merge. :: none

Keep command-specific plugin metadata inside the existing async scope so
concurrent readers cannot inherit the status command's workspace inventory.
Remove the temporary global lease stack, its capture/restore helpers and
normalization-policy state stored only for lease restoration. Preserve
Gateway startup publication restrictions and CLI revision invalidation.

Migrate fixtures to operation scopes and retain behavioral coverage.
Production code shrinks by 162 lines.
@steipete
steipete force-pushed the codex/plugin-metadata-scope-cleanup branch from da764f8 to ba9a387 Compare September 6, 2026 23:13
@steipete
steipete merged commit 30ea82a into main Sep 6, 2026
179 checks passed
@steipete
steipete deleted the codex/plugin-metadata-scope-cleanup branch September 6, 2026 23:32
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
Keep command-specific plugin metadata inside the existing async scope so
concurrent readers cannot inherit the status command's workspace inventory.
Remove the temporary global lease stack, its capture/restore helpers and
normalization-policy state stored only for lease restoration. Preserve
Gateway startup publication restrictions and CLI revision invalidation.

Migrate fixtures to operation scopes and retain behavioral coverage.
Production code shrinks by 162 lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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