Skip to content

fix: avoid rebuilding unchanged agent runtimes on reload - #129257

Merged
jalehman merged 3 commits into
mainfrom
oc-92a.6/prepared-runtime-scoped-invalidation
Aug 27, 2026
Merged

jalehman merged 3 commits into
mainfrom
oc-92a.6/prepared-runtime-scoped-invalidation

Conversation

@jalehman

@jalehman jalehman commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #120154

Supersedes #121299. Credit to @xydt-tanshanshan for the original agent-scoped refresh proposal and changed-path scope analysis. Thanks to reporter @shang-go for the multi-agent reproduction and performance evidence.

What Problem This Solves

Fixes an issue where any hot config reload rebuilt prepared model runtimes for every configured agent, so reload cost and event-loop blocking grew with the total agent count even when only one agent changed.

Why This Change Was Made

Agent-entry-local reloads now replace only the affected configured owners. Before retaining any other owner, the prepared-runtime lifecycle compares its complete normalized dependency key and plugin/catalog publication identity against the accepted config; shared, global, unknown, or changed dependencies fail safe to the existing full refresh.

The replacement is implemented against the current lifecycle owner rather than rebasing #121299's older config-rebinding approach. Retained readers keep immutable snapshots and auth bindings while new readers receive the accepted config stamp.

User Impact

Multi-agent gateways no longer rebuild every prepared model catalog and credential snapshot for a change isolated to one agents.entries.* owner. Shared defaults, plugin metadata, catalog mode, environment, workspace, auth-directory, and runtime-selection changes still rebuild all affected owners.

Evidence

  • Pre-fix regression: a two-agent local change expected build counts [2, 1] but current main produced [2, 2].

  • Fixed owner-boundary proof: 3 scoped-refresh tests passed, including retained artifacts, shared-dependency fallback, and new-owner creation.

  • Focused sibling proof: 112 prepared-runtime tests passed.

  • Gateway reload proof: 227 tests passed, including normalized scope propagation at the commit and rebuild boundaries.

  • pnpm tsgo:core passed.

  • Focused changed-file oxlint, formatting, and git diff --check passed.

  • node scripts/check-changed.mjs -- <changed paths> passed every selected guard through core production typing, then the linked worktree's core-test typecheck stopped on the unrelated missing pako declaration imported by ui/vite.config.ts. The runtime-sidecar guard likewise could not resolve worktree-local playwright-core; worktree dependencies were not reconciled.

  • Exact-head local repair validation ran from a clean detached worktree at pushed SHA 51a1be1cccafa1df2cf084fdd4de301925368c5d: type-aware oxlint and oxfmt --check passed for the three repair files; scoped refresh passed 3/3, Gateway reload passed 232/232, test-inventory coverage passed 13/13, and the real Gateway hot-reload E2E passed 1/1.

  • Exact-head Crabbox proof ran against pushed SHA 51a1be1cccafa1df2cf084fdd4de301925368c5d with provider blacksmith-testbox, lease tbx_01m10myajvpcbsbxt35740v1zq, and Actions run 33037132466.

  • The remote command required remote HEAD to equal that full SHA, fetched the same SHA, required zero diff for all ten changed paths, then ran the scoped two-agent rebuild regression, Gateway reload boundary suites, test-inventory coverage, and the real Gateway hot-reload E2E:

    node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --timing-json --shell -- 'set -euo pipefail; test "$(git rev-parse HEAD)" = 51a1be1cccafa1df2cf084fdd4de301925368c5d; git fetch origin 51a1be1cccafa1df2cf084fdd4de301925368c5d; git diff --exit-code 51a1be1cccafa1df2cf084fdd4de301925368c5d -- src/agents/prepared-model-runtime.refresh-scope.ts src/agents/prepared-model-runtime.scoped-refresh.test.ts src/agents/prepared-model-runtime.ts src/agents/prepared-model-runtime.types.ts src/gateway/server-reload-handlers.test.ts src/gateway/server-reload-hot.ts src/gateway/server-reload-model-runtime-scope.test.ts src/gateway/server-reload-model-runtime-scope.ts test/vitest-unit-fast-config.test.ts test/vitest/vitest.unit-fast-paths.mjs; OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 CI=1 NODE_OPTIONS=--max-old-space-size=4096 node scripts/run-vitest.mjs src/agents/prepared-model-runtime.scoped-refresh.test.ts src/gateway/server-reload-model-runtime-scope.test.ts src/gateway/server-reload-handlers.test.ts src/gateway/gateway.compaction-hot-reload.e2e.test.ts test/vitest-unit-fast-config.test.ts --run'
  • Result: PASS. The scoped regression passed 3/3 tests, Gateway reload passed 232/232 tests, test-inventory coverage passed 13/13 tests, and the built real-Gateway config-reload/agent-turn E2E passed 1/1. Crabbox reported exitCode=0, runStatus=succeeded, and commandMs=346453.

  • Cleanup: the one-shot wrapper stopped the lease after success. blacksmith testbox status --id tbx_01m10myajvpcbsbxt35740v1zq independently reports completed with no IP and links the same Actions run.

  • Repository autoreview --mode local: TruffleHog clean; no accepted/actionable findings; patch judged correct with 0.97 confidence.

AI Assistance

AI assistance was used for issue and prior-PR analysis, implementation, regression tests, validation, review, and PR drafting. The final diff was manually inspected against the prepared-runtime lifecycle and Gateway reload owner boundaries.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Aug 25, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 11:54 PM ET / August 27, 2026, 03:54 UTC.

ClawSweeper review

What this changes

This PR scopes Gateway hot-reload runtime rebuilding to changed agent entries while retaining unaffected prepared runtimes only when their dependencies remain identical.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for the protected maintainer review path. The scoped refresh is a sound repair: it preserves the all-owner fallback whenever retained runtime inputs differ, and the PR includes exact-head real-Gateway proof.

Likely related people: Peter Steinberger (high confidence) introduced the current prepared-runtime lifecycle on main.

Priority: P2
Reviewed head: 51a1be1cccafa1df2cf084fdd4de301925368c5d
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong exact-head runtime proof and lifecycle validation support a normal human merge review.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR supplies exact-head Crabbox evidence of a built real Gateway hot-reloading configuration and completing agent-turn E2E validation; redact any private environment details if this proof is republished.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR supplies exact-head Crabbox evidence of a built real Gateway hot-reloading configuration and completing agent-turn E2E validation; redact any private environment details if this proof is republished.
Evidence reviewed 8 items Gateway entry and propagation: The Gateway derives an agent-ID candidate from changed paths and passes the same scope both at the synchronous publication edge and to the asynchronous rebuild.
Retention safety boundary: Before retaining an out-of-scope configured owner, the lifecycle checks its normalized owner key, snapshot state, catalog mode, and plugin metadata identity; any mismatch forces a full refresh.
Shared inherited-auth fallback: Configured owner inputs include the legacy inherited-auth directory, so a default-agent-derived input change changes the retained owner key and is rejected by the safety check rather than leaving an old runtime active.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/gateway/gateway.compaction-hot-reload.e2e.test.ts --run

Result: FAIL (failed) — step 1 run node scripts/run-vitest.mjs src/gateway/gateway.compaction-hot-reload.e2e.test.ts --run: previous terminal command was still running after 30 seconds: "node scripts/run-vitest.mjs src/gateway/gateway.compaction-hot-reload.e2e.test.ts --run"

[test] starting test/vitest/vitest.e2e.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-129257-zgfjcb/target

[openclaw] Building TypeScript (dist is stale: missing_private_qa_dist - private QA dist entry missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
  - tsdown:deps (49%)
  - rolldown-plugin-dts:generate (21%)
  - rolldown-plugin-dts:fake-js (19%)
See https://rolldown.rs/reference/InputOptions.checks#plugintimings for more details.

[tsdown-build] invocation 1/11 finished in 4.6s
[tsdown-build] invocation 2/11 finished in 22.7s

Assertions:

  • FAIL expect_output: 1 passed

How this fits together

Gateway hot reload consumes changed configuration paths and refreshes prepared model runtimes used by agent turns. The change proposes a narrow refresh candidate, while the runtime lifecycle decides whether that candidate is safe to retain.

flowchart LR
A[Configuration change] --> B[Gateway reload plan]
B --> C[Agent-entry scope candidate]
C --> D[Runtime lifecycle validation]
D -->|Dependencies match| E[Scoped rebuild]
D -->|Dependency differs| F[Full rebuild]
E --> G[Agent turns]
F --> G
Loading

Decision needed

Question Recommendation
Should this maintainer-owned Gateway lifecycle change be merged after the normal owner review? Review and merge: Accept the scoped refresh because retained owners are validated against complete prepared-runtime dependencies and exact-head Gateway proof is available.

Why: The item carries the protected maintainer label, so the automated review should not close or finalize it despite a clean technical review.

Before merge

  • Resolve merge risk (P2) - This changes the Gateway’s prepared-runtime publication boundary; although retained owners are revalidated and exact-head Gateway proof is supplied, the maintainer-owned merge decision should retain the conservative full-refresh fallback.
Agent review details

Security

None.

PR surface

Source +192, Tests +186. Total +378 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 5 248 56 +192
Tests 5 188 2 +186
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 436 58 +378

Review metrics

Metric Value Why it matters
Production and test delta production +192 net, tests +186 net The positive production growth implements a lifecycle safety comparison and scoped publication path; the accompanying tests cover the main retained-owner and fallback cases.

Stored data model

Persistent data-model change detected: vector/embedding metadata: src/gateway/server-reload-model-runtime-scope.test.ts, vector/embedding metadata: src/gateway/server-reload-model-runtime-scope.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #120154
Summary: This PR is a viable candidate fix for the canonical prepared-runtime reload-granularity issue.

Members:

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

Merge-risk options

Maintainer options:

  1. Accept the validated lifecycle change (recommended)
    After owner review, merge with the existing full-refresh fallback retained for any changed prepared-runtime dependency.
  2. Pause for additional coverage
    Keep the PR open if maintainers want more real-Gateway reload scenarios before changing this availability-sensitive lifecycle path.

Technical review

Best possible solution:

Merge the scoped-refresh implementation after owner review, preserving its complete lifecycle-input comparison as the single authority for falling back to a full rebuild.

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

Yes. The supplied exact-head proof records the two-agent rebuild regression and a real-Gateway hot-reload run; source inspection confirms the proposed scope is revalidated at the lifecycle owner before retention.

Is this the best way to solve the issue?

Yes. Passing an agent-local candidate from the Gateway while letting the prepared-runtime owner validate complete dependencies is more maintainable than encoding every shared dependency in the path classifier.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies exact-head Crabbox evidence of a built real Gateway hot-reloading configuration and completing agent-turn E2E validation; redact any private environment details if this proof is republished.

Label justifications:

  • P2: The PR fixes multi-agent reload latency and potential event-loop blocking without evidence of an emergency outage.
  • merge-risk: 🚨 availability: Prepared runtime publication gates agent work during Gateway hot reload, so an incorrect lifecycle change could affect post-reload availability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR supplies exact-head Crabbox evidence of a built real Gateway hot-reloading configuration and completing agent-turn E2E validation; redact any private environment details if this proof is republished.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies exact-head Crabbox evidence of a built real Gateway hot-reloading configuration and completing agent-turn E2E validation; redact any private environment details if this proof is republished.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes the prepared-runtime publication and Gateway reload boundaries to the commit that introduced this lifecycle. (role: current lifecycle introducer; confidence: high; commits: bbd66c475e41; files: src/agents/prepared-model-runtime.ts, src/gateway/server-reload-hot.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 (3 earlier review cycles)
  • reviewed 2026-08-25T11:07:54.522Z sha d172cf8 :: needs changes before merge. :: [P2] Avoid repeated full-owner scans during a scoped refresh
  • reviewed 2026-08-25T11:35:31.649Z sha 9f69979 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-27T03:30:44.439Z sha 51a1be1 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 25, 2026
@jalehman
jalehman force-pushed the oc-92a.6/prepared-runtime-scoped-invalidation branch from 9f69979 to 579b79e Compare August 27, 2026 03:14
@jalehman

jalehman commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Exact-head Crabbox/Blacksmith Testbox behavioral proof is complete.

  • Pushed SHA: 51a1be1cccafa1df2cf084fdd4de301925368c5d
  • Provider: blacksmith-testbox
  • Lease: tbx_01m10kye1j9y9mxqqa9jpkyww8
  • Run: https://github.com/openclaw/openclaw/actions/runs/33036261382
  • Scenario: fetch the pushed SHA and require zero diff for all ten changed paths; run the two-agent scoped rebuild regression; run the Gateway commit/rebuild scope boundary; build the exact candidate; start a real Gateway; hot-reload config; send agent turns and verify the new tool and compaction policy without restart.
  • Result: PASS. Scoped refresh 3/3; Gateway reload 232/232; test-inventory coverage 13/13; real Gateway hot-reload E2E 1/1. Crabbox reported exitCode=0, runStatus=succeeded, and commandMs=334985.
  • Cleanup: the one-shot wrapper stopped the lease after success. An independent blacksmith testbox status --id tbx_01m10kye1j9y9mxqqa9jpkyww8 reports completed with no IP.

Exact command:

node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --timing-json --shell -- 'set -euo pipefail; git fetch origin 51a1be1cccafa1df2cf084fdd4de301925368c5d; git diff --exit-code 51a1be1cccafa1df2cf084fdd4de301925368c5d -- src/agents/prepared-model-runtime.refresh-scope.ts src/agents/prepared-model-runtime.scoped-refresh.test.ts src/agents/prepared-model-runtime.ts src/agents/prepared-model-runtime.types.ts src/gateway/server-reload-handlers.test.ts src/gateway/server-reload-hot.ts src/gateway/server-reload-model-runtime-scope.test.ts src/gateway/server-reload-model-runtime-scope.ts test/vitest-unit-fast-config.test.ts test/vitest/vitest.unit-fast-paths.mjs; OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 CI=1 NODE_OPTIONS=--max-old-space-size=4096 node scripts/run-vitest.mjs src/agents/prepared-model-runtime.scoped-refresh.test.ts src/gateway/server-reload-model-runtime-scope.test.ts src/gateway/server-reload-handlers.test.ts src/gateway/gateway.compaction-hot-reload.e2e.test.ts test/vitest-unit-fast-config.test.ts --run'

The PR body now contains the same durable proof record. The previous exact-head CI lint failure was repaired by moving refresh option assembly from server-reload-hot.ts into the existing reload-scope owner; focused lint and core typecheck pass. This PR remains open and unmerged.

@jalehman

Copy link
Copy Markdown
Contributor Author

Exact-head Crabbox/Blacksmith Testbox behavioral proof is complete.

  • Pushed SHA: 51a1be1cccafa1df2cf084fdd4de301925368c5d
  • Provider: blacksmith-testbox (Crabbox 0.41.1)
  • Lease: tbx_01m10m7vk2ngs5h9t9ygkqjmh5
  • Run: https://github.com/openclaw/openclaw/actions/runs/33036513551
  • Scenario: fetch the exact pushed SHA and require zero diff for all ten changed paths; run the two-agent scoped rebuild regression; run the Gateway commit/rebuild scope boundary; validate fast-test inventory coverage; build the exact candidate; start a real Gateway; hot-reload config; send agent turns and verify the new tool policy, context budgets, and compaction models without restart.
  • Result: PASS. Scoped refresh 3/3; Gateway reload 232/232; test-inventory coverage 13/13; real Gateway hot-reload E2E 1/1. Crabbox reported exitCode=0, runStatus=succeeded, commandMs=345713, and the built Gateway identified itself as OpenClaw 2026.8.1 (51a1be1).
  • Cleanup: the one-shot wrapper stopped the lease after success. Independent blacksmith testbox status --id tbx_01m10m7vk2ngs5h9t9ygkqjmh5 reports completed with no IP.
  • Post-proof head check: GitHub still reports 51a1be1cccafa1df2cf084fdd4de301925368c5d; PR remains open and unmerged.

Exact command:

node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --timing-json --shell -- 'set -euo pipefail; git fetch origin 51a1be1cccafa1df2cf084fdd4de301925368c5d; git diff --exit-code 51a1be1cccafa1df2cf084fdd4de301925368c5d -- src/agents/prepared-model-runtime.refresh-scope.ts src/agents/prepared-model-runtime.scoped-refresh.test.ts src/agents/prepared-model-runtime.ts src/agents/prepared-model-runtime.types.ts src/gateway/server-reload-handlers.test.ts src/gateway/server-reload-hot.ts src/gateway/server-reload-model-runtime-scope.test.ts src/gateway/server-reload-model-runtime-scope.ts test/vitest-unit-fast-config.test.ts test/vitest/vitest.unit-fast-paths.mjs; OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 CI=1 NODE_OPTIONS=--max-old-space-size=4096 node scripts/run-vitest.mjs src/agents/prepared-model-runtime.scoped-refresh.test.ts src/gateway/server-reload-model-runtime-scope.test.ts src/gateway/server-reload-handlers.test.ts src/gateway/gateway.compaction-hot-reload.e2e.test.ts test/vitest-unit-fast-config.test.ts --run'

@jalehman

Copy link
Copy Markdown
Contributor Author

Exact-head Crabbox/Blacksmith Testbox behavioral proof is complete.

  • Pushed SHA: 51a1be1cccafa1df2cf084fdd4de301925368c5d
  • Provider: blacksmith-testbox
  • Lease: tbx_01m10myajvpcbsbxt35740v1zq
  • Run: https://github.com/openclaw/openclaw/actions/runs/33037132466
  • Scenario: require remote HEAD to equal the full pushed SHA, fetch that SHA, require zero diff for all ten changed paths, run the two-agent scoped rebuild regression and Gateway commit/rebuild scope boundary, build the exact candidate, start a real Gateway, hot-reload config, send agent turns, and verify the new tool and compaction policy without restart.
  • Result: PASS. Scoped refresh 3/3; Gateway reload 232/232; test-inventory coverage 13/13; real Gateway hot-reload E2E 1/1. Crabbox reported exitCode=0, runStatus=succeeded, and commandMs=346453.
  • Cleanup: the one-shot wrapper stopped the lease after success. An independent blacksmith testbox status --id tbx_01m10myajvpcbsbxt35740v1zq reports completed with no IP and links the same Actions run.

Exact command:

node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --timing-json --shell -- 'set -euo pipefail; test "$(git rev-parse HEAD)" = 51a1be1cccafa1df2cf084fdd4de301925368c5d; git fetch origin 51a1be1cccafa1df2cf084fdd4de301925368c5d; git diff --exit-code 51a1be1cccafa1df2cf084fdd4de301925368c5d -- src/agents/prepared-model-runtime.refresh-scope.ts src/agents/prepared-model-runtime.scoped-refresh.test.ts src/agents/prepared-model-runtime.ts src/agents/prepared-model-runtime.types.ts src/gateway/server-reload-handlers.test.ts src/gateway/server-reload-hot.ts src/gateway/server-reload-model-runtime-scope.test.ts src/gateway/server-reload-model-runtime-scope.ts test/vitest-unit-fast-config.test.ts test/vitest/vitest.unit-fast-paths.mjs; OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 CI=1 NODE_OPTIONS=--max-old-space-size=4096 node scripts/run-vitest.mjs src/agents/prepared-model-runtime.scoped-refresh.test.ts src/gateway/server-reload-model-runtime-scope.test.ts src/gateway/server-reload-handlers.test.ts src/gateway/gateway.compaction-hot-reload.e2e.test.ts test/vitest-unit-fast-config.test.ts --run'

The PR body now contains the same durable proof record. This PR remains open and unmerged.

@jalehman

Copy link
Copy Markdown
Contributor Author

Independent exact-head Crabbox/Blacksmith Testbox behavioral proof is complete.

  • Pushed SHA: 51a1be1cccafa1df2cf084fdd4de301925368c5d
  • Provider: blacksmith-testbox (Crabbox 0.41.1)
  • Lease: tbx_01m10phs3xcz1zhhfe69838ejg
  • Run: https://github.com/openclaw/openclaw/actions/runs/33038556870
  • Scenario: from a clean dedicated worktree at the live PR head, require remote HEAD to equal the full pushed SHA, fetch that SHA, require zero diff for all ten changed paths, run the two-agent scoped prepared-runtime rebuild regression and Gateway commit/rebuild scope boundary, validate fast-test inventory coverage, build the exact candidate, start a real Gateway, hot-reload config, send agent turns, and verify the new tool policy, context budgets, and compaction models without restart.
  • Result: PASS. Scoped refresh 3/3; Gateway reload 232/232; test-inventory coverage 13/13; real Gateway hot-reload E2E 1/1. The built Gateway identified itself as OpenClaw 2026.8.1 (51a1be1). Crabbox reported exitCode=0, runStatus=succeeded, commandMs=334613, and totalMs=336749.
  • Cleanup: the one-shot wrapper stopped the lease after success. Independent blacksmith testbox status --id tbx_01m10phs3xcz1zhhfe69838ejg reports completed with no IP and links the same Actions run.
  • Post-proof head check: GitHub still reports 51a1be1cccafa1df2cf084fdd4de301925368c5d; the PR remains open and unmerged. Required CI gate and focused lint/type/test checks are passing.

Exact command:

node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --timing-json --shell -- 'set -euo pipefail; test "$(git rev-parse HEAD)" = 51a1be1cccafa1df2cf084fdd4de301925368c5d; test -z "$(git status --porcelain)"; git fetch origin 51a1be1cccafa1df2cf084fdd4de301925368c5d; git diff --exit-code 51a1be1cccafa1df2cf084fdd4de301925368c5d -- src/agents/prepared-model-runtime.refresh-scope.ts src/agents/prepared-model-runtime.scoped-refresh.test.ts src/agents/prepared-model-runtime.ts src/agents/prepared-model-runtime.types.ts src/gateway/server-reload-handlers.test.ts src/gateway/server-reload-hot.ts src/gateway/server-reload-model-runtime-scope.test.ts src/gateway/server-reload-model-runtime-scope.ts test/vitest-unit-fast-config.test.ts test/vitest/vitest.unit-fast-paths.mjs; OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 CI=1 NODE_OPTIONS=--max-old-space-size=4096 node scripts/run-vitest.mjs src/agents/prepared-model-runtime.scoped-refresh.test.ts src/gateway/server-reload-model-runtime-scope.test.ts src/gateway/server-reload-handlers.test.ts src/gateway/gateway.compaction-hot-reload.e2e.test.ts test/vitest-unit-fast-config.test.ts --run'

@jalehman

Copy link
Copy Markdown
Contributor Author

Land-ready verification is complete at exact head 51a1be1cccafa1df2cf084fdd4de301925368c5d.

  • Native review artifacts: validated with READY FOR /prepare-pr, zero findings.
  • Fresh mandatory autoreview: clean; patch correct (0.98 confidence), no accepted/actionable findings.
  • Exact-head GitHub CI: required openclaw/ci-gate passed; no failing or pending required checks.
  • Real behavior proof: Blacksmith Testbox run 33037132466, lease tbx_01m10myajvpcbsbxt35740v1zq; scoped refresh 3/3, Gateway reload 232/232, inventory 13/13, built real-Gateway hot-reload E2E 1/1.
  • Native prepare: OPENCLAW_TESTBOX=1 scripts/pr prepare-run 129257 passed using hosted exact-head gates; prep head and PR head both matched the SHA above, with no push required.
  • Proof gaps: none for the changed lifecycle boundary.

Commands:

env -u CODEX_HOME .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --stream-engine-output
OPENCLAW_TESTBOX=1 scripts/pr prepare-run 129257

@jalehman
jalehman merged commit 8d82e26 into main Aug 27, 2026
210 of 211 checks passed
@jalehman
jalehman deleted the oc-92a.6/prepared-runtime-scoped-invalidation branch August 27, 2026 07:32
@jalehman

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

* fix: scope prepared runtime refreshes by agent (oc-92a.6)

* fix: keep scoped runtime refresh linear (oc-92a.6)

* fix: keep gateway reload hot path within lint limit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

[Bug]: config reload unconditionally rebuilds all prepared-model runtime snapshots for every agents.entries.*

1 participant