Skip to content

improve: speed up UTC inbound history formatting - #148648

Merged
steipete merged 1 commit into
mainfrom
codex/perf-envelope-utc-weekday-authoring-r12
Sep 15, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/perf-envelope-utc-weekday-authoring-r12

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Formatting UTC inbound history repeatedly constructs the same weekday formatter for each timestamp.

User Impact

UTC history formatting does less work while preserving the exact prompt text, date boundaries, and fallback behavior. In the synthetic ten-message history case, building an inbound context prefix dropped from 424 to 38 microseconds on Node 24 and from 379 to 39 microseconds on Node 26. This measures formatting, not end-to-end reply latency.

Why This Change Was Made

Reuse one successful UTC weekday formatter while the Intl.DateTimeFormat constructor stays the same. Every call still formats its own date; replacing the constructor or recovering from a construction/formatting failure preserves the existing behavior. The change retains one formatter per module instance and requires no configuration or migration.

Evidence

  • The final 21 envelope assertions passed on both the original and changed implementation, covering date boundaries, GMT, constructor replacement, failures, recovery, and restoration. An earlier three-suite run passed 175 tests on the same production bytes; its test file preceded the final bound-format fixture refinement.
  • Independent P0–P2 review passed. All 18 core test type graphs, production types, typed lint, formatting, and boundary checks passed. Of 30 selected checks, 29 passed; the deadcode check retained its unchanged-tooling failures for canonicalProviderName and listPackagedStaticExtensionAssetOutputs (production scan passed; full-tree/scripts scans failed). Relevant source/configuration parity supports that attribution; no baseline deadcode rerun is claimed.
  • Windows, Node 24.19.0 and 26.8.2: 24 fresh processes, three baseline/candidate/candidate/baseline blocks per runtime, three warmup and three measured batches per case. All 648 measured batches / 7,344 calls preserved complete inputs, outputs, and the reviewed loaded-source graph. The actual path is resolveEnvelopeFormatOptions plus buildInboundUserContextPrefix, using synthetic direct/group/fallback history.
  • The UTC case improved in all six paired means, all six paired medians, and all 18 corresponding sample comparisons on each runtime. Pooled mean reductions were 91.02% and 89.79%; paired median reductions ranged from 91.05–91.99% and 85.98–91.58% respectively.

The unchanged controls are mixed, including slower results: Node 24 New York current-message mean +101.26% (+17.827 microseconds), and ten-message mean +37.03% (+32.461 microseconds); Node 26 fallback-history mean +9.46% (+14.128 microseconds), with five of six mean pairs and four of six median pairs slower. These are retained and are not assigned a proven external cause. The result supports the UTC path specifically.

Timing and functional evidence use the pinned 1628d9bb2b03e4b95f1ee185cd62714e091caacc source graph and the already-landed datetime formatter prerequisite. The authoring base is 78520903d4241cf66130abe43da215763caf9dc5: the complete two-file patch is byte-identical to the reviewed/tested patch, and 53 of 54 review-context files match. Upstream package/lock changes are fs-safe 0.10.0 → 0.11.0, markdown-it 15.0.1 → 15.0.2, and the Vitest patch update. Exact-head CI passed, including the required CI gate; no measurement of that newer dependency graph is implied.

All measured cases and resource observations

Times below are microseconds per inbound-context invocation. Positive deltas are slower. Pair counts are out of six per runtime; every raw sample, including warmups and adverse results, was retained.

