Skip to content

perf(config): share synchronous authority checks during guarded writes - #154758

Merged
steipete merged 2 commits into
mainfrom
ci-burden/h7-config
Sep 21, 2026
Merged

steipete merged 2 commits into
mainfrom
ci-burden/h7-config

Conversation

@steipete

@steipete steipete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

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 tree adf4aae5619f; R25 denotes 41622da0c24f. Runtime qualification used the combined recorded trees; exact branch CI is tracked below.

  • Fresh branch review: scoped-clean through P2, no findings.
    Initial CI at 74587dcc4ef9 failed the extracted-wrapper closure guard and four provisioning cases because write-authority.ts was missing from the wrapper inventory. Commit 988eb1f208c2 adds 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.ts passed 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.

@clawsweeper

clawsweeper Bot commented Sep 21, 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 cli CLI command changes size: M maintainer Maintainer-authored PR labels Sep 21, 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 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 21, 2026, 8:52 AM ET / 12:52 UTC (Revision 4).

ClawSweeper review

What this changes

The 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
Reviewed head: 988eb1f208c2c4c8c29762f2c2dc25d72ad01834

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable optimization with meaningful regression coverage and no blocking code findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor gate does not apply under the supplied MEMBER classification. Reported Linux upgrade and replaced-owner publication evidence supports the affected config path; source review found no unresolved authority-lifetime expansion requiring additional final-effect proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor gate does not apply under the supplied MEMBER classification. Reported Linux upgrade and replaced-owner publication evidence supports the affected config path; source review found no unresolved authority-lifetime expansion requiring additional final-effect proof.
Evidence reviewed 9 items Pinned introduced change: Reviewed the merge-base-to-head delta. The follow-up commit only adds the new authority module to the extracted-wrapper inventory; endpoint drift was not attributed to this PR.
Bounded observation lifetime: Each public assertion invocation creates a fresh checked set. Composed guards are traversed even when their leaves were previously checked, so a retained refusal is still observed. Successful checks are not retained across calls.
Final filesystem boundaries remain guarded: Reviewed lock admission, include publication, backup rotation, and rollback callers. The filesystem adapter still invokes ownership and publication checks before writes, renames, and non-private removals; the patch does not replace those checks with a persistent approval.
Findings None None.
Security None None.

How this fits together

OpenClaw’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
Loading

Before merge

  • Complete next step (P2) - Record the wall time for pnpm test src/config/write-lock.drainage.test.ts --maxWorkers=1 and the file’s CI duration when available; distinguish both from the supplied grouped timings.
Agent review details

Security

None.

PR surface

Source +41, Tests +74, Other +1. Total +116 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 7 88 47 +41
Tests 1 74 0 +74
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 9 163 47 +116

Review metrics

Metric Value Why it matters
Production versus test growth Production +41 net lines; tests +74; tooling inventory +1 Production growth has a stated purpose: a shared observation owner replaces duplicated composition while tests protect refusal and revalidation behavior.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This is a bounded config-write performance improvement without evidence of an urgent user-facing 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 ordinary external-contributor gate does not apply under the supplied MEMBER classification. Reported Linux upgrade and replaced-owner publication evidence supports the affected config path; source review found no unresolved authority-lifetime expansion requiring additional final-effect proof.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head delta. The follow-up commit only adds the new authority module to the extracted-wrapper inventory; endpoint drift was not attributed to this PR. (scripts/pr-lib/wrapper-components.txt:462, 988eb1f208c2)
  • Bounded observation lifetime: Each public assertion invocation creates a fresh checked set. Composed guards are traversed even when their leaves were previously checked, so a retained refusal is still observed. Successful checks are not retained across calls. (src/config/write-authority.ts:7, 988eb1f208c2)
  • Final filesystem boundaries remain guarded: Reviewed lock admission, include publication, backup rotation, and rollback callers. The filesystem adapter still invokes ownership and publication checks before writes, renames, and non-private removals; the patch does not replace those checks with a persistent approval. (src/config/io.write-safety.ts:393, 988eb1f208c2)
  • Owner-boundary regression coverage: The added drainage cases check duplicate-leaf elimination, revalidation after awaits, closed-scope refusal, ordering, and terminal refusal. Existing config-publication tests exercise healthy writes and replaced executor ownership, including revocation during fsync, and assert preserved config and backup artifacts. (src/config/write-lock.drainage.test.ts:262, 988eb1f208c2)
  • Current-main necessity: Current main still invokes each guarded scope separately and builds nested checks with ordinary closures. It does not contain the proposed shared assertion owner. (src/config/write-lock.ts:40, 21273684d49e)
  • Latest-release comparison: The supplied latest release, v2026.9.5, also contains the separate nested-check implementation. Neither linked merged PR implements this config-write optimization. (src/config/write-lock.ts:40, ec9c1a13db89)

Likely related people:

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

Rank-up moves

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

  • Complete the existing test-cost evidence request with the drainage file’s single-worker wall time and available file-specific CI duration.

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-09-21T11:21:11.134Z sha 74587dc :: needs changes before merge. :: none
  • reviewed 2026-09-21T11:32:25.117Z sha 74587dc :: needs changes before merge. :: none
  • reviewed 2026-09-21T12:07:20.315Z sha 988eb1f :: needs changes before merge. :: none

@steipete
steipete marked this pull request as ready for review September 21, 2026 11:24
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 21, 2026
@steipete
steipete enabled auto-merge (squash) September 21, 2026 13:02
@steipete
steipete merged commit 870ff12 into main Sep 21, 2026
222 of 223 checks passed
@steipete
steipete deleted the ci-burden/h7-config branch September 21, 2026 13:03
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
openclaw#154758)

* fix(config): avoid repeated authority checks during guarded writes

* fix(config): include write authority in extracted wrappers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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.

1 participant