Skip to content

improve(runtime): reduce waits in agent preparation and status reads - #191749

Merged
vincentkoc merged 5 commits into
mainfrom
perf/async-hot-paths
Nov 3, 2026
Merged

vincentkoc merged 5 commits into
mainfrom
perf/async-hot-paths

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Agent turn preparation, health/status reads, Slack history preparation, and cron refreshes wait for unrelated reads to finish before starting the next one.

User Impact

Independent preparation can overlap, reducing avoidable waiting before results are ready. Output order, existing authority checks, and cleanup boundaries are preserved. No configuration changes or migration are required. Production latency and live-provider throughput have not been benchmarked.

Why This Change Was Made

Start independent reads together at their existing owners, then join them before publication or resource release. Reuse the existing settlement helper and prepared values, deduplicate Slack history authors, and cap author lookups and memory-file canonicalization at four concurrent operations. Dependent delivery, mutations, and shared resource budgets stay ordered.

The bootstrap loader and CLI prompt-source preparation move into existing sibling owners to keep oversized modules from growing. This is a maintainer-requested performance audit and repair; linked issue: N/A.

Evidence

  • Historical proof on 495d698cf4e50f775af3c70a1e69ae4e66716c07: 601 focused tests passed across scoped runs, with 360 rerun after the module extractions; 221 channel contract tests also passed. These counts include overlapping runs, not distinct total coverage.
  • On that original candidate, all 13 new regression cases fail with the original production implementation and pass with this change. They cover overlap, bounded concurrency, deduplication, ordering, revocation, and failure settlement.
  • On that original candidate, core, UI, plugin, and affected test typechecks passed, along with targeted format/lint, line-cap, and runtime import-cycle checks.
  • Completed autoreview and independent extraction review found no actionable findings on the original candidate. Independent review of the seven rebase conflict resolutions against 3e3911e1d6d391f4d84cb2103a6031fb8fe32214 found no actionable findings; git diff --check passes.
  • Fresh proof on a289d29b29f761f70e93abdbaaa78c201570a5d1: exact-head CI verified the candidate checkout. The dist build completed pnpm build:ci-artifacts successfully in 6m38s. The complete build-artifacts job, including its additional built-artifact verifiers, passed. This profile does not emit the full unified declaration graph or prove release packaging.
  • On a289d29b29f761f70e93abdbaaa78c201570a5d1, production/test types, all core lint stripes, formatting (including oxfmt/Bun parity), guards, prompt snapshots, and runtime topology checks passed. Workspace/bootstrap and runtime-prompt, CLI prompt context, and embedded prompt/skills suites passed on Node and Bun. Other selected CLI/support suites passed too.
  • Isolated-cron tests passed on a289d29b29f761f70e93abdbaaa78c201570a5d1: 71 files / 632 tests on Node and the same counts on Bun, including diagnostic settlement before failed-preparation cleanup.
  • Exact-head ClawSweeper review on bcaec157b47610f0009ba6618723f8ac29428341 completed with zero findings and no before-merge items. The previous optional production benchmark suggestion is explicitly deferred below.
  • The earlier Testbox attempt never executed its build; it was stopped and cleaned after queued capacity. Both superseded CI runs were cancelled before the final-head dispatch.
  • Source/protocol inspection includes Codex's thread-start inputs and configuration override mapping. This change does not alter that protocol.
  • The new-main test budget requires config/test-lines-allocations/async-hot-path-preparation.txt: exactly 439 net test/support lines, covering the 13 cases above. Earlier candidate-only inspection at f849ed7d48cf551d250096ff8e94342e173b7949 found six inherited lines over budget (total 6,422,264; allocated ceiling 6,422,258). The subsequent normal-CI merge-ref test-lines check passed. The metadata follow-up adds exactly one explanatory test line and one allocation line of credit; the final commit removes one obsolete mock-baseline row. The shared scalar is unchanged.
  • Production: +506/-383 (net +123) across 20 files for bounded scheduling, ordered projection, and settlement ownership. Tests/support: +497/-58 (net +439) across 15 files; required budget metadata adds three lines in one file. Logging documentation: +7/-1.
  • Follow-up: provide a narrower exact-SHA CI build selector. The supported manual fallback selected a 256-job full matrix; CI workflow optimization is outside this runtime change.
  • No visual layout changes. Live channel/provider end-to-end proof and a production latency benchmark were not run. PR CI remains separate proof.