Runtime Cell Baseline mean us Candidate mean us Mean delta us Pooled mean % Pooled median % Adverse mean/median pairs Paired median range %
node24 current-new-york 17.605 35.432 +17.827 +101.26 -6.34 2/2 -24.16 to 42.85
node24 dm10-new-york 87.663 120.124 +32.461 +37.03 +1.79 3/2 -5.84 to 22.27
node24 group50-new-york 363.754 355.270 -8.483 -2.33 -2.06 2/2 -7.68 to 2.37
node24 fallback20-new-york 165.179 157.954 -7.225 -4.37 -1.54 3/3 -5.91 to 12.78
node24 dm10-unconfigured-local 523.036 514.522 -8.513 -1.63 -1.97 2/3 -7.28 to 5.09
node24 dm10-utc 423.897 38.081 -385.816 -91.02 -91.41 0/0 -91.99 to -91.05
node24 dm10-invalid-local 567.329 544.881 -22.448 -3.96 -4.71 3/2 -22.44 to 11.18
node24 dm10-alternating-zones 179.689 180.218 +0.529 +0.29 -4.10 2/1 -10.99 to 39.39
node24 group50-timestamps-suppressed 87.535 77.893 -9.643 -11.02 -8.12 1/1 -35.81 to 4.37
node26 current-new-york 14.992 15.946 +0.954 +6.37 -2.64 5/3 -31.49 to 18.94
node26 dm10-new-york 75.680 73.604 -2.076 -2.74 -0.45 1/1 -15.27 to 2.43
node26 group50-new-york 328.369 345.802 +17.433 +5.31 -1.74 4/2 -9.58 to 6.71
node26 fallback20-new-york 149.296 163.424 +14.128 +9.46 +0.27 5/4 -34.14 to 5.07
node26 dm10-unconfigured-local 444.067 435.562 -8.505 -1.92 -0.20 2/3 -10.46 to 12.49
node26 dm10-utc 378.848 38.665 -340.183 -89.79 -89.40 0/0 -91.58 to -85.98
node26 dm10-invalid-local 471.029 471.855 +0.826 +0.18 -0.13 2/2 -15.56 to 11.96
node26 dm10-alternating-zones 160.372 155.650 -4.722 -2.94 -1.60 4/3 -30.64 to 7.26
node26 group50-timestamps-suppressed 68.074 70.317 +2.243 +3.29 -0.89 2/3 -11.64 to 49.28

Worst absolute adverse sample: Node 26 New York group history, 310.633 → 959.700 microseconds (+649.067). Worst relative adverse sample: Node 24 New York current message, 20.323 → 199.463 microseconds (+881.49%).

Whole-child maximum RSS means were 634,998 → 619,184.667 KiB on Node 24 and 503,839.333 → 489,128 KiB on Node 26; all six RSS pairs were lower. These values include imports, fixtures, retained outputs, and serialization, so they do not measure exclusive formatter allocations. Heap/allocation data was not captured. Whole-child user CPU increased 1.82% on Node 26 and decreased 1.84% on Node 24. Per-batch CPU counters were mostly zero at Windows counter resolution; no CPU percentage speed claim is made.

The independent audit verified all four untimed captures and 24 measured children. An original 60-second failed capture was retained and not scored; a separately admitted recovery captured the complete graph before timing. Total retained raw evidence is 107,191,064 bytes across that failure, recovery, and timing. Timed cohorts ran after the other coordinated local workloads had settled; this is not a claim of machine-wide exclusivity.

Audit SHA-256: 5f2870284795e77103180eddcc43c2a9c5e0ba3ae53240ed1edb13fb7d257e23. Independent arithmetic SHA-256: f45cda14ea81aec99101204fe07e9fc3d8c8a75137704f4261c427fbf5c7609a.

@clawsweeper

clawsweeper Bot commented Sep 15, 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.

@steipete
steipete marked this pull request as ready for review September 15, 2026 00:23
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 8:30 PM ET / September 15, 2026, 00:30 UTC.

ClawSweeper review

What this changes

Reuse the UTC weekday formatter when preparing inbound message history, with tests preserving timestamp text, date boundaries, and formatter failure recovery.

Merge readiness

✅ Ready for maintainer review

The optimization remains useful: fetched main and the latest release still construct a UTC weekday formatter per timestamp. No blocking correctness or security defect was found.

Priority: P2
Reviewed head: c68c3c81032b871b49132d052bc55e2864fde9b4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with meaningful compatibility assertions and detailed, appropriately bounded runtime measurements.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied Windows Node 24/26 measurements exercise the actual inbound-context builder and changed timestamp owner, reporting preserved outputs and consistently faster UTC formatting; the evidence explicitly identifies its tested source graph and dependency limits.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied Windows Node 24/26 measurements exercise the actual inbound-context builder and changed timestamp owner, reporting preserved outputs and consistently faster UTC formatting; the evidence explicitly identifies its tested source graph and dependency limits.
Evidence reviewed 6 items Verified introduced change: The pinned merge-base-to-head diff contains only the formatter cache and envelope tests. Cache admission follows successful formatting, constructor identity controls reuse, and the existing timestamp-only catch remains intact.
Still needed on main and release: Both fetched main and v2026.9.4 retain per-call UTC weekday construction. The existing zoned formatter cache does not serve this separate UTC output path.
Production entrypoint: The reply context builder resolves envelope options and calls buildInboundUserContextPrefix; its conversation timestamp helper invokes the changed formatter. This connects the reported benchmark to production prompt preparation without any Codex dependency.
Findings None None.
Security None None.

