Skip to content

improve(startup): avoid loading file writers for secret metadata - #148096

Merged
steipete merged 1 commit into
mainfrom
codex/secret-helper-import-boundary
Sep 14, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/secret-helper-import-boundary

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Loading secret-target metadata pulls filesystem-writing machinery through shared parsing helpers.

User Impact

Metadata discovery loads less code while retaining the complete secret-target registry and existing account behavior.

Why This Change Was Made

Move the atomic text writer into the existing secrets I/O adapter, already imported by its only caller, and make the shared record guard point directly to its canonical leaf module. The writer and its filesystem initialization wrappers move together. A duplicate adjacent doc comment is also removed.

Production is +23/-24 across three files; tests are unchanged. Persistence compatibility is preserved: the writer body is byte-identical, including private-file mode, restored nondefault modes, temporary-file prefix, and existing private-directory handling. Both apply/rollback call sites retain their arguments.

Evidence

The unchanged, unmocked registry/docs test exercises real public plugin artifacts through Jiti. Distinct transformed paths fall from 517 to 469: 48 removed, none added. Both traces have zero filesystem cache hits. The private writer, atomic replacement and broad utilities disappear from that import path; the executable Buzz account resolver remains. This establishes removed cold-import work, not a CI wall-time benchmark.

All 90 focused candidate cases passed, covering registry/docs parity, SDK/Buzz contracts, external discovery, apply/rollback, filesystem defaults and legacy-marker migration. All 29 classified checks passed. Independent P2 review found no actionable issues; the full build passed. The build also reported the existing unrelated UI startup-size warning, retained as a separate follow-up.

The patch was rebased byte-for-byte onto main's inherited UI lint repairs. Both formerly failing UI files pass the normal targeted lint command on that base.

@steipete
steipete requested a review from a team as a code owner September 14, 2026 08:37
@steipete steipete self-assigned this Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check could not safely complete for this revision.

ClawSweeper will not retry this unchanged revision.

Next step: No contributor action is requested. Maintainers should inspect the linked workflow run.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 14, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 10:16 AM ET / 14:16 UTC (Revision 2).

ClawSweeper review

What this changes

Moves atomic file writing into the existing secrets I/O adapter and directs shared parsing helpers to a lightweight record guard, reducing code loaded during secret-target discovery.

Merge readiness

✅ Ready for maintainer review

The optimization remains useful: current main and the latest release retain the heavier import path. No introduced correctness or security defect was found, and the maintainer-labeled PR is protected from cleanup closure.

Priority: P3
Reviewed head: da1a30cffe2577bdf13cc99a96470391419b9499

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving optimization with useful reported validation and no actionable patch findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies this as a maintainer PR, so the external-contributor proof gate does not apply. Its registry/docs import comparison addresses the changed loading path; focused apply/rollback results are supplemental, and no authority-chain proof exception is triggered.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies this as a maintainer PR, so the external-contributor proof gate does not apply. Its registry/docs import comparison addresses the changed loading path; focused apply/rollback results are supplemental, and no authority-chain proof exception is triggered.
Evidence reviewed 7 items Introduced change and preserved persistence behavior: The pinned merge-base-to-head diff moves the writer without changing its implementation, default permissions, nondefault-mode handling, or temporary-file prefix. Apply and rollback retain their arguments.
Complete writer cutover: Repository-wide source searches found one writer definition and only the apply module as its consumer, with calls at lines 833 and 933. No retained caller imports the removed shared export.
Record guard retains its existing owner: src/utils.ts already re-exports isRecord from the same workspace package leaf now used directly by secrets/shared.ts. The leaf rejects null and arrays; this changes import reachability without changing the predicate or plugin API.
Findings None None.
Security None None.

How this fits together

OpenClaw’s secret-target registry combines core and plugin metadata to identify configurable credential fields. Shared parsing supports discovery, while the secrets I/O adapter handles writes during apply and rollback.

