Repository navigation
Conversation
Await TTS preference reads and reuse owner-held database identities in prepared turn and row paths. Avoid eager media root and redundant attachment/path probes while preserving read containment and synchronous SDK contracts. Includes main-thread filesystem instrumentation and synthetic Gateway delay proof. This mitigates measured owners; remaining synchronous paths and unresolved cold performance tails are documented in the PR.
|
🦞👀 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 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. |
Preserve real TTS exports in the MCP and system-prompt command tests, await published model aliases, and remove their obsolete mock exceptions. Record the exact two native-addon instrumentation suppressions required by the opt-in filesystem census.
Migrate the Telegram loopback mock to the asynchronous TTS hint while preserving real exports, await minimal web-search prompts, and remove the obsolete mock exemption. Preserve all existing behavior assertions.
|
Codex review: needs changes before merge. What this changesThis PR makes TTS preference reads asynchronous and removes redundant filesystem probes from prepared chat-turn paths. Example: A warm chat turn encounters an injected 500 ms TTS preference-file delay.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: this PR provides a useful, measured reduction in Gateway stalls, but two missed asynchronous test-consumer migrations currently block CI. Priority: P2 Before merge
Findings
Provenance
Agent review detailsHow this fits togetherGateway chat preparation assembles prompts, acquires session actors, hydrates media, and prepares delivery using TTS preferences and database-owner facts. flowchart TD
A[Chat request] --> B[Turn preparation]
B --> C[Async TTS preferences]
B --> D[Session actor and database owner]
B --> E[Media hydration]
C --> F[Model prompt and reply delivery]
D --> F
E --> F
Technical reviewBest possible solution: Retain the existing-owner performance changes and complete the two missed test migrations without weakening their assertions. Do we have a high-confidence way to reproduce the issue? Current-main source retains synchronous TTS preference reads, and supplied baseline Gateway measurements demonstrate their event-loop impact; this read-only review ran no target code. Is this the best way to solve the issue? The approach removes redundant work through existing owners, shares TTS parsing and projection, and preserves released synchronous SDK contracts; the remaining repairs are test-consumer updates. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1c8d7583b4c2. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +107, Tests +150, Docs +5, Other +435. Total +697 across 78 files. Added test files: 0. View PR surface stats
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 November 2, 2026, 8:01 AM ET / 13:01 UTC. |
Use a dedicated fixture database so another conformance test removing a restore schema cannot invalidate the refusal-before-effect assertion. Preserve the whole-database namespace equality check and clean up the owned database. The shared namespace assertion was introduced by #188978. Deterministic foreign-schema cleanup reproduces the failure on the exact parent and passes with this fixture isolation.
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…191075) * fix: reduce filesystem stalls during chat turn preparation Await TTS preference reads and reuse owner-held database identities in prepared turn and row paths. Avoid eager media root and redundant attachment/path probes while preserving read containment and synchronous SDK contracts. Includes main-thread filesystem instrumentation and synthetic Gateway delay proof. This mitigates measured owners; remaining synchronous paths and unresolved cold performance tails are documented in the PR. * test: migrate remaining asynchronous prompt consumers Preserve real TTS exports in the MCP and system-prompt command tests, await published model aliases, and remove their obsolete mock exceptions. Record the exact two native-addon instrumentation suppressions required by the opt-in filesystem census. * test: await remaining tool and channel prompt builders Migrate the Telegram loopback mock to the asynchronous TTS hint while preserving real exports, await minimal web-search prompts, and remove the obsolete mock exemption. Preserve all existing behavior assertions. * test: isolate PostgreSQL restore cohort namespaces Use a dedicated fixture database so another conformance test removing a restore schema cannot invalidate the refusal-before-effect assertion. Preserve the whole-database namespace equality check and clean up the owned database. The shared namespace assertion was introduced by openclaw#188978. Deterministic foreign-schema cleanup reproduces the failure on the exact parent and passes with this fixture isolation. * test: observe the Workshop review timer directly
What Problem This Solves
Reduces chat-turn stalls when filesystem operations block the Gateway event loop. Turn preparation and delivery synchronously read TTS preferences and repeat filesystem identity/path probes even when their owners already hold the required facts.
User Impact
TTS preference reads now await filesystem I/O, and prepared session/turn paths avoid several redundant synchronous probes. Existing synchronous SDK contracts remain supported. No configuration, dependency version, or database schema changes.
Performance follow-up passed: this is a partial mitigation, not a zero-sync Gateway. Eight quiet-host A/B pairs did not reproduce the cold-loop regression; exact-head CI remains the landing gate. The lead accepts the original cold elapsed and first-row tails as A/A noise (50% and 74% control spread), and accepts +107 production lines. Remaining sandbox/state-lock/database/skill/bootstrap/plugin-artifact paths still issue synchronous filesystem calls.
Why This Change Was Made
The actor factory now acquires and retains the database execution used by the turn; write admission consumes the existing retained physical identity and live registry guard. Prepared readers and row refreshes consume their owner's prepared source/filename. TTS's asynchronous routes share parsing and projection with the preserved synchronous SDK functions. Text/inline/sandbox media hydration no longer eagerly discovers host media roots, and attachment construction no longer probes existence before the actual read.
Production delta: +107 lines (353 added, 246 removed). Growth is mainly the synchronous SDK compatibility boundary plus asynchronous TTS routes and explicit database execution custody; smaller redundant paths are deleted. No new persistent cache.
Evidence
Built isolated Gateway, real
chat.send→agent.wait, synthetic 35.000 GiB SQLite database with 5,000 sessions and 62,000 workspace files / 1.116 GB. Local APFS, not a btrfs reproduction. Instrumentation records main-thread synchronous fs/fs-safe/SQLite API stacks, counts and duration without argument/file contents. Nested calls are counted once; API calls are not a kernel syscall census.Acceptance recorded before candidate measurement: five serial interleaved A1/B/A2 triples, cold and warm separate, no unexplained ≥20% regression, changed-owner sync work eliminated, and warm event-loop maximum below 50 ms under an injected 500 ms TTS filesystem delay. Timing disables wrappers; sampled V8 allocations use a separate cohort. Each process runs one first-use and two warm turns; p95 at n=5 is the maximum, not a population-tail estimate.
Matched injected-delay proof: baseline warm loop maxima 525.07/522.45 ms; candidate 27.03/25.61 ms. Write-admission owner benchmark (five A1/B/A2 triples × 2,000 calls): synchronous calls 5 → 0; median main CPU 28.586/8.387/30.991 µs; sampled bytes 20,540/18,779/20,626; delayed heartbeat 506.500/1.951/507.395 ms.
Follow-up acceptance before the new run: eight serial alternating A/B pairs on a quiet host, one fresh Gateway/first-use turn each, identical copied synthetic fixture and pinned builds, every pair retained. Quiet admission requires ≥85% CPU idle and one-minute load ≤4.2 on 14 logical CPUs. Compare all pair-level loop maxima and their median/p95; an unexplained ≥20% cold-loop increase remains a stop. Baseline is
1313c75c3bc7, candidate671d3a3ca78e.Original loaded-host observation, retained for comparison: elapsed p95 A1/B/A2 2,757.821/3,680.458/1,838.427 ms; main CPU 1,280.631/1,794.217/1,223.107 ms; loop max 189.137/417.595/191.234 ms. First-row main CPU p95 18.898/26.995/20.748 ms. The candidate outlier samples existing synchronous plugin-artifact hashing, with unchanged relevant source, but exact-outlier operation counts are unavailable and extra CPU is not causally explained. That profile alone did not clear the gate; the eight-pair follow-up below addresses it.
Quiet-host follow-up completed all eight alternating A/B pairs on a 14-logical-CPU macOS host using byte-verified copies of both built runtimes and the same synthetic database/workspace. Each process passed the ≥85% idle / load≤4.2 admission; no timed sample was discarded. Copy-triggered Spotlight indexing was resolved by moving only the task directory under
.noindexbefore any measurement. Baseline/candidate cold-loop medians 85.098/86.376 ms, observed p95/max 89.194/90.636 ms: +1.5%/+1.6%; largest paired increase 6.3%, no recurrence of the original418ms candidate stall. Fixed AB ordering retains filesystem-cache warmth; these are process-first-use measurements, not disk-cold or a population-p95 estimate.Lead accepted: cold elapsed p95 and first-row tails are inside A/A noise (A/A spans 50%/74%); warm event-loop pauses with 500 ms injected fs delay 525→27 ms.
CPU limits remain visible: quiet-cohort main CPU median 871.369→877.613 ms (+0.72%), process CPU median 4519.330→4552.086 ms (+0.72%). Process CPU observed maximum grows 4614.889→5775.170 ms (+25.14%), concentrated in pair1 (+42.57% paired); no uniform CPU improvement is claimed. The lead’s follow-up landing condition is the cold-loop comparison above.
The +107 production-line growth is accepted. The quiet cohort used production head671d3a3ca78e; subsequent head
14a3c9f229c3changes only test consumers, their exact guards, and PostgreSQL test isolation. The first CI failures were PR-caused and repaired: two missing async-TTS mock exports, two unawaited model-alias assertions, and the instrumentation suppression inventory. The first repair passed 54 affected tests; the next two missed async consumers passed 8 tests after an exact-head red reproduction. Scoped lint/format and fresh Codex reviews pass. Three obsolete mock exemptions were removed. The only new lint inventory entry records the probe's twoModule._loadaccesses, required to observe native addon exports bypassing node:fs; this is a narrow, source-verified instrumentation exception, with no product suppression.Live-model runs completed three actual synthetic file reads each, with and without Docker sandboxing. The model's final text incorrectly described the files despite correct read-tool results on both baseline and candidate; these prove tool execution, not semantic answer correctness. Final warm sandbox calls fell from 3,749/3,723 to 3,377/3,388; substantial synchronous work remains.
Focused owner regressions fail on exact parent
1313c75c3bc71c94be7f02dde5ce2f979320f9b9and pass with the fix. Owner/caller suites, prompt-prefix stability, 6 Chromium browser tests and 16 UI E2E tests passed. Build, typechecks, lint, formatting and database guards passed. Codex autoreview is scoped-clean through P2 after fixing a harness history-limit finding.pnpm check:changedalso exposes inherited dead-export regressions reproduced on that exact parent: involvement helper introduced byb129ffcd845009cb7c284ab18a93e4536b318ef9(#184511), three hook types by71e516af03a11fb1e309ff4fd2a0b8dccee506da(#190906), and the parent's realtime-voice type after403b0ced4f6b8e3806cfd435907de5b7a4cc9571(#164816) removed its final SDK forwarding. These are main regressions, not ignored noise. Final six-file verification passed 268 tests; mock-export, line-cap, scoped lint and formatting gates passed after deleting six obsolete mock exemptions. No new baseline allowance was added.Reproduction entry points:
Use
--timingsor--allocationsfor separate metric cohorts, and--live/--sandboxfor live-provider tool proof. Fixtures must be synthetic; never point this workload at a live state directory.The completed second CI run also exposed an inherited PostgreSQL test-isolation regression from
6fd646e86cd7c4decdaadd8901dd7f2846b837c2(#188978): an unrelated test deleting itsrestore_%schema changed this test's global before/after listing. Deterministic foreign-schema cleanup reproduces the same failure on exact parent1313c75c3bc7. This PR gives the test a dedicated database while retaining the full namespace leak-detection assertion; the same interference passes locally and cleanup leaves zero owned databases/namespaces. Test-only fix is net zero lines, with scoped lint/format and independent review passing. This is a repaired main regression, not ignored CI noise.Final CI run 41451470249 completed with all jobs passing except the Workshop due-review test and its aggregate gate. Its global fake-timer census expected one timer and observed two. The test now waits for the scheduler’s 30-second timer directly, preserving clock advancement, current-config identity, policy refusal, and no-agent-run assertions. All 19 affected Bun tests and scoped lint/format pass; fresh Codex review is clean through P2. Production code is unchanged.
The fragile timer-count assertion originated in
60bee201456bc00cb61d42bfd0912b9013e9af01(#173557). Exact-parent1313c75c3bc7proof deliberately overlaps a real worker task’s 60-second watchdog with the scheduler timer: the old assertion fails both policy variants with 2 vs 1; the repaired assertion passes both with the same two timers. Unmodified parent/candidate runs passed naturally, so this is explicitly injected proof of the pre-existing test assumption; the CI log does not identify its original extra timer. This main test regression is repaired here rather than treated as noise.Related source-only dependency work: openclaw/fs-safe#1055 moves POSIX built-in root/read admission off synchronous filesystem paths. It is not adopted here; no dependency bump, release, or publication is part of this PR.
Integration qualification:
1d3e43aed595completed CI run 41455499559 successfully. Main then independently landed the restore-test isolation fix in #190918 (e68dfaf78a58), causing a textual conflict with our duplicate test repair. After confirmed retirement of the pinned auto-merge request, main9ee8b7020c41was integrated and its PostgreSQL test retained byte for byte, including the sibling-schema interference regression. Production files merged cleanly; growth remains +107 (354 added /247 removed relative to the new main). Fresh Codex review of the full PR against that main is scoped-clean through P2; 63 message-send tests, 10 session-reader tests and the PostgreSQL test pass. The resolved head isa80b1cc86aa1a588b7930ad700e4ed1781dbc12a; prior-head CI is retained as prior-head evidence, with fresh CI required for this head. The performance tables measure the original pinned production candidate, not a new measurement of integrated main.Current integrated-head qualification:
pnpm check:changednow exits 0, including the full-tree dead-export scans (zero entries). Prompt-prefix (41), transcript lifecycle (14), and attempt setup (11) tests also pass after integration. The historical old-base dead-export failures above are not outstanding local failures.CI run 41461796263 on exact head
a80b1cc86aa1a588b7930ad700e4ed1781dbc12aexposed a newly observed main regression:test/scripts/test-projects.test.ts > Windows CI partitions > keeps explicit coverage disjoint without repeating small project setupnames missingsrc/infra/sqlite-snapshot-staging.cancellation.test.ts. Introducing commite68dfaf78a587b8be63168e397fc52290ea3eff0(#190918) deleted that test while retaining its Windows manifest target. The unmodified exact integrated main parent9ee8b7020c413fd2c23c923c6abf2b44ce1e5cc3reproduces the identical assertion (1 failed, 209 skipped). Manifest, failing invariant, validator and execution-owner blobs are unchanged between the actual CI main parent59373145f005e606dc25c6cc1dc88f3429a9e308and tested merge12dc95b3882b326011dd25772c01077ffdcc66ac; the missing path is absent in both. This is an attributed main regression for follow-up, not CI noise or a green-CI claim. The task authorizes a pinned-head admin landing when only proven inherited reds remain and local proof is green; native qualification is pending complete CI job accounting.Landed: reviewed head
a80b1cc86aa1a588b7930ad700e4ed1781dbc12awas squash-merged as161f76d795a55943a88fc8ed00bac122b7ceba4eon 2026-11-02 14:55:40 UTC through the native inherited-failure exception. All 87 CI jobs reached terminal state; only the attributed Windows manifest job and its downstream aggregate failed. Security and all three PostgreSQL shards passed. Native landing-parent audit matched67416fcc273715af02c827f1736f665d67991982; completion receipt is complete. Final squash production delta: 353 added /246 removed = +107. The Windows manifest regression remains a main follow-up; no green-CI claim. fs-safe#1055 remains open/unmerged and source-only.