How this fits together

OpenClaw formats incoming messages and conversation history into context for the agent. The envelope formatter converts message timestamps into readable dates before that context enters the prompt.

flowchart TD
  A[Incoming messages and history] --> B[Inbound context builder]
  C[Timezone preferences] --> D[Envelope timestamp formatter]
  B --> D
  D --> E{UTC formatting?}
  E -->|Yes| F[Reuse weekday formatter]
  E -->|No| G[Existing zoned formatter]
  F --> H[Agent prompt context]
  G --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +14, Tests +60. Total +74 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 17 3 +14
Tests 1 70 10 +60
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 87 13 +74

Review metrics

Metric Value Why it matters
Reported UTC formatting improvement Ten-message mean: 424→38 µs on Node 24; 379→39 µs on Node 26 Production-entrypoint measurements support the narrow optimization without claiming an equivalent reply-latency improvement.

Technical review

Best possible solution:

Keep formatter reuse within the existing envelope owner while preserving prompt bytes and all timezone defaults.

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

Not applicable as a functional bug: source confirms repeated UTC formatter construction, and the PR supplies production-entrypoint performance measurements; this read-only review did not execute benchmarks or tests.

Is this the best way to solve the issue?

Yes. A bounded cache keyed by constructor identity removes repeated construction without introducing another API or changing the established UTC text format.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 91864334a65a.

Labels

Label changes:

  • add P2: A bounded performance improvement reduces repeated work during UTC history preparation without changing user-facing behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied Windows Node 24/26 measurements exercise the actual inbound-context builder and changed timestamp owner, reporting preserved outputs and consistently faster UTC formatting; the evidence explicitly identifies its tested source graph and dependency limits.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied Windows Node 24/26 measurements exercise the actual inbound-context builder and changed timestamp owner, reporting preserved outputs and consistently faster UTC formatting; the evidence explicitly identifies its tested source graph and dependency limits.

Label justifications:

  • P2: A bounded performance improvement reduces repeated work during UTC history preparation without changing user-facing behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied Windows Node 24/26 measurements exercise the actual inbound-context builder and changed timestamp owner, reporting preserved outputs and consistently faster UTC formatting; the evidence explicitly identifies its tested source graph and dependency limits.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied Windows Node 24/26 measurements exercise the actual inbound-context builder and changed timestamp owner, reporting preserved outputs and consistently faster UTC formatting; the evidence explicitly identifies its tested source graph and dependency limits.

Evidence

What I checked:

  • Verified introduced change: The pinned merge-base-to-head diff contains only the formatter cache and envelope tests. Cache admission follows successful formatting, constructor identity controls reuse, and the existing timestamp-only catch remains intact. (src/auto-reply/envelope.ts:147, c68c3c81032b)
  • Still needed on main and release: Both fetched main and v2026.9.4 retain per-call UTC weekday construction. The existing zoned formatter cache does not serve this separate UTC output path. (src/auto-reply/envelope.ts:140, 91864334a65a)
  • Production entrypoint: The reply context builder resolves envelope options and calls buildInboundUserContextPrefix; its conversation timestamp helper invokes the changed formatter. This connects the reported benchmark to production prompt preparation without any Codex dependency. (src/auto-reply/reply/inbound-meta.ts:503, c68c3c81032b)
  • Reported runtime measurements: The fully supplied PR body reports Windows Node 24.19.0 and 26.8.2 runs through resolveEnvelopeFormatOptions and buildInboundUserContextPrefix: 648 measured batches, preserved outputs, and UTC ten-message means of 423.897→38.081 and 378.848→38.665 microseconds. It identifies tested source graph 1628d9b, reports patch identity, and explicitly limits claims concerning newer dependencies, adverse controls, and end-to-end latency. These are contributor-reported observations, not reviewer reruns. (1628d9bb2b03)
  • Prior merged formatter work: GitHub confirms perf(time): reuse explicit timezone formatters #132981 merged at c52527b. Its patch consolidates non-UTC weekday formatting but retains per-call UTC construction, so it is a prerequisite rather than a replacement. (src/auto-reply/envelope.ts:142, c52527b43340)
  • History and routing: Current-main file history identifies prior formatter work by Peter Steinberger and configured-timezone validation by Vincent Koc. GitHub commit patches verify the relevant changes and handles. Deeper local blame and patch-history traversal encountered unavailable historical objects; no original-feature attribution is claimed. (src/auto-reply/envelope.ts:76, 1f56e2da21a2)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit dae3742 into main Sep 15, 2026