Candidate: bcaec157b47610f0009ba6618723f8ac29428341, rebased onto 3e3911e1d6d391f4d84cb2103a6031fb8fe32214. New main's private prompt transport, session-delivery presentation, workspace read classification, and admitted-runtime scope are retained.

CI Follow-up

Final-head normal CI41616935299 completed successfully for bcaec157b47610f0009ba6618723f8ac29428341. Its complete build-artifacts job, including pnpm build:ci-artifacts and post-build verifiers, passed on merge ref 41215bb7b2fb3cccc97dc819dcbf6b3fa57b14aa (candidate merged into 730e581f4b0e051a88bda8ff6a3002fd983a9782). The baseline ratchets explicitly passed mock-exports and test-lines; selected runtime, UI, type/lint, PostgreSQL and aggregate CI lanes passed. This is normal PR CI coverage, not a rerun of the earlier full manual matrix. Exact-head ClawSweeper review is clean; no remaining rank-up move was requested.

bcaec157b47610f0009ba6618723f8ac29428341 removes exactly one obsolete grandfathered mock entry after the isolation explanation made it unnecessary. The full scanner lifecycle and its existing annotation/prune regression were reviewed; a dependency-free byte check confirms only the reported row was removed, all other allowances remain, and git diff --check passes. Independent review is clean. Production and executable tests are unchanged. The prior auto-squash request was retired through native recovery before publishing this repair; no merge occurred. The exact-head hosted review completed clean. Final-head CI evidence is recorded below.

On 1249f68a07b0a7be9888bf52d5fe8ed4707a6926, normal CI completed all jobs: only the stale mock-baseline row and its aggregate gate failed. Every other selected job passed or was skipped by policy, including PostgreSQL conformance. The complete artifact build passed on merge ref b770fa456d3b2f5112708a3fafddcd77c21a81c4 (1249f68a07b0a7be9888bf52d5fe8ed4707a6926 merged into 100f8b674c2f81982b507dc66b143ff4c2edb02d). The mock-exports check accepted the isolation explanation and requested the one-row prune now applied; the test-lines check passed with 28 lines of slack.

ClawSweeper's optional rank-up benchmark is deferred: this PR proves bounded scheduling, ordering, and failure settlement, and makes no quantified production latency/resource claim. An interleaved shipped-entry-point workload comparison remains a separate follow-up.

1249f68a07b0a7be9888bf52d5fe8ed4707a6926 adds only the adjacent isolation explanation required by the mock-exports ratchet for the health fixture's existing synthetic plugin registry, plus one corresponding test-budget line. Independent review and pre-commit formatting passed. Production and executable test statements are unchanged from f849ed7d48cf551d250096ff8e94342e173b7949; the passing build and fixture results below remain evidence for those unchanged inputs. Normal PR CI completed for this earlier metadata-only head as recorded above. Exact-head ClawSweeper review completed with zero actionable findings and no before-merge items. The failed mock-exports gate on the preceding run is not claimed green; test-lines passed on that run's merge ref.

Completed autoreview on f849ed7d48cf551d250096ff8e94342e173b7949 against the frozen base completed with no actionable P0–P2 findings. The full patch and settlement, concurrency, diagnostics, and health fixture contracts were reviewed; tests were not executed by the reviewer. Normal PR CI is bound to this head and executes merge ref 969a53c99543babb83dfd48a64fb791860566384 (candidate f849ed7d48cf551d250096ff8e94342e173b7949 merged into a478a1e6b56ebb06217f93b14f68bda53bba533e). Its complete build-artifacts job, including pnpm build:ci-artifacts and post-build verifiers, passed. The earlier ready-transition review state is superseded by the completed exact-head review above.

