Skip to content

improve(startup): skip redundant single-agent directory checks - #152192

Merged
steipete merged 1 commit into
mainfrom
codex/startup-single-agent-directory-check-b0a1
Sep 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/startup-single-agent-directory-check-b0a1

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Startup config validation probes agent directories for collisions even when only one distinct agent is configured.

User Impact

Single-agent configurations skip unnecessary filesystem work and keep the same validation result. Multi-agent directory conflict checks are unchanged. No configuration changes or migrations are required.

Why This Change Was Made

Reuse the existing normalized, deduplicated agent IDs and return before directory resolution when fewer than two remain. One agent referenced by its entry, default and bindings still counts once.

Evidence

  • The regression uses the real config validator: original code makes one native path-resolution call for the sole agent directory; the candidate makes none and validates successfully. Original RED is retained. Its proof classifier stopped afterward on abbreviated Vitest error text; the continuation did not repeat RED or change source.
  • Focused proof and selected checks pass: 17 tests covering the config entry point, shared-directory rejection, selected home environments, filesystem aliases/case and missing-parent behavior, plus type-aware checks and formatting.
  • Fresh independent P2 review found no issues. Imports and build inputs are unchanged; no full build was needed.
  • The motivating Windows profile attributed two pre-configuration samples (3.184 ms) to this owner. This is a small work reduction, not a measured end-to-end startup speedup; no new Windows latency result is claimed.

@clawsweeper

clawsweeper Bot commented Sep 18, 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.

@steipete
steipete marked this pull request as ready for review September 18, 2026 22:07
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 18, 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 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 6:13 PM ET / 22:13 UTC.

ClawSweeper review

What this changes

Skip filesystem collision checks when configuration references fewer than two distinct agents, with a regression test through the config validator.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a useful, narrowly scoped optimization absent from current main and the latest release. No actionable correctness or security defect was found.

Priority: P3
Reviewed head: bfc5fa15ed6a8220753087b8495cb1507086dafb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with a meaningful validator regression test and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored internal optimization; the captured evidence targets the real config validator, but its linked test logs could not be independently inspected.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored internal optimization; the captured evidence targets the real config validator, but its linked test logs could not be independently inspected.
Evidence reviewed 7 items Introduced optimization preserves collision semantics: The complete production module collects normalized IDs into a Set. The introduced early return therefore excludes only cases where the unchanged final filter could never report a collision; the multi-agent loop remains intact.
Regression exercises the validation entry point: The new test references alpha through its entry, default marker, and binding, then verifies successful validation without a native realpath call for its directory. Existing tests cover shared-directory rejection, selected home environments, aliases, case handling, and missing directories. Tests were inspected, not executed during this read-only review.
Current main still performs the redundant work: The fetched main implementation iterates every referenced ID and resolves its directory without a cardinality guard. The PR remains useful against the recorded main revision.
Findings None None.
Security None None.

How this fits together

OpenClaw configuration validation checks whether agents share a state directory, which could mix authentication and session data. This change avoids resolving filesystem identities when only one distinct agent is referenced.

flowchart TD
  A[Agent entries and bindings] --> B[Normalize and deduplicate agent IDs]
  B --> C{At least two agents?}
  C -->|No| D[No directory conflicts]
  C -->|Yes| E[Resolve filesystem identities]
  E --> F[Report shared directories]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +4, Tests +16. Total +20 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 1 +4
Tests 1 16 0 +16
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 21 1 +20

Review metrics

None.

Technical review

Best possible solution:

Keep the cardinality fast path in the existing collision-check owner while preserving all multi-agent filesystem checks.

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

Yes, source establishes that current main resolves the sole referenced agent's directory despite requiring multiple agents to report a collision; no runtime reproduction was executed here.

Is this the best way to solve the issue?

Yes, the guard uses the existing deduplicated IDs at the owning function and changes neither configuration contracts nor multi-agent validation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6d43ed90854e.

Labels