265 checks passed
@steipete
steipete deleted the codex/perf-envelope-utc-weekday-authoring-r12 branch September 15, 2026 00:54
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
steipete added a commit that referenced this pull request Oct 15, 2026
…173047)

* refactor(auto-reply): consolidate delivery preparation

Share aggregate collect/overflow adoption, transcript settlement and reply
sanitization. Reuse ACP account preparation, keep fixed export colors with
their CSS owner, and remove redundant runtime/cache checks. Preserve live
authorization, FIFO, consume-before-ack and ordinary write settlement.

Production: +307/-446, net 139 lines removed. Tests: +37/-83, net 46 removed.
The optional session rollover and session-event assertion cleanups were dropped
after unresolved memory-hook/background-permission proof. Their owners and the
standalone session-memory backend/tests are unchanged.

Best-effort tradeoffs accepted

- Intl constructor hot replacement after cache fill: #148648 added synthetic replacement/recovery coverage, not an incident fix; normal processes keep Intl stable. The measured formatter cache and native fallback stay; replacement takes effect after restart.
- Media application failure clearing a successful import: #154864 extracted this path, without a module-reload incident. ESM code is process-stable and the lazy loader already evicts rejected loads; raw-content fallback remains and successful imports are reused.
- Link application failure clearing a successful import: same #154864 provenance and canonical eviction owner. A successful ESM module is reused; raw-content fallback and AbortError propagation remain.
- Collect-source reinsertion after a preparation failure: #103695 predates #172080's consume-before-ack cutover. Unaccepted inputs remain queued and accepted inputs must not replay; unexplained internal queue mutation is no longer repaired here, while durable ingress retains pre-acceptance retry.
- A source abort between consecutive synchronous prepared checks: the earlier #100123 TUI fixes remain, including their real #89059/#90012 behavior. The canonical prepared assertion checks every source; Stop membership filtering and aggregate cancellation still protect actual awaits.
- Duplicate ACP post-resolution assertion: #159084 introduced async metadata ownership. Resolution still receives its owner assertion and the caller keeps the final post-await check; the private wrapper and its earlier duplicate check are gone.
- Mutation of constructor metadata bags: #121995 retained forwarding getters, but the sole production constructor call at reply-turn-admission.ts:524 supplies a fresh value literal. Those values are captured once; live session/agent/result accessors remain. The review's hypothetical retained/getter-valued constructor caller does not exist and is not a shipped SDK contract.

Evidence

Final format, changed lint, core production types, messaging test types,
line-cap and runtime cycles pass. Madge reports zero cycles; all follow-up
import specifiers are unchanged. All non-whitespace export CSS and all 40 fixed
declarations match the pinned generated stylesheet. Independent full-candidate
review completed with one source-disproved speculative P2; no accepted finding.
Completed focused selections: initial unit-fast 4 files/40 tests, HTML 3 files/29
tests, and final lint-suppressions 1 file/3 tests. ACP default-account and delivery
assertions, plus capture/hook/callback-settlement assertions, passed individually;
interrupted infra selections and remaining owner suites are incomplete.

Unresolved local failures: the retiring memory-window case timed out at 125461ms,
and the allowed background-permission completion case at 120332ms (both existing
120000ms limits). Related optional owner hunks were dropped, not claimed fixed.
An unchanged-session-owner replay was inconclusive; no main/load attribution.
No tests, timeouts, retries or skips were weakened.

Broad check-changed is incomplete. Its env inventory reported 455 against 454;
the same count was reproduced from original base 9e3e16c and recorded main
a065e6a, without patch-added env names or a budget edit. No hosted PR CI is
claimed: below-500 branch-only handoff for coordinator bundling.

* refactor(auto-reply): remove test-only runtime plumbing

Continue the same lane with direct owner resets instead of test-global
publications, inline the sole queue-wait scaffold, remove test-only delivery
getters, and share the immutable HTML tree and text extraction. Keep actual
login consent, interrupt authority, busy rechecks, dedupe, delivery recovery,
FIFO, transcript writes and ordinary shutdown settlement unchanged.

This follow-up removes 118 net production lines. Full branch: +341/-598,
257 net production lines removed; tests/support +84/-230, 146 net removed.
Largest-file, sole-caller, dead-export, option and compatibility sweeps found
no further sound cut without removing retained behavior or moving code.
Phase E session memory and its tests are untouched. No config, schema,
durability, retention, permission, protocol or dependency changes.