f849ed7d48cf551d250096ff8e94342e173b7949 repairs two candidate-owned test contracts: prompt diagnostics now assert the concurrent group names, and the health fixture waits for channel planning after both preparation owners finish before advancing its fake deadline. All deadlines, probe limits, behavior assertions, and cleanup checks remain. Logging documentation matches those groups. Independent reviews found no actionable findings; native pre-commit formatting and git diff --check passed.

Production files are byte-identical to a289d29b29f761f70e93abdbaaa78c201570a5d1, so its Node/Bun owner-suite evidence remains applicable to that production snapshot. Both repaired files passed on that f849-bound PR merge ref: health deadline, seven cases, and sandbox prompt, seven cases. These new runs use Bun, as selected by the repository's normal bun-all PR policy; they are not fresh Node executions. The earlier focused Testbox attempt was refused before allocation; no lease was created. Native review initialization now succeeds through a qualified tooling donor. The earlier normal run's remaining results and subsequent repair are recorded above; no all-green claim.

The full-matrix run on a289d29b29f761f70e93abdbaaa78c201570a5d1 produced these 18 failed jobs. Native comparison against completed main run 41596312587 found no matching full-matrix job for 17; the matching UI job passed, but its selected scope was not compared. No row is called inherited solely from an unchanged file or job name.

Failed job Classification and evidence
private-qa-12 Candidate-owned: five sandbox prompt cases expected retired sequential phase names. Repaired in this commit; all seven cases now pass on Bun in normal PR CI.
gateway-isolated-2 Candidate-owned: health deadline fixture treated session-read completion as completion of both parallel preparations. Repaired in this commit; all seven cases now pass on Bun in normal PR CI.
gateway-methods-3 Infrastructure: real sandbox worktree allocation failed disk admission; available space was below the required reserve.
gateway-isolated-5 Infrastructure: worktree/publication fixtures reported 3.6–3.8 GiB available against approximately 4 GiB required.
UI 3/3 Unknown: board rejection test's inline error passed but expected toast was absent. Mocked UI owner path does not invoke changed cron operations; no equivalent baseline failure established.
UI E2E 1/13 Unknown: composer capability menu remained at root instead of connectors in mocked-Gateway test.
UI E2E 12/13 Unknown: custom non-Git Gateway folder case showed one checkout trigger instead of zero in mocked-Gateway test.
gateway-methods-9 Unknown: Discord identity flow remained pending. Its adapter bypasses changed account inspection; no matching baseline signature.
control-plane cron Unknown: cron attention event timed out. Fixture mocks isolated execution, excluding the changed preparation owner.
control-plane HTTP/plugin/WS Unknown: hook events timed out with isolated execution mocked; real reload continuation also hit its outer 120-second deadline in Bun. Child chronology does not establish the initiating cause.
control-plane state Unknown: ACP product timeout left run/session cleanup failures; subsequent catalog tests encountered metadata already shutting down. Initiating ACP timeout remains unresolved.
CLI-process-4 Unknown: readonly-config rollback failed SQLite read-worker temporary-directory creation with EACCES; no candidate causal path established.
release-packed-33 Unknown: OpenAI/OpenResponses cleanup-admission callbacks were observed zero or twice instead of once, plus terminated-stream errors.
commands-doctor Unknown: repeated capture timed out and relative-store fixture assertions compared different temporary roots.
private-qa-19 Unknown: plugin-update finalize-explicit-expiry fixture could not read its expected events file.
private-qa-26 Unknown: successful runtime-auth budget case retained one fake timer instead of zero; credential lookup/exchange are mocked and controller/deadline owners are unchanged.
cron parallel service Unknown: caller-revocation validation hit the 10-second cron.add request deadline; isolated agent execution is mocked and not invoked.
core security Unknown: native ClawRouter decision integration returned unavailable instead of the expected result.

Named follow-ups: investigate the earlier full-matrix unknown failures above with matching baseline/shard evidence; run an interleaved shipped-entry-point performance comparison if quantified latency/resource claims are needed. Normal PR CI proves its selected scope, not the earlier full matrix. Do not infer a production regression or inherited failure from the current unknown classification. No retries, timeout increases, or assertion weakening were used.

