Repository navigation
perf(agents): prepare generation authority off-thread for file writes - #188552
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. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR prepares generation-backed file-write authority through session workers and checks retained authority immediately before mutation. Example: Overwrite /tmp/report.txt with "replacement" after an unchanged native session update.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep open: this maintainer-authored draft contains useful unique work, but its dependency pin currently breaks frozen installation. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherAgent host-file writes consume caller receipts backed by command-owner and session-generation authority; session workers prepare database facts, and filesystem operations consume the final synchronous assertion. flowchart TD
A[Agent file write] --> B[Caller receipt]
B --> C[Command and generation owners]
C --> D[Session workers]
D --> E[Prepared live assertion]
E --> F[Filesystem mutation]
Technical reviewBest possible solution: Keep preparation in the existing generation and worker owners, preserve live final checks, and complete the published dependency integration. Do we have a high-confidence way to reproduce the issue? Current-main host writes invoke generation checks that synchronously validate database identity and may read native session state; the author also reports a consumer-harness comparison, but this review executed no reproduction. Is this the best way to solve the issue? Preparing through existing workers at the overwrite boundary is a coherent narrow solution, and retaining synchronous checks for opaque callbacks and active transactions is justified. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e051130c6ae0. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete authorization bypass was established, but the changed authority chain still needs final-effect rejection evidence. EvidenceSecurity concerns:
What I checked:
PR surfaceSource +307, Tests +303, Docs +9, Config 0. Total +619 across 16 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel 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 Reviewed October 30, 2026, 1:31 PM ET / 17:31 UTC. |
a7aa9b1 to
8efccc8
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Record the lead-approved exact 307-line allocation for integrated zero-probe writes and fail-closed generation, receipt, and prepared-source coverage. Align Memory Core fs-safe with the host so existing race injection targets the same dependency instance.
8efccc8 to
ad94d5a
Compare
|
Merged at Final CI run: 152 passed, 21 skipped, six failed checks—the five attributed test jobs plus the aggregate gate. Cron admission (8 cases), visible-spawn fallback (9 cases), and direct-command steering match main run 41107007551. The agent-terminal and Telegram settlement E2Es reproduce the same assertions on exact base The task-caused Memory Core dependency-instance mismatch and test-line gate are fixed and green. The lead-approved allocation grants exactly 307 regression/proof lines; the shared scalar is unchanged. All 52 final focused tests, published-package validation, security/dependency reviews and Codex review pass. Integrated main-thread identity probes are 8→0, native generation reads 1→0, and SQL prepares 1→0. No Team access or deployment. |
…d-tool-snapshot Resolve src/agents/agent-tools.delegated-authority.test.ts after openclaw#188552 appended its prepared-write tests: keep both test blocks and the combined gateway-caller-context import. The import now replaces main's one-line import, so the exact test-line allocation drops from 868 to 867.
#188552 moved the root package and memory-core to @openclaw/fs-safe 0.26.15 but left eleven bundled plugins on 0.26.14. Package candidate resolution rejects conflicting bundled plugin dependency specs, so every ref-sourced package build (Update Migration, package acceptance, release checks) failed before any lane ran. Align the remaining plugins to the version the root already ships. No new upstream version enters the lockfile; the unused 0.26.14 entries drop out.
…openclaw#188552) * perf(agents): prepare generation authority before file effects * build(deps): consume released fs-safe effect authority API * test(agents): allocate currentness regression proof budget Record the lead-approved exact 307-line allocation for integrated zero-probe writes and fail-closed generation, receipt, and prepared-source coverage. Align Memory Core fs-safe with the host so existing race injection targets the same dependency instance.
What Problem This Solves
Generation-backed host file writes repeatedly revalidated retained session authority through synchronous physical-identity probes and native SQLite reads on the Gateway main thread.
Change and User Impact
The generation owner now prepares physical identity checks and committed native-revision refreshes on the existing session workers. Lifecycle, command-owner and receipt adapters carry those prepared facts to the file effect. The final synchronous assertion still checks live owner state, the exact native handle and revision, permissions and pending native execution. Revoked, released, replaced or changed authority fails closed.
The host and Memory Core pin the published
@openclaw/fs-safe0.26.15. Its additive API prepares authority after overwrite rollback capture and asserts immediately before mutation, including empty truncation. The dependency API merged in fs-safe #1049 at80b9af0a5211d3ad4013a0c25f936480e2aca297; this PR does not publish a release. The Memory Core pin keeps its existing race-injection hooks on the same dependency instance as SDK file operations; all three race tests pass without changing their assertions.Arbitrary legacy opaque callbacks, generic entry/conversation sources, and active same-connection native transactions retain their existing synchronous checks. The zero-probe claim applies to the migrated generation-backed file-write path, not every lifecycle assertion. No schema or configuration options change. The obsolete overwrite barrel export is removed.
Production delta excluding tests/docs and dependency metadata: +388 / -85 lines (net +303). The growth preserves the existing synchronous and transaction contracts while adding the async final-effect boundary.
Measurement and Proof
Actual generation → command-owner → receipt →
writeHostFile, after a committed native no-op revision, with 25 ms injected synchronous-probe latency:The baseline substitutes the unchanged main generation owner in the same consumer harness, using the released dependency in both arms. It fails the committed zero-count assertion; the candidate writes the expected bytes with all counts zero. This is owner-level proof, not a whole-Gateway CPU, allocation or latency claim.
ad94d5a49707b8b7cbc09d689ffc27df19563c91, base797540497ae53253adb5fa0581c2171389919cad: 52 focused tests pass (the original 49 plus three Memory Core migration races). All three commits remained patch-identical across the final rebase.sha512-6O0NiLjrEeY8H5wBUmBy5qbIW0qu5ICw5jYvcIswduYkxnqxf+SDzpJMIJVC5L5IXvRlMh8ZZHQYkmjWxVy9DQ==.pnpm check:changed --timedcompleted all stages. Its two PR-caused cleanup typing errors and obsolete barrel export were repaired; the completepnpm tsgo:allrerun and targeted lint passed. Remaining broad local lint/unused-export failures are in unchanged files with unchanged lint/Knip configuration, recorded as inherited; exact-head hosted guards cover the final diff.Approved Test Allocation
The lead explicitly approved
config/test-lines-allocations/async-effect-authority.txt: exactly 307 net new lines for the integrated zero-probe write proof and distinct fail-closed generation, receipt and prepared-source regressions. The shared scalar is unchanged. The final local ratchet passes at 6,307,747 lines / 6,307,779 effective ceiling; the 32 lines of slack are inherited from main. This PR adds exactly 307 lines and 307 credit. The hosted ratchet passes too.Exact-Head CI and Inherited Failures
Run 41120260179 is bound to
ad94d5a49707b8b7cbc09d689ffc27df19563c91. Completed: 152 successful, 21 skipped, six failed checks: the five attributed inherited test jobs below and the aggregate CI gate. All PostgreSQL conformance shards pass. The five failing test jobs have the same cases and assertion signatures as retained baseline evidence; no CI rerun was requested.6f39e23d920a7fd8a234bda419705edb13e1e456, frozen 0.26.14 dependencies and built isolated Gateway reproduce expected error / received ok.The Memory Core and test-line failures from the previous head are repaired and green. The previous trajectory failure is green on this head; five base and five candidate full-file replays also passed, with no underlying flake fix claimed. Security and dependency reviews pass. The lead authorized exact-head admin landing when only attributed inherited reds remain.
Related: #188474