Repository navigation
improve(runtime): reduce waits in agent preparation and status reads - #191749
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. |
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.
495d698 to
818b9ef
Compare
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.
|
Codex review: needs maintainer review before merge. What this changesThis 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.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherAgent, 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]
Technical reviewBest 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
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +123, Tests +439, Docs +6, Other +2. Total +570 across 38 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed 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.
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.
|
@clawsweeper re-review Please review the current head |
|
🦞👀 Re-review progress:
|
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.
|
@clawsweeper re-review Please review the current head |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…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.
目的: 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 呼び出しを採用。
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
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.3e3911e1d6d391f4d84cb2103a6031fb8fe32214found no actionable findings;git diff --checkpasses.a289d29b29f761f70e93abdbaaa78c201570a5d1: exact-head CI verified the candidate checkout. The dist build completedpnpm build:ci-artifactssuccessfully 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.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.a289d29b29f761f70e93abdbaaa78c201570a5d1: 71 files / 632 tests on Node and the same counts on Bun, including diagnostic settlement before failed-preparation cleanup.bcaec157b47610f0009ba6618723f8ac29428341completed with zero findings and no before-merge items. The previous optional production benchmark suggestion is explicitly deferred below.config/test-lines-allocations/async-hot-path-preparation.txt: exactly 439 net test/support lines, covering the 13 cases above. Earlier candidate-only inspection atf849ed7d48cf551d250096ff8e94342e173b7949found six inherited lines over budget (total 6,422,264; allocated ceiling 6,422,258). The subsequent normal-CI merge-reftest-linescheck 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.Candidate:
bcaec157b47610f0009ba6618723f8ac29428341, rebased onto3e3911e1d6d391f4d84cb2103a6031fb8fe32214. 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, includingpnpm build:ci-artifactsand post-build verifiers, passed on merge ref41215bb7b2fb3cccc97dc819dcbf6b3fa57b14aa(candidate merged into730e581f4b0e051a88bda8ff6a3002fd983a9782). The baseline ratchets explicitly passedmock-exportsandtest-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.bcaec157b47610f0009ba6618723f8ac29428341removes 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, andgit diff --checkpasses. 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 refb770fa456d3b2f5112708a3fafddcd77c21a81c4(1249f68a07b0a7be9888bf52d5fe8ed4707a6926merged into100f8b674c2f81982b507dc66b143ff4c2edb02d). 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.
1249f68a07b0a7be9888bf52d5fe8ed4707a6926adds 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 fromf849ed7d48cf551d250096ff8e94342e173b7949; 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 failedmock-exportsgate on the preceding run is not claimed green;test-linespassed on that run's merge ref.Completed autoreview on
f849ed7d48cf551d250096ff8e94342e173b7949against 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 ref969a53c99543babb83dfd48a64fb791860566384(candidatef849ed7d48cf551d250096ff8e94342e173b7949merged intoa478a1e6b56ebb06217f93b14f68bda53bba533e). Its complete build-artifacts job, includingpnpm build:ci-artifactsand post-build verifiers, passed. The earlier ready-transition review state is superseded by the completed exact-head review above.f849ed7d48cf551d250096ff8e94342e173b7949repairs 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 andgit diff --checkpassed.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 normalbun-allPR 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
a289d29b29f761f70e93abdbaaa78c201570a5d1produced these 18 failed jobs. Native comparison against completed main run41596312587found 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.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.