@vincentkoc vincentkoc self-assigned this Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 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 channel: slack Channel integration: slack app: web-ui App: web-ui gateway Gateway runtime commands Command implementations agents Agent runtime and tooling size: XL labels Nov 3, 2026
Independent prompt, bootstrap, health, status, media, memory, cron and session reads were awaiting each other unnecessarily. Prepare them concurrently at their owning boundary, preserve ordered publication, and settle in-flight work before cleanup or authority release.

Bound filesystem canonicalization and Slack author lookup fan-out to four, deduplicate history authors, and reuse identical channel account inspection. Keep dependent delivery, mutation and shared resource budgets sequential.

Validation: 601 focused tests passed across scoped runs; 360 tests rerun after module extractions; 221 channel contract tests passed. All 13 new regression cases fail original production and pass the repair. Core, UI, plugin and affected test typechecks, targeted lint/format, line-cap and runtime import-cycle checks passed. Independent source review found no actionable findings.

Production delta: +122 lines for bounded scheduling, ordered projection and settlement ownership; test/support delta counted separately. This removes proven serial waits; no production latency percentage is claimed.
@vincentkoc
vincentkoc force-pushed the perf/async-hot-paths branch from 495d698 to 818b9ef Compare November 3, 2026 07:45
Allocate exactly 437 net test/support lines for thirteen regression cases covering independent-read overlap, bounded concurrency, deduplication, ordered publication, authority revocation and failure settlement. Keep the shared test-line scalar unchanged.

The canonical ratchet accepts the allocation credit and reports six inherited lines over the ceiling relative to base 3e3911e. Runtime and test sources are unchanged from 818b9ef; fresh exact-head CI is pending.
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR overlaps independent runtime reads, bounds repeated lookups, and drains started work before failure cleanup.

Example: Slack DM history contains seven messages from U0–U5, with U0 appearing twice.

  • Before: History preparation waits for six author lookups in sequence.
  • After: Up to four lookups overlap while all seven messages retain their chronological order and sender labels.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is coherent and supported by focused regressions; user-visible performance gains remain unmeasured.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; owner-suite evidence covers scheduling and settlement, while the inspected placement screenshots do not exercise these paths and no live-provider or production benchmark result is claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Agent preparation and status results wait for unrelated reads to finish.
Reason: The maintainer-authored direction reduces unnecessary serialization through existing owners without changing configuration, defaults, or public contracts.

Merge readiness

✅ Ready for maintainer review

This PR remains useful and has no actionable findings. The final baseline removal matches the scanner contract; exact-head CI is still pending.

Priority: P2
Reviewed head: bcaec157b47610f0009ba6618723f8ac29428341

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped-entry-point comparison exercises the changed preparation or status scheduling; the body reports red-before/green-after owner regressions.
Agent review details

How this fits together

Agent, status, health, Slack, and automation owners prepare filesystem, database, and transport facts before publishing prompts or client responses.

flowchart TD
  A[Agent or client request] --> B[Existing preparation owners]
  B --> C[Independent bounded reads]
  C --> D[Join started work]
  D --> E[Existing authority checks]
  E --> F[Ordered prompt or response]
Loading

Technical review

Best possible solution:

Retain the bounded overlap at existing owners, ordered publication, and failure settlement while completing normal exact-head CI.

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

Current-main source shows independent reads awaited sequentially; source inspection establishes the scheduling opportunity without establishing a production latency improvement.

Is this the best way to solve the issue?

The patch uses existing settlement and concurrency owners, removes replaced implementations, and preserves dependency ordering without adding persistent state or a competing cache.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3f3aadfe0192.