Best-effort tradeoffs accepted

- Command descriptors no longer manufacture absent optional own-undefined
  properties. The private typed builder dates to #117143, with later work
  in #163997; no production enumeration consumer exists. Property reads,
  supplied fields, defaults and JSON behavior remain unchanged.
- HTML entries are immutable for the lifetime of an export viewer. Build
  its tree/index once; external mutation of this private snapshot is not
  supported. Keep the iterative long-session fix from #151029.

Evidence

Fresh isolated full-branch review is scoped-clean through P2. Changed lint,
format, core types, messaging/root-tooling test types, line cap and runtime
cycles pass (0 runtime value cycles). The initial test-type invocation used
an invalid canonical graph selector; the corrected supported commands pass.
No new production runtime import edges; prior zero-cycle Madge proof applies.

Focused proof passes: 15 files/318 tests across four shards, 1629.71s total
including 382.56s worker preparation. Final-outcome/HTML: 4 files/45 tests;
ingress retry: 1 file/6 tests; required lint-suppressions: 1 file/3 tests;
auto-reply owners: 9 files/264 tests. Consent fixtures emitted host-broker
metadata-write warnings; all assertions passed. All proof used isolated
HOME/OpenClaw/XDG state, never real user state.

Earlier memory-window and background-permission timeouts remain unresolved;
their optional owner hunks were dropped, not claimed fixed. Broad changed
check remains incomplete, including the baseline-reproduced env inventory
455/454 finding. No tests, timeouts, retries, skips or budgets were weakened.
Below-500 branch-only handoff; no PR or hosted CI is claimed.

* refactor(channels): consolidate secondary transport plumbing

Use existing SDK setup and sleep owners, reuse parsed Tlon list items,
consolidate LINE callback validation and Teams sender selection, replace
iMessage's parallel cache indices, and remove redundant QA snapshots.
Preserve account, security, conversation, transport and settlement contracts.

Best-effort tradeoffs accepted:
- Feishu identity published before successor route registration during an old
  webhook drain may be cleared until refresh/restart. Available #48588 evidence
  only forces that identity interleaving in a test, with no cited human report;
  registered successors, signed ingress and response settlement remain protected.
- QA senders that mutate already-sanitized internal tool records no longer
  receive independent deep-snapshot comparison. Native records only append;
  the mutation tests from #114910 monkeypatch a sender. Duplicate final
  suppression and pre-await tool-array capture remain.
- Retired Bot Framework revoked proxies no longer trigger proactive resend.
  The historical #27189 defect belonged to the SDK replaced in #51808;
  current Teams ActivityContext is not a revocable proxy. Unexpected errors
  now follow the ordinary delivery-error path, without duplicate fallback.
- The bounded self-chat cache uses linear lookup instead of synchronized
  indices. #161967 establishes no measured lookup-performance requirement;
  existing TTL, cap, timestamp, scope and hash matching remain unchanged.

No config, protocol, dependency, schema, durability, retention, permission or
public SDK contract changes. Phase E memory backend is untouched.

Net production: 246 lines removed (83 added, 329 deleted), excluding tests,
support and inventories. Fresh review through P2 is clean; production/test
extension types and both cycle checks pass (zero cycles). X focused suites
pass 31 tests; native Buzz baseline/current protocol probes preserve signed
discovery, cancellation and notification-driven retry. Other direct owner
probes cover Tlon, self-chat caching, LINE limits and Mattermost setup.

Local proof gaps: SDK declaration preparation timed out before lint; the
remaining owner suites produced no assertions during loaded-host startup;
full check-changed was classified but not run. The suppression test has
unrelated UI-only allowlist drift inherited from the base. No new suppression,
timeout increase, retry, skip or baseline expansion.

* refactor(channels): simplify account-scoped transport owners

Use the existing account registry as Twitch's only account owner, fold the
private Teams store selector into its only caller, share QA message sending,
and remove redundant Feishu table/cache and mobile expiry work. Convert
replacement table-cell Markdown before deleting its existing content.

Best-effort tradeoffs accepted:
- Feishu optional bot-name failures use one 60-second account cooldown, not
  ten failures plus an hour-long circuit. #89783 documents feature proof,
  not a human incident needing that circuit. Names recover next minute.