Label changes:

  • add P3: This is a small startup work reduction with unchanged validation results and no claimed end-to-end latency improvement.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this maintainer-authored internal optimization; the captured evidence targets the real config validator, but its linked test logs could not be independently inspected.

Label justifications:

  • P3: This is a small startup work reduction with unchanged validation results and no claimed end-to-end latency improvement.
  • 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 external-contributor proof gate does not apply to this maintainer-authored internal optimization; the captured evidence targets the real config validator, but its linked test logs could not be independently inspected.

Evidence

What I checked:

  • Introduced optimization preserves collision semantics: The complete production module collects normalized IDs into a Set. The introduced early return therefore excludes only cases where the unchanged final filter could never report a collision; the multi-agent loop remains intact. (src/config/agent-dirs.ts:98, bfc5fa15ed6a)
  • Regression exercises the validation entry point: The new test references alpha through its entry, default marker, and binding, then verifies successful validation without a native realpath call for its directory. Existing tests cover shared-directory rejection, selected home environments, aliases, case handling, and missing directories. Tests were inspected, not executed during this read-only review. (src/config/config.multi-agent-agentdir-validation.test.ts:14, bfc5fa15ed6a)
  • Current main still performs the redundant work: The fetched main implementation iterates every referenced ID and resolves its directory without a cardinality guard. The PR remains useful against the recorded main revision. (src/config/agent-dirs.ts:98, 6d43ed90854e)
  • Latest release also lacks the fast path: GitHub contents for v2026.9.4 show the same unconditional directory-resolution loop. The release source was retrieved through the API after local release-object retrieval failed. (src/config/agent-dirs.ts, 3a9d69db306c)
  • Validation evidence and inspection limits: The captured PR body reports original RED and 17 passing candidate tests, without claiming measured startup latency improvement. Both linked workflow runs currently report cancelled; the candidate run's Testbox step is cancelled. Detailed logs redirect to a host blocked by this review environment, so the reported inner test results were not independently verified. This is a reviewer limitation, not evidence that those tests failed.
  • Area history supports routing: Current-main history includes Peter Steinberger's roster and directory-validation maintenance and MatthewSynthia's service-environment path repair. GitHub confirms MatthewSynthia authored the latter commit and its directory-resolution patch. These are routing signals, not claims about introducing this optimization. (src/config/agent-dirs.ts, e2b49d25399d)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • MatthewSynthia: 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.

@steipete
steipete merged commit 87e2cfb into main Sep 18, 2026
278 checks passed
@steipete
steipete deleted the codex/startup-single-agent-directory-check-b0a1 branch September 18, 2026 22:45
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 18, 2026
…pr-149099-main-20260918

* commit '795e460278d4f8f41545dc8b4a66da1d12defd90': (1902 commits)
  refactor(slack): share Markdown preparation (#149129)
  fix(tooling): release completed PR operations with exited loaders (#152209)
  fix(release): allow stable npm bootstrap under an operator soak waiver (#152206)
  fix(daemon): avoid false restart timeouts during slow startup (#151387)
  feat: read agent documents from a host-owned workspace (#150584)
  improve(startup): skip redundant single-agent directory checks (#152192)
  test(ui): await board widget readiness before size reports (#152198)
  perf(browser): move dashboard event discovery to SQLite worker (#151952)
  improve(auth): reduce pauses during concurrent credential reads (#152140)
  improve(ui): load older chat history in smaller pages (#152093)
  fix(release): reject incomplete legacy npm install trees (#152186)
  refactor: share current-conversation binding row serialization (#152134)
  test(tooling): preserve Node and terminal fixture ownership under Bun (#152187)
  fix(sqlite): service worker admission through retained path aliases (#152190)
  improve: reduce CPU work for long CLI reasoning streams (#152191)
  chore(ui): refresh control ui locales (#152196)
  test(subagents): align lifecycle retries with durable completion owners (#152184)
  perf(gateway): defer participant maps for owned sessions (#152097)
  refactor(stream): share auxiliary queue overflow handling (#149282)
  fix(test): execute CLI fixture preloads on Node and Bun (#152076)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 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