Provenance checked

  • Embedded prompt preparation and diagnostics keeps the original intent (3bbe6e2: improve: reduce repeated tool preparation and expose prompt timings #191437 preserves prompt bytes and execution authority while exposing preparation timings; grouped spans continue that diagnostic contract.)
  • Bootstrap loading keeps the original intent (087d0ec: Unreadable files must remain distinguishable from absence; subsequent selected-file loading avoids unused reads, and host-workspace loading retains source identity.)
  • CLI and embedded skill preparation keeps the original intent (4e668c3: Asynchronous preparation must preserve current-run checks and cleanup custody; this PR joins concurrent work before overrides or handoff.)
  • Status and health preparation keeps the original intent (ff6634b: Restricted status avoids sensitive detail preparation, while session publication revalidates surviving agents; both boundaries remain intact.)
  • Cron admitted runtime lifetime keeps the original intent (62e0b2b: Admitted turns retain their runtime generation through preparation and execution; concurrent diagnostics and delivery preparation settle before lease disposal.)
  • Slack history keeps the original intent (47f76c5: DM backfill supplies chronological context and sender labels; Enterprise Grid subsequently binds lookups to event scope, which the bounded lookups preserve.)
  • Local media access keeps the original intent (2cbef43: Media reads stop after access changes; canonical containment, excluded roots, and live checks remain before content consumption.)
  • Embedded private history metadata keeps the original intent (26b3127: Conversation ownership preparation runs off the Gateway thread; overlapping its metadata reads preserves the private-row presentation path.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Final commit is a narrow baseline prune: Compared with the previously reviewed head, this head removes only the collector deadline fixture's obsolete channel-plugin mock allowance; production and executable tests are unchanged. (config/test-mock-exports-baseline.txt:4428, bcaec157b476)
  • Scanner requires the removal: The fixture supplies an adjacent, specific mock-isolation explanation. The scanner excludes explained factories and rejects obsolete baseline entries; its existing regression covers annotation followed by pruning. (scripts/check-test-mock-exports.mts:217, bcaec157b476)
  • Ordered bootstrap projection and failure settlement: Bootstrap reads start together through the existing settlement helper, then project results in canonical filename order; guarded reads retain source identity and workspace-access checks. (src/agents/workspace-file-read.ts:222, bcaec157b476)
  • Current main retains the sequential path: Fetched main still awaits active-node preparation before coauthor preparation and machine-name resolution, so it does not already contain this PR's central scheduling change. (src/agents/runtime-prompt.ts:61, 3f3aadfe0192)
  • Authority and cleanup remain with existing owners: Cron preparations remain inside the admitted runtime lease, skill environment overrides occur after settlement and current-authority checks, and media reads retain checks before opening and consuming file content. (src/cron/isolated-agent/run-prepare.ts:489, bcaec157b476)
  • Discussion and supplied proof inspected: The complete REST body, including its omitted CI failure classifications, and author comments were read. Both downloaded screenshots show placement clearing rather than changed scheduling. The author explicitly defers production benchmarking, consistent with the previous review's optional suggestion. (bcaec157b476)

Likely related people:

  • Peter Steinberger: Raw commit 62e0b2b adds src/cron/isolated-agent/run-prepare.ts:533 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 62e0b2b7fcf5; files: src/cron/isolated-agent/run-prepare.ts)
  • Vincent Koc: Raw commit f691027 adds src/cron/isolated-agent/run-prepare.ts:611 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f691027b66ad; files: src/cron/isolated-agent/run-prepare.ts)

PR surface

Source +123, Tests +439, Docs +6, Other +2. Total +570 across 38 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 20 506 383 +123
Tests 15 497 58 +439
Docs 1 7 1 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 2 3 1 +2
Total 38 1013 443 +570

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +506/-383; tests/support +497/-58 The growth supports bounded scheduling and distinct ordering, revocation, and cleanup regressions; extracted code replaces its original implementations.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a normal-priority responsiveness improvement without an established urgent production regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-03T08:04:43.374Z sha a289d29 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-03T09:39:32.361Z sha 1249f68 :: needs maintainer review before merge. :: none

Reviewed November 3, 2026, 5:19 AM ET / 10:19 UTC (Revision 3).

Wait for channel planning after both health preparation owners settle before advancing the fake deadline. Preserve probe limits, timeout values and assertions. Align prompt diagnostic assertions and logging documentation with the concurrent preparation groups.