- Unsupported runtimes without Intl.Segmenter now fail clearly; supported
  Node/current Bun preserve #96587's real grapheme/emoji repair.
- Malformed duplicate Feishu block IDs retain source/current-table order,
  not redundant map/sort or first-match order. Valid provider trees retain
  the tree reconstruction and table-width behavior from #40524.
- LINE cache eviction assumes ordinary wall-clock order. #132108's real
  account identity fix remains; backward clock jumps may evict another
  display-name entry, which is refetched normally.
- iMessage/Zalouser internal expiries trust Date.now plus constant TTLs.
  Direct commits 5269924/becd45325bc and 743d537 only test NaN,
  Infinity or year-275760 clocks, not human reports. Monkeypatched invalid
  clocks may keep cached verdicts/metadata until restart.
- Zalo's duplicate expiry preflight is gone; the shared hosted-media owner
  still rejects before download. f91ddef added only synthetic clock
  handling; an invalid clock now receives that owner's generic error.
- FaceTime cancels synchronous drain timers rather than fencing them with
  generations. #119291 cites no stale-timer incident; barge-in, carrier
  authority, playback timing and shutdown settlement remain.
- Private Twitch managers serve one registered account, not arbitrary
  additional username/channel pairs. #1612 introduced unused inner maps;
  production managers already belong to one account. Real startup
  cancellation and connection sharing from #128909 remain.

No config, protocol, dependency, schema, retention, permission or public SDK
changes. Phase E memory is untouched. The attempted vendor-type consolidation
was fully dropped because the pinned ZCA package cannot expose its public
types under NodeNext without an approval-gated dependency/configuration fix.

Reopened pass: 183 additional net production lines removed; branch total429
(176 added/605 deleted), excluding tests/support/generated/declarations.
Production/test extension types, runtime/Madge zero-cycle checks, formatting
and actual Tlon/long-sleep owner probes pass. Fresh P2 review has three
source-disproved findings and no accepted/actionable finding. Two mocked
constructor lint errors were mechanically fixed and their narrow guard passes.
Owner suites remained startup-bound and were stopped before assertions;
the docx regression/control remains unproved. Suppression suite retains only
the known base UI allowlist drift. Full package-aware lint/check-changed and
exact bundle-head CI remain for coordinator bundling. No structural PR.

* test: repair wave-5 bundle integration checks
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…penclaw#173047)

* refactor(auto-reply): consolidate delivery preparation

Share aggregate collect/overflow adoption, transcript settlement and reply
sanitization. Reuse ACP account preparation, keep fixed export colors with
their CSS owner, and remove redundant runtime/cache checks. Preserve live
authorization, FIFO, consume-before-ack and ordinary write settlement.

Production: +307/-446, net 139 lines removed. Tests: +37/-83, net 46 removed.
The optional session rollover and session-event assertion cleanups were dropped
after unresolved memory-hook/background-permission proof. Their owners and the
standalone session-memory backend/tests are unchanged.

Best-effort tradeoffs accepted

- Intl constructor hot replacement after cache fill: openclaw#148648 added synthetic replacement/recovery coverage, not an incident fix; normal processes keep Intl stable. The measured formatter cache and native fallback stay; replacement takes effect after restart.
- Media application failure clearing a successful import: openclaw#154864 extracted this path, without a module-reload incident. ESM code is process-stable and the lazy loader already evicts rejected loads; raw-content fallback remains and successful imports are reused.
- Link application failure clearing a successful import: same openclaw#154864 provenance and canonical eviction owner. A successful ESM module is reused; raw-content fallback and AbortError propagation remain.
- Collect-source reinsertion after a preparation failure: openclaw#103695 predates openclaw#172080's consume-before-ack cutover. Unaccepted inputs remain queued and accepted inputs must not replay; unexplained internal queue mutation is no longer repaired here, while durable ingress retains pre-acceptance retry.
- A source abort between consecutive synchronous prepared checks: the earlier openclaw#100123 TUI fixes remain, including their real openclaw#89059/openclaw#90012 behavior. The canonical prepared assertion checks every source; Stop membership filtering and aggregate cancellation still protect actual awaits.
- Duplicate ACP post-resolution assertion: openclaw#159084 introduced async metadata ownership. Resolution still receives its owner assertion and the caller keeps the final post-await check; the private wrapper and its earlier duplicate check are gone.
- Mutation of constructor metadata bags: openclaw#121995 retained forwarding getters, but the sole production constructor call at reply-turn-admission.ts:524 supplies a fresh value literal. Those values are captured once; live session/agent/result accessors remain. The review's hypothetical retained/getter-valued constructor caller does not exist and is not a shipped SDK contract.

Evidence

Final format, changed lint, core production types, messaging test types,
line-cap and runtime cycles pass. Madge reports zero cycles; all follow-up
import specifiers are unchanged. All non-whitespace export CSS and all 40 fixed
declarations match the pinned generated stylesheet. Independent full-candidate
review completed with one source-disproved speculative P2; no accepted finding.
Completed focused selections: initial unit-fast 4 files/40 tests, HTML 3 files/29
tests, and final lint-suppressions 1 file/3 tests. ACP default-account and delivery
assertions, plus capture/hook/callback-settlement assertions, passed individually;
interrupted infra selections and remaining owner suites are incomplete.

Unresolved local failures: the retiring memory-window case timed out at 125461ms,
and the allowed background-permission completion case at 120332ms (both existing
120000ms limits). Related optional owner hunks were dropped, not claimed fixed.
An unchanged-session-owner replay was inconclusive; no main/load attribution.
No tests, timeouts, retries or skips were weakened.

Broad check-changed is incomplete. Its env inventory reported 455 against 454;
the same count was reproduced from original base d6898f3 and recorded main
51164a1, without patch-added env names or a budget edit. No hosted PR CI is
claimed: below-500 branch-only handoff for coordinator bundling.

* refactor(auto-reply): remove test-only runtime plumbing

Continue the same lane with direct owner resets instead of test-global
publications, inline the sole queue-wait scaffold, remove test-only delivery
getters, and share the immutable HTML tree and text extraction. Keep actual
login consent, interrupt authority, busy rechecks, dedupe, delivery recovery,
FIFO, transcript writes and ordinary shutdown settlement unchanged.

This follow-up removes 118 net production lines. Full branch: +341/-598,
257 net production lines removed; tests/support +84/-230, 146 net removed.
Largest-file, sole-caller, dead-export, option and compatibility sweeps found
no further sound cut without removing retained behavior or moving code.
Phase E session memory and its tests are untouched. No config, schema,
durability, retention, permission, protocol or dependency changes.

Best-effort tradeoffs accepted

- Command descriptors no longer manufacture absent optional own-undefined
  properties. The private typed builder dates to openclaw#117143, with later work
  in openclaw#163997; no production enumeration consumer exists. Property reads,
  supplied fields, defaults and JSON behavior remain unchanged.
- HTML entries are immutable for the lifetime of an export viewer. Build
  its tree/index once; external mutation of this private snapshot is not
  supported. Keep the iterative long-session fix from openclaw#151029.

Evidence

Fresh isolated full-branch review is scoped-clean through P2. Changed lint,
format, core types, messaging/root-tooling test types, line cap and runtime
cycles pass (0 runtime value cycles). The initial test-type invocation used
an invalid canonical graph selector; the corrected supported commands pass.
No new production runtime import edges; prior zero-cycle Madge proof applies.

Focused proof passes: 15 files/318 tests across four shards, 1629.71s total
including 382.56s worker preparation. Final-outcome/HTML: 4 files/45 tests;
ingress retry: 1 file/6 tests; required lint-suppressions: 1 file/3 tests;
auto-reply owners: 9 files/264 tests. Consent fixtures emitted host-broker
metadata-write warnings; all assertions passed. All proof used isolated
HOME/OpenClaw/XDG state, never real user state.

Earlier memory-window and background-permission timeouts remain unresolved;
their optional owner hunks were dropped, not claimed fixed. Broad changed
check remains incomplete, including the baseline-reproduced env inventory
455/454 finding. No tests, timeouts, retries, skips or budgets were weakened.
Below-500 branch-only handoff; no PR or hosted CI is claimed.

* refactor(channels): consolidate secondary transport plumbing

Use existing SDK setup and sleep owners, reuse parsed Tlon list items,
consolidate LINE callback validation and Teams sender selection, replace
iMessage's parallel cache indices, and remove redundant QA snapshots.
Preserve account, security, conversation, transport and settlement contracts.

Best-effort tradeoffs accepted:
- Feishu identity published before successor route registration during an old
  webhook drain may be cleared until refresh/restart. Available openclaw#48588 evidence
  only forces that identity interleaving in a test, with no cited human report;
  registered successors, signed ingress and response settlement remain protected.
- QA senders that mutate already-sanitized internal tool records no longer
  receive independent deep-snapshot comparison. Native records only append;
  the mutation tests from openclaw#114910 monkeypatch a sender. Duplicate final
  suppression and pre-await tool-array capture remain.
- Retired Bot Framework revoked proxies no longer trigger proactive resend.
  The historical openclaw#27189 defect belonged to the SDK replaced in openclaw#51808;
  current Teams ActivityContext is not a revocable proxy. Unexpected errors
  now follow the ordinary delivery-error path, without duplicate fallback.
- The bounded self-chat cache uses linear lookup instead of synchronized
  indices. openclaw#161967 establishes no measured lookup-performance requirement;
  existing TTL, cap, timestamp, scope and hash matching remain unchanged.

No config, protocol, dependency, schema, durability, retention, permission or
public SDK contract changes. Phase E memory backend is untouched.

Net production: 246 lines removed (83 added, 329 deleted), excluding tests,
support and inventories. Fresh review through P2 is clean; production/test
extension types and both cycle checks pass (zero cycles). X focused suites
pass 31 tests; native Buzz baseline/current protocol probes preserve signed
discovery, cancellation and notification-driven retry. Other direct owner
probes cover Tlon, self-chat caching, LINE limits and Mattermost setup.

Local proof gaps: SDK declaration preparation timed out before lint; the
remaining owner suites produced no assertions during loaded-host startup;
full check-changed was classified but not run. The suppression test has
unrelated UI-only allowlist drift inherited from the base. No new suppression,
timeout increase, retry, skip or baseline expansion.

* refactor(channels): simplify account-scoped transport owners

Use the existing account registry as Twitch's only account owner, fold the
private Teams store selector into its only caller, share QA message sending,
and remove redundant Feishu table/cache and mobile expiry work. Convert
replacement table-cell Markdown before deleting its existing content.

Best-effort tradeoffs accepted:
- Feishu optional bot-name failures use one 60-second account cooldown, not
  ten failures plus an hour-long circuit. openclaw#89783 documents feature proof,
  not a human incident needing that circuit. Names recover next minute.
- Unsupported runtimes without Intl.Segmenter now fail clearly; supported
  Node/current Bun preserve openclaw#96587's real grapheme/emoji repair.
- Malformed duplicate Feishu block IDs retain source/current-table order,
  not redundant map/sort or first-match order. Valid provider trees retain
  the tree reconstruction and table-width behavior from openclaw#40524.
- LINE cache eviction assumes ordinary wall-clock order. openclaw#132108's real
  account identity fix remains; backward clock jumps may evict another
  display-name entry, which is refetched normally.
- iMessage/Zalouser internal expiries trust Date.now plus constant TTLs.
  Direct commits 3bcf53d/233d19aff94 and 2bf2afc only test NaN,
  Infinity or year-275760 clocks, not human reports. Monkeypatched invalid
  clocks may keep cached verdicts/metadata until restart.
- Zalo's duplicate expiry preflight is gone; the shared hosted-media owner
  still rejects before download. 2512ef2 added only synthetic clock
  handling; an invalid clock now receives that owner's generic error.
- FaceTime cancels synchronous drain timers rather than fencing them with
  generations. openclaw#119291 cites no stale-timer incident; barge-in, carrier
  authority, playback timing and shutdown settlement remain.
- Private Twitch managers serve one registered account, not arbitrary
  additional username/channel pairs. openclaw#1612 introduced unused inner maps;
  production managers already belong to one account. Real startup
  cancellation and connection sharing from openclaw#128909 remain.

No config, protocol, dependency, schema, retention, permission or public SDK
changes. Phase E memory is untouched. The attempted vendor-type consolidation
was fully dropped because the pinned ZCA package cannot expose its public
types under NodeNext without an approval-gated dependency/configuration fix.

Reopened pass: 183 additional net production lines removed; branch total429
(176 added/605 deleted), excluding tests/support/generated/declarations.
Production/test extension types, runtime/Madge zero-cycle checks, formatting
and actual Tlon/long-sleep owner probes pass. Fresh P2 review has three
source-disproved findings and no accepted/actionable finding. Two mocked
constructor lint errors were mechanically fixed and their narrow guard passes.
Owner suites remained startup-bound and were stopped before assertions;
the docx regression/control remains unproved. Suppression suite retains only
the known base UI allowlist drift. Full package-aware lint/check-changed and
exact bundle-head CI remain for coordinator bundling. No structural PR.

* test: repair wave-5 bundle integration checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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