flowchart TD
  A[Core and plugin metadata] --> B[Secret-target discovery]
  B --> C[Lightweight parsing helpers]
  B --> D[Available credential fields]
  E[Validated secrets plan] --> F[Secrets I/O adapter]
  F --> G[Atomic writes and rollback]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -1. Total -1 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 3 23 24 -1
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 23 24 -1

Review metrics

Metric Value Why it matters
Reported cold-import reduction 517 → 469 transformed paths; 48 removed, none added The PR reports reduced import work while retaining registry coverage; this is not a measured startup-time improvement.

Technical review

Best possible solution:

Keep metadata parsing lightweight while retaining the existing atomic writer, permission handling, and rollback behavior in the secrets I/O adapter.

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

Not applicable as a behavioral bug reproduction: source confirms the unnecessary import dependency, and the PR reports a cold-import comparison. No runtime commands or tests were executed during this read-only review.

Is this the best way to solve the issue?

Yes. Moving the unchanged writer to its existing consumer’s I/O adapter and bypassing a broad re-export removes unnecessary dependencies without adding another implementation or compatibility mode.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 716938393e34.

Labels

Label justifications:

  • P3: This is a bounded internal startup optimization with preserved external behavior.
  • 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 supplied repository state identifies this as a maintainer PR, so the external-contributor proof gate does not apply. Its registry/docs import comparison addresses the changed loading path; focused apply/rollback results are supplemental, and no authority-chain proof exception is triggered.

Evidence

What I checked:

  • Introduced change and preserved persistence behavior: The pinned merge-base-to-head diff moves the writer without changing its implementation, default permissions, nondefault-mode handling, or temporary-file prefix. Apply and rollback retain their arguments. (src/secrets/config-io.ts:28, da1a30cffe25)
  • Complete writer cutover: Repository-wide source searches found one writer definition and only the apply module as its consumer, with calls at lines 833 and 933. No retained caller imports the removed shared export. (src/secrets/apply.ts:36, da1a30cffe25)
  • Record guard retains its existing owner: src/utils.ts already re-exports isRecord from the same workspace package leaf now used directly by secrets/shared.ts. The leaf rejects null and arrays; this changes import reachability without changing the predicate or plugin API. (src/utils.ts:16, da1a30cffe25)
  • Still needed on fetched main: Fetched main still imports private-file-store, replace-file, and the broad utilities module through secrets/shared.ts. (src/secrets/shared.ts:4, 716938393e34)
  • Latest-release comparison: The supplied latest release, v2026.9.4, also retains the writer and its imports in secrets/shared.ts; the proposed optimization is not present there. (src/secrets/shared.ts:4, 3a9d69db306c)
  • Validation and re-review context: The captured PR body reports an unmocked registry/docs import comparison of 517 to 469 transformed paths, 90 focused passing cases, 29 passing classified checks, and a passing build. These are contributor-reported results, not reviewer executions. The previous completed review retained no findings or published rank-up moves. Its earlier source revision could not be retrieved for an independent rebase comparison. (da1a30cffe25)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • openclaw/openclaw-secops: 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-14T09:03:32.277Z sha 833c0a3 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/secret-helper-import-boundary branch from 833c0a3 to da1a30c Compare September 14, 2026 13:49
@steipete
steipete force-pushed the codex/secret-helper-import-boundary branch from da1a30c to bd75612 Compare September 14, 2026 16:43
@steipete
steipete merged commit 2f04a9e into main Sep 14, 2026
317 of 319 checks passed
@steipete
steipete deleted the codex/secret-helper-import-boundary branch September 14, 2026 20:53
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 14, 2026
* origin/main:
  perf(secrets): keep pure helpers out of file writer imports (#148096)
  perf(models): normalize suppression policy once per compilation (#148428)
  test: route provider integration and wizard recovery tests correctly (#148504)
  test: reuse prepared bundled plugins in startup corpus (#148465)
  fix(agents): attribute tool preparation delays to the correct stages (#148349)
  refactor: remove redundant Parallels source checks (#148394)
  fix(test): avoid timeout failures before descendant readiness (#148410)
  fix: open browser side panel without creating a dashboard (#148471)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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