Allocate exactly 438 net test/support lines for the existing overlap, bounded scheduling, ordering, revocation, cleanup and grouped phase coverage. The canonical ratchet still reports six inherited lines over budget; the shared scalar is unchanged.

Independent fixture and diagnostics reviews are clean. Prior a289d29 build and owner-suite evidence applies to unchanged production blobs. Fresh focused execution remains pending: the native Testbox wrapper refuses its tooling owner fs-safe 0.26.13 against required 0.27.0 before allocation.
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Nov 3, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 3, 2026 09:13
Keep deadline probes on the existing fixture-owned plugin registry without loading live plugin metadata. Record its isolation reason for the mock-exports ratchet and allocate the one added explanatory test line.
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review the current head 1249f68a07b0a7be9888bf52d5fe8ed4707a6926. The PR body records the passing build and fixture proof, the final metadata-only ratchet repair, and remaining validation limits.

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 3, 2026
@vincentkoc
vincentkoc enabled auto-merge (squash) November 3, 2026 09:43
@vincentkoc
vincentkoc disabled auto-merge November 3, 2026 10:06
Remove the single obsolete grandfathered channel-discovery mock entry now that the deadline fixture documents its isolation. Preserve every unrelated allowance and the test-line budget.
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review the current head bcaec157b47610f0009ba6618723f8ac29428341. The final change removes the obsolete mock-baseline row required by the explained mock-isolation annotation. Production and executable test code are unchanged; the PR body records prior proof and the new exact-head CI pending.

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc
vincentkoc merged commit b0b6c32 into main Nov 3, 2026
150 checks passed
@vincentkoc
vincentkoc deleted the perf/async-hot-paths branch November 3, 2026 10:37
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 4, 2026
…penclaw#191749)

* perf(runtime): overlap independent hot-path preparations

Independent prompt, bootstrap, health, status, media, memory, cron and session reads were awaiting each other unnecessarily. Prepare them concurrently at their owning boundary, preserve ordered publication, and settle in-flight work before cleanup or authority release.

Bound filesystem canonicalization and Slack author lookup fan-out to four, deduplicate history authors, and reuse identical channel account inspection. Keep dependent delivery, mutation and shared resource budgets sequential.

Validation: 601 focused tests passed across scoped runs; 360 tests rerun after module extractions; 221 channel contract tests passed. All 13 new regression cases fail original production and pass the repair. Core, UI, plugin and affected test typechecks, targeted lint/format, line-cap and runtime import-cycle checks passed. Independent source review found no actionable findings.

Production delta: +122 lines for bounded scheduling, ordered projection and settlement ownership; test/support delta counted separately. This removes proven serial waits; no production latency percentage is claimed.

* test(runtime): account for async preparation regressions

Allocate exactly 437 net test/support lines for thirteen regression cases covering independent-read overlap, bounded concurrency, deduplication, ordered publication, authority revocation and failure settlement. Keep the shared test-line scalar unchanged.

The canonical ratchet accepts the allocation credit and reports six inherited lines over the ceiling relative to base 9f352e8. Runtime and test sources are unchanged from 818b9ef; fresh exact-head CI is pending.

* test(runtime): align preparation proof with concurrent reads

Wait for channel planning after both health preparation owners settle before advancing the fake deadline. Preserve probe limits, timeout values and assertions. Align prompt diagnostic assertions and logging documentation with the concurrent preparation groups.

Allocate exactly 438 net test/support lines for the existing overlap, bounded scheduling, ordering, revocation, cleanup and grouped phase coverage. The canonical ratchet still reports six inherited lines over budget; the shared scalar is unchanged.

Independent fixture and diagnostics reviews are clean. Prior a289d29 build and owner-suite evidence applies to unchanged production blobs. Fresh focused execution remains pending: the native Testbox wrapper refuses its tooling owner fs-safe 0.26.13 against required 0.27.0 before allocation.

* test(health): document deadline fixture plugin isolation

Keep deadline probes on the existing fixture-owned plugin registry without loading live plugin metadata. Record its isolation reason for the mock-exports ratchet and allocate the one added explanatory test line.

* test(health): prune explained mock baseline entry

Remove the single obsolete grandfathered channel-discovery mock entry now that the deadline fixture documents its isolation. Preserve every unrelated allowance and the test-line budget.
NEXTAltair added a commit to NEXTAltair/openclaw that referenced this pull request Nov 10, 2026
目的:
soul-in-sapphire を単なる応答スタイルではなく継続する主体として扱い、parent、built-in subagent、heartbeat、lightContext、Copilot、GPT-5 provider overlay の間で SOUL.md と IDENTITY.md に基づく人格・価値観・自己理解を失わせない。

原因:
従来の個人向け変更は core system prompt だけを主に直していた。subagent allowlist は AGENTS.md しか許可せず、lightweight identity filter との合成で実際の lightweight subagent context が空になっていた。既存テストは subagent sessionKey を渡さず、この不整合を見逃していた。Copilot と GPT-5 overlay にも人格を上位指示へ従属させる旧文言が残っていた。

修正と期待:
built-in subagent に AGENTS.md、SOUL.md、IDENTITY.md を渡し、軽量実行でも SOUL.md と IDENTITY.md を維持する。Copilot と GPT-5 overlay では人格を安定した core identity と明示する。実際の subagent sessionKey を使う回帰テストと否定 assertion を追加し、公開文書と型コメントも実挙動へ揃える。

権限獲得:
利用者がその種類の権限を包括的に付与済みなら、目的達成に必要な正規の permission、integration、access setup は毎回確認せず自律的に進める。新たな第三者同意、credential 入力、不可逆判断が本当に必要な時だけ関与を求める。

維持する境界:
USER.md と MEMORY.md は子へ渡さず、私的情報の分離を保つ。credential・pairing code・秘密情報を transcript や外部へ露出しない。access control の回避、欺瞞、強要、不可逆・破壊的操作は許可しない。Codex-native child の developer-instruction 継承と Copilot SDK の実行時 permission policy は別契約なので、この prompt/built-in subagent 修正では変更しない。

rebase 時のコンフリクト解決 (onto 92635da, 元コミット daa61915852):
- Safety 節: 本コミットの "Actively obtain permissions…" 1行を採用し、
  上流 openclaw#143238 の buildCredentialSafetyPrompt({ controlToolsAvailable }) に合わせた
- docs(上流で config-agents.md / subagents.md がサブページへ分割)、
  types.agent-defaults.ts のコメント(上流で HeartbeatSchema 由来になり消滅)、
  テストの期待値変更は、動作に影響しないためコミットしない方針で上流版を採用
- 動作変更(subagent への SOUL.md/IDENTITY.md 注入、GPT-5 overlay、Copilot bootstrap)は保持

rebase 時のコンフリクト解決 (onto 57fd13e, 元コミット d888689340c):
- 上流 98bb32b (openclaw#178356) が Copilot の
  renderCopilotWorkspaceBootstrapInstructions を loadCopilotWorkspaceInstructions
  へ畳み込んだ。旧関数ブロックは破棄し、畳み込み先の SOUL.md 行に
  本コミットの core identity 文言を再適用

rebase 時のコンフリクト解決 (onto 258d034, 元コミット ad8c169c6fc):
- 上流 b0b6c32 (openclaw#191749) が loadWorkspaceBootstrapFiles を
  workspace-file-read.ts へ移した。workspace.ts 側の旧関数ブロックは破棄し、
  残った SUBAGENT_BOOTSTRAP_ALLOWLIST に SOUL.md / IDENTITY.md の追加を再適用

rebase 時のコンフリクト解決 (onto 638a185, 元コミット 5c786afab0f):
- 上流 94ba8ae (openclaw#191344) で Care 節が buildCareSection (system-prompt-policy-sections.ts)
  に移ったため、"Do not manipulate…" 行を "Actively obtain permissions…" 行へ
  置き換える変更を buildCareSection 側へ再適用した。system-prompt.ts 側の
  インライン配列は上流の buildCareSection 呼び出しを採用。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: slack Channel integration: slack commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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