Repository navigation
improve(test): reduce Tlon monitor test runtime - #124036
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Land-ready verification for exact head Exact proof
Mutation and owner-boundary proof
Same-Testbox A/B
The controlled A/B was run on Testbox LOC split: tests |
|
Merged via squash.
|
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 1:36 AM ET / 05:36 UTC. ClawSweeper reviewWhat this changesThe PR replaces broad SDK imports in the Tlon monitor test with focused mocks to reduce test startup time while retaining Tlon-specific composition assertions. Merge readinessKeep open. This maintainer-owned, test-only optimization is still needed on current main; the narrowed mocks preserve the Tlon composition boundary and no actionable patch defect was found. Priority: P3 Review scores
Verification
How this fits togetherThe Tlon monitor receives Urbit SSE chat events, prepares media and an inbound envelope, then builds an OpenClaw agent context and dispatches it. This test exercises that pipeline while replacing expensive shared SDK implementation loading with tracked seams. flowchart LR
A[Tlon chat event] --> B[Tlon monitor]
B --> C[Media preparation]
C --> D[Inbound envelope]
D --> E[Agent context and dispatch]
F[Focused SDK mocks] --> B
Before merge
Agent review detailsSecurityNone. PR surfaceTests +63. Total +63 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain the focused Tlon composition assertions and land the test-only import optimization after the remaining exact-head checks are green. Do we have a high-confidence way to reproduce the issue? Not applicable: this is test-maintenance work rather than a report of broken user behavior; the PR supplies a focused before/after Testbox measurement. Is this the best way to solve the issue? Yes. Mocking only the monitor's imported SDK seams preserves Tlon’s real composition checks while core envelope and media suites retain ownership of shared-helper semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3f7c8522b725. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
The Tlon monitor tests paid to load a broad core graph even though the monitor already receives an injected Tlon runtime. Partial
importOriginalmocks for Plugin SDK runtime/media modules and the real core channel-context helper dominated import time, CPU, and memory for nine focused tests.Why This Change Was Made
The test now mocks the exact Plugin SDK seams it consumes: human-delay resolution, channel-inbound envelope/formatter construction, abortable sleep, and media constants/functions. The real Tlon monitor, Urbit client and loopback SSE lifecycle, Tlon media composition, ingress, and dispatch wiring remain intact; this adds no production or test-only seam.
The first lead review found two composition gaps. The revision now tracks a distinct inner envelope builder and asserts its exact factory configuration plus the Tlon invocation (
channel, owner sender label, timestamp, and byte-exact media prompt). It also makesbuildContextreturn a distinct sentinel and requires dispatch to receive that object by identity, while separately asserting the raw context input, attachment facts, unavailable notice, and reply media.Generic channel-envelope and media-helper semantics remain owned by the core envelope/media tests. This file continues to prove Tlon's composition of those seams.
User Impact
There is no production behavior change. Maintainers get the same nine Tlon monitor tests with substantially lower import cost, CPU demand, and peak RSS.
Evidence
7.355s -> 5.130s(-30.3%)7.075s -> 4.855s(-31.4%)4.380s -> 2.185s(-50.1%)3.700s -> 1.655s(-55.3%)0.3800s -> 0.2615s(-31.2%)7.670s -> 5.220s0.880s -> 0.525s1,114,342 -> 757,214 KiB(-32.0%)node scripts/run-vitest.mjs extensions/tlon/src/monitor/index.test.ts extensions/tlon/src/monitor/media.test.ts extensions/tlon/src/monitor/ingress.test.ts extensions/tlon/src/monitor/tracking.test.ts --maxWorkers=1— 4 files / 26 tests passed.tbx_01m01y1xf3244wtd0y1k0e5zgr: https://github.com/openclaw/openclaw/actions/runs/31866871032. The one-shot lease was stopped after success.tbx_01m01xaatfmqg32qhyexxqw56d: https://github.com/openclaw/openclaw/actions/runs/31866338265. That lease was stopped.git diff --check origin/main...HEADpassed.oxfmt --checkpassed.origin/mainreported no accepted or actionable findings.+92/-29(net+63); production+0/-0; still 9 tests; no new seam.