Repository navigation
perf(config): share synchronous authority checks during guarded writes - #154758
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. Reviewed September 21, 2026, 8:52 AM ET / 12:52 UTC (Revision 4). ClawSweeper reviewWhat this changesThe PR shares repeated ownership checks within each synchronous config-write assertion while preserving fresh checks between calls, terminal refusals, and extracted-tool dependencies. Merge readiness⛔ Needs changes before merge - 1 item remains This remains a useful optimization absent from current main and the latest release. No introduced correctness defect was found; the prior test-cost evidence follow-up remains incomplete. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s config writer receives changes from configuration commands and the updater, verifies current ownership, and publishes root or included configuration files. Its guards also protect backup rotation and recovery. flowchart TD
A[Configuration or update request] --> B[Config write lock]
B --> C[Compose current ownership checks]
C --> D{Authority still valid?}
D -->|Yes| E[Publish config and backups]
D -->|No| F[Refuse write]
E --> C
Before merge
Agent review detailsSecurityNone. PR surfaceSource +41, Tests +74, Other +1. Total +116 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one config-owned assertion composer that shares synchronous observations while preserving live checks at every subsequent write boundary. Do we have a high-confidence way to reproduce the issue? Yes, source establishes repeated calls when root and include scopes share an authority callback; the PR reports the original count regression failing three calls versus one. This read-only review did not execute tests. Is this the best way to solve the issue? Yes. Sharing leaf checks only inside one synchronous invocation addresses the redundant work without introducing a second authority owner or caching approval across write effects. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 21273684d49e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
openclaw#154758) * fix(config): avoid repeated authority checks during guarded writes * fix(config): include write authority in extracted wrappers
Related: #152864 and #152922.
What Problem This Solves
Nested config-write guards repeatedly called the same authority leaf within one synchronous observation. The original-code regression failed
expected "vi.fn()" to be called 1 times, but got 3 times.User Impact
User impact: guarded config writes avoid duplicate synchronous checks while still refusing revoked authority and preserving write ordering and cleanup.
Why This Change Was Made
Compose assertions at the config-write owner, share identical leaves only during the current call, and retain a refusal once observed. Fresh invocations still revalidate; awaits and effect boundaries do not reuse stale approval. Apply the same owner to locking, include writes, backup rotation, and update-channel writes. Include the new module in the authoritative wrapper component manifest so extracted maintainer tools use that same owner.
Evidence
The original-code count regression failed as intended. R24 owner proof covers write-lock/drainage and authority-refusal behavior. R25 delegated include writes passed 20/20 × 3 cases, including healthy publication and replaced-owner/directory refusals, with standalone walls 13.292–20.578 s and effective CLI cap 8.
The Linux published-driver cell 2026.9.4 → R25 candidate 2026.9.5 passed authenticated managed restart, version/build health, Doctor lint and backup rollback. Its earlier harness shim PID is not independent proof of the actual Gateway PID.
R25 full
check-changed(1,872.628 s) and formatting passed. Type-aware coverage is clean: unchanged R24 lanes were reused, the two changed R25 files were checked, and the same lint engine has a verified semantic canary. R24 denotes treeadf4aae5619f; R25 denotes41622da0c24f. Runtime qualification used the combined recorded trees; exact branch CI is tracked below.Initial CI at
74587dcc4ef9failed the extracted-wrapper closure guard and four provisioning cases becausewrite-authority.tswas missing from the wrapper inventory. Commit988eb1f208c2adds that single authoritative inventory entry. Assertions and budgets are unchanged; the original failed run is retained. CI for the corrected head passed. All five previously failing closure/provisioning assertions passed. Whole CLI: 632.45 s Vitest / 696 s job, still pinned to two workers on the 16-class runner; this is not eight-worker CI proof.Retained Linux combined-tree proof used
OPENCLAW_VITEST_MAX_WORKERS=8.write-lock.drainage.test.tspassed all 10 cases with 0.069 s of summed printed case durations, within a two-file runtime-config shard that completed in 10.53 s (25 passed). This is grouped proof, not an explicit one-worker per-file wall measurement.