Skip to content

perf(system-agent): reuse setup metadata per activation - #118352

Merged
steipete merged 2 commits into
mainfrom
codex/test-perf-setup-metadata
Aug 3, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/test-perf-setup-metadata

Conversation

@steipete

@steipete steipete commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Verified inference setup repeatedly rediscovered process-stable plugin metadata while projecting the baseline, staged, persisted, retried, and reconciled routes for one activation. The 122-case setup suite exposed the same cost operators pay during real model setup.

Why This Change Was Made

Prepare one compatibility-checked plugin manifest list after the setup plan and any Codex install/registry refresh, then carry only that immutable list through route selection and persistence retries. Config and workspace trust are still recalculated for every live config, and a plugin refresh explicitly bypasses the prior generation. No broad cache, sharding, config, dependency, or storage surface is added.

User Impact

Verified model setup and recovery checks complete faster, especially for staged provider/plugin configurations, while preserving route-drift, auth-alias, workspace, and post-install safety checks.

Evidence

  • Same-SHA alternating benchmark, 122/122 before and after:
    • wall: 75.67s -> 47.40s (37.4% faster)
    • Vitest: 70.27s -> 42.13s (40.0% faster)
    • max RSS: 1.45GB -> 1.07GB (26.3% lower)
  • Sibling matrix: 270/270 across setup, apply, verified inference, simple completion, runtime/auth aliases, and plugin metadata snapshots.
  • New regressions prove one metadata preparation per activation and a fresh allowCurrent: false generation after Codex registry refresh.
  • Direct Codex contract check at openai/codex origin/main bb5054fe47ab: the app server requires an initialized client to consume turn/* notifications, every started turn ends with a matching turn/completed, and transport closure remains terminal. Checked codex-rs/app-server/README.md:1444,1495, app-server/src/bespoke_event_handling.rs:1271, app-server/tests/common/test_app_server.rs:1005, app-server/src/lib.rs:1003, and app-server-client/src/remote.rs:414. The "Codex registry refresh" in this PR is OpenClaw's plugin-manifest lifecycle; the upstream app-server probe and its protocol are unchanged.
  • Post-rebase proof on the current-main base reran the full 270-test sibling matrix successfully, followed by a clean branch autoreview.
  • Formatting, targeted lint, git diff --check, focused type diagnostics, independent owner-boundary review, and final autoreview are clean.
  • Production delta: +125/-53 (net +72), establishing one operation-scoped prepared-fact boundary that replaces repeated discovery across all setup route projections.

@steipete steipete self-assigned this Aug 3, 2026
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Aug 3, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 3, 2026, 1:46 AM ET / 05:46 UTC.

ClawSweeper review

What this changes

The branch resolves compatible plugin manifest metadata once after setup staging, then passes that immutable manifest list through system-agent route selection, route comparisons, and persistence verification to avoid repeated plugin discovery.

Merge readiness

⛔ Blocked until real behavior proof is added - 4 items remain

Keep this maintainer-labeled PR open for human review. The patch has a coherent activation-scoped metadata boundary and clears the prior changelog finding, but it still lacks inspectable after-fix runtime evidence and this checkout cannot complete the repository-required direct Codex-source contract check.

Priority: P3
Reviewed head: 7b0bffd149b02e7d078f4639045b35ad96d803fb
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and regression-tested, but merge readiness is capped by missing inspectable real-behavior proof and an unavailable required upstream contract check.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The body reports benchmarks and test totals, but the supplied review context contains no inspectable after-fix terminal output, runtime log, recording, or linked artifact; add redacted evidence before merge and refresh the PR body for re-review. 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.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The body reports benchmarks and test totals, but the supplied review context contains no inspectable after-fix terminal output, runtime log, recording, or linked artifact; add redacted evidence before merge and refresh the PR body for re-review. 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.
Evidence reviewed 8 items Activation-scoped metadata boundary: The proposed activation path resolves plugin metadata after staging, forces a fresh generation following a Codex registry reload, and passes the resulting plugin list to baseline, staged, and later route checks.
Route projection consumes prepared facts: The route resolver forwards the supplied manifest list into model selection and provider-auth alias resolution rather than performing independent metadata discovery.
Snapshot lifecycle contract: The metadata API uses the current compatible snapshot unless allowCurrent is false, then rebuilds a frozen metadata snapshot; this supports the branch's explicit post-install refresh boundary.
Findings None None.
Security None None.

How this fits together

System-agent setup stages a model and authentication route, validates it with a live inference attempt, then persists the verified route. This PR changes the metadata input used by route projection so model normalization and provider-auth alias lookup reuse one activation-scoped plugin manifest view.

flowchart LR
  A[Setup request] --> B[Stage model and plugin configuration]
  B --> C[Refresh plugin registry when needed]
  C --> D[Prepare manifest metadata once]
  D --> E[Project baseline and staged routes]
  E --> F[Run verified inference]
  F --> G[Persist and revalidate route]
Loading

Decision needed

Question Recommendation
Should this protected performance optimization be accepted after maintainers review redacted exact-head activation evidence and independently satisfy the Codex-source contract gate? Verify proof, then merge: Review a redacted real setup transcript for the staged alias and Codex refresh cases, confirm the upstream source contract, and merge if exact-head CI remains green.

Why: The code path affects model/provider routing and the required real-behavior and direct upstream-contract evidence cannot be completed from this read-only checkout.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The body reports benchmarks and test totals, but the supplied review context contains no inspectable after-fix terminal output, runtime log, recording, or linked artifact; add redacted evidence before merge and refresh the PR body for re-review. 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.
  • Resolve merge risk (P1) - Provider-auth aliases and model normalization now consume an activation-scoped manifest list; maintainers need real setup evidence covering a staged alias and the post-install Codex registry-refresh path before accepting the compatibility risk.
  • Resolve merge risk (P1) - The repository-required sibling ../codex source checkout is unavailable, so this review cannot independently validate the upstream Codex contract cited in the PR body.
Agent review details

Security

None.

PR surface

Source +72, Tests +36. Total +108 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 6 125 53 +72
Tests 2 36 0 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 161 53 +108

Review metrics

Metric Value Why it matters
Production versus test delta production +125/-53 (net +72); tests +36/-0 The production growth establishes one prepared-fact boundary across model selection and provider-auth route projection; the added tests cover metadata preparation and alias forwarding.

Stored data model

Persistent data-model change detected: vector/embedding metadata: src/agents/model-runtime-aliases.test.ts, vector/embedding metadata: src/system-agent/inference-route.ts, vector/embedding metadata: src/system-agent/setup-inference-activate.ts, vector/embedding metadata: src/system-agent/setup-inference-core.ts, vector/embedding metadata: src/system-agent/setup-inference.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Prove alias and refresh compatibility before merge (recommended)
    Attach redacted real activation output showing the staged provider-auth alias and a Codex registry refresh resolve to the expected route, then refresh review on that exact head.
  2. Pause until the runtime contract can be checked
    Do not merge the performance optimization while direct Codex-source verification and inspectable after-fix evidence remain unavailable.

Technical review

Best possible solution:

Retain the single activation-scoped manifest snapshot, but land only after exact-head evidence demonstrates stable baseline, staged, and persisted routes across an auth-alias case and a forced post-install registry refresh.

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

Not applicable as a defect reproduction: this PR optimizes an existing setup path. Source inspection identifies the affected activation and route-projection path, but no inspectable after-fix runtime benchmark or trace was supplied.

Is this the best way to solve the issue?

Unclear until real proof is available. The operation-scoped prepared-fact design matches the plugin metadata lifecycle, but route/auth compatibility should be demonstrated after staging and registry refresh before merge.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a bounded internal setup-performance optimization with no demonstrated user-facing correctness regression.
  • merge-risk: 🚨 auth-provider: The patch changes how plugin metadata feeds provider-auth alias resolution during verified system-agent setup and persistence checks.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The body reports benchmarks and test totals, but the supplied review context contains no inspectable after-fix terminal output, runtime log, recording, or linked artifact; add redacted evidence before merge and refresh the PR body for re-review. 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.

Evidence

What I checked:

  • Activation-scoped metadata boundary: The proposed activation path resolves plugin metadata after staging, forces a fresh generation following a Codex registry reload, and passes the resulting plugin list to baseline, staged, and later route checks. (src/system-agent/setup-inference-activate.ts:312, 7b0bffd149b0)
  • Route projection consumes prepared facts: The route resolver forwards the supplied manifest list into model selection and provider-auth alias resolution rather than performing independent metadata discovery. (src/system-agent/inference-route.ts:120, 7b0bffd149b0)
  • Snapshot lifecycle contract: The metadata API uses the current compatible snapshot unless allowCurrent is false, then rebuilds a frozen metadata snapshot; this supports the branch's explicit post-install refresh boundary. (src/plugins/plugin-metadata-snapshot.ts:295, e04caa6aee38)
  • Focused regression coverage: The branch adds coverage for caller-provided metadata auth aliases and asserts exactly one metadata preparation, including allowCurrent:false after the Codex registry refresh. (src/system-agent/setup-inference.test.ts:3951, 7b0bffd149b0)
  • Prior review finding addressed: The second branch commit removes the release-owned changelog edit; the final PR file list contains no CHANGELOG.md change. (CHANGELOG.md, 7b0bffd149b0)
  • Current-main and release status: The PR head is not an ancestor of current main and no containing release tag was found, so the optimization remains an open landing candidate rather than an implemented-main cleanup. (7b0bffd149b0)

Likely related people:

  • Peter Steinberger: Repository shortlog history makes Peter the dominant contributor across system-agent activation, route projection, and plugin metadata snapshot code; the branch boundary is also attributed to his proposed commit. (role: feature-history contributor; confidence: high; commits: aa5567823b72, 44c037fa1798; files: src/system-agent/setup-inference-activate.ts, src/system-agent/inference-route.ts, src/plugins/plugin-metadata-snapshot.ts)
  • Vincent Koc: History shows Vincent Koc touching the same system-agent activation and route-projection paths, making this a useful secondary reviewer for route lifecycle effects. (role: adjacent area contributor; confidence: low; commits: 27f5691d2937; files: src/system-agent/setup-inference-activate.ts, src/system-agent/inference-route.ts)

Rank-up moves

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

  • Attach redacted exact-head terminal or runtime evidence showing before/after activation timing and the staged auth-alias plus registry-refresh paths.
  • Have a reviewer with the sibling Codex checkout verify the cited upstream contract before treating the PR evidence as sufficient.

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 (3 earlier review cycles)
  • reviewed 2026-08-03T01:20:05.517Z sha fb58c4f :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-03T01:40:28.569Z sha 5d34a4f :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-03T05:38:34.031Z sha aa55678 :: needs real behavior proof before merge. :: [P2] Remove the release-owned changelog entry

@steipete
steipete force-pushed the codex/test-perf-setup-metadata branch from fb58c4f to 5d34a4f Compare August 3, 2026 01:34
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 3, 2026
@steipete
steipete force-pushed the codex/test-perf-setup-metadata branch from 5d34a4f to aa55678 Compare August 3, 2026 05:33
@clawsweeper clawsweeper Bot removed the rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. label Aug 3, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Aug 3, 2026
@steipete
steipete merged commit d7ab20a into main Aug 3, 2026
123 checks passed
@steipete
steipete deleted the codex/test-perf-setup-metadata branch August 3, 2026 05:52
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
)

* perf(system-agent): reuse setup metadata per activation

* chore: remove release-owned changelog entry

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M 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