Skip to content

refactor(matrix): move thread bindings to workers - #168485

Merged
steipete merged 136 commits into
mainfrom
dbasync/sw7b-7
Oct 10, 2026
Merged

steipete merged 136 commits into
mainfrom
dbasync/sw7b-7

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Matrix thread binding lookups and updates can access SQLite on the Gateway thread, and queued persistence must preserve newer binding changes and accepted activity.

User Impact

Matrix binding reads use the worker-hydrated owner projection. Activity writes update the affected key, keep the existing coalescing policy, and publish committed facts before async completion. Shutdown drains accepted work before its final flush.

Why This Change Was Made

Moves Matrix thread binding persistence and all bundled adapters to the versioned async contract. Queued snapshots are captured at execution time; known partial commits reconcile acknowledged state, while unknown outcomes retire the manager. Released synchronous methods remain deprecated during the compatibility window. The session adapter is separated from persistence without introducing another state owner.

This is part 8 of the nine-part S7 state/binding migration stack. Targets dbasync/sw7b-7-discovery (parent PR); validation compares this part with its actual stack parent 37c6f593deb0. The stack integrates pinned main 413d5f9bb3f7.

Evidence

Changed lines against the parent: production +852 / -304; tests and fixtures +342 / -35.

Focused integrated receipts cover Matrix thread persistence, subagent hooks, startup verification, and encryption: 48 passed, 0 skipped, mapped to 4/4 changed test files. These are recorded integrated file versions, not independent runs of every prefix; per-part counts are not additive. Stack totals are 3,296 passing receipts, 3,295 after removing one known relocation duplicate, and three skipped cases across 177 files; no required focused file remains missing.

Recorded file spans total 14.024s. The relevant repaired integration batch took 496.047s wall time for 22 files; that is not a standalone timing for this part. File spans and invocation wall times are distinct; CI runner seconds were not measured.

Owner-reviewed native SDK digest: ff7b090f43d2d90e4cd883d95840d6b752475a7a1769e295fb4cbb558a6ffb64. Zero released export removals; the digest reconciles to this parent/head through the generated-only baseline change. The canonical SDK diff is empty.

The S7 family audit at c3667d2 resolved 18,862 inputs, 1,766 calls, 521 imports and 78 member references: 153 explicitly classified retained edges, zero unknown edges or async-contract errors. The publisher repair changed five scanned modules containing none of those captured family edges; retained-edge sources stayed unchanged. Final source differs from the passing repair head only by its generated assertion baseline. This preserves the original scan provenance rather than claiming a new full scan.

Core and extension production typechecks passed for all nine source prefixes; the final generated-only assertion-baseline adjustment does not change their code. The selected check-changed commands were executed, with the inherited failures below preserved.

Inherited failures remain explicit: Knip flags .github/actions/setup-release-harness/narrow-lockfile.mjs and src/infra/sqlite-source-fence-admission.ts; the production export scan flags PUBLIC_SESSION_ENTRY_SCRIPT; core lint has 10 unchanged max-lines findings; the environment-name count is 456/455, including unchanged OPENCLAW_PITCH. Relevant source/config blobs equal the pinned base. No blanket check-changed-green claim is made.

Three scoped review rounds completed. Accepted correctness findings were repaired; remaining scoped follow-ups are recorded in the relevant PR descriptions.

Final repair checks passed at 4b7d96b620ea: scoped lint (30.02 s), affected test types (342.12 s), import-cycle guard (23.46 s), and Madge (14.91 s).

Exact-final remote pnpm build passed in 369.642s. The qualified Matrix cold-import snapshot measured 104.992 MiB peak RSS, +58.199 MiB versus the empty baseline, and 383.791ms process CPU. Child/process-group cleanup and temporary-home removal were verified. This is a cold-import snapshot; the dependency closure is not attested. Statement-gate evidence follows separately; the update cell remains pending for the lander.

Statement gate: paired phases, attribution and supplemental samples

The gate uses the prespecified three alternating parent/head pairs on the same host. All phase durations are valid (candidate/base median ratio ≤1.5). Each adjacent edge shares its intermediate-prefix samples with the next edge. The table below reports primary medians; fourth-pair and cumulative results are retained separately for transparency. The fourth sweep was run for part 9's required RAW follow-up, not to replace these primary comparisons.

The first P4 workload completed successfully but its aggregation initially lacked a proof helper. Restoring the existing helper produced the identical summary hash; no workload was repeated. The later controller stopped before P6's fifth workload after P4/P5 had already completed incidental fifth samples. Those incidental samples are not substituted into the primary series.

Phase All-thread SQL MAIN SQL Worker requests Wall seconds
Boot 2315→2316 1929→1929 59→59 9.845→9.905 (1.0061×)
Connect 1201→1212 126→126 57→59 1.235→1.239 (1.0032×)
First turn 2582→2589 94→94 353→355 8.554→8.052 (0.9413×)
Warmed mean/turn 1010.6→1006.8 6.9→6.9 196.2→195.1 20.485→20.541 (1.0027×)
Second session 3871→3880 117→126 658→657 8.14→8.118 (0.9973×)
Control plane 422→421 33→33 73→73 1.132→1.131 (0.9991×)
Cron 1151→1148 30→30 171→171 5.496→5.49 (0.9989×)
Compaction 407→407 25→25 84→84 1.483→1.484 (1.0007×)
Shutdown 195→195 129→129 15→14 0.784→0.766 (0.9770×)
Whole workload 22219→22216 2552→2552 3422→3422 56.93→56.946 (1.0003×)
Series First-turn SQL Warmed SQL/turn Whole SQL Whole requests Whole wall ratio
Primary three pairs 2582→2589 1010.6→1006.8 22219→22216 3422→3422 1.0003×
Cumulative four pairs 2584→2594 1010.45→1007.5 22227→22221 3424→3423 0.9930×

The first-turn increase is +7 SQL (+0.271%), within the ≤0.5% unchanged-owner tolerance. Exact total-median samples are run 2 on each side. MAIN first/warmed counts are unchanged; warmed all-thread SQL decreases. No native SQL or sender stack across the first four paired samples intersects this part's changed files.

Existing owner/operation First-turn SQL delta
Exact-entry participant/schema projection +7
Cron mutation +6
Entry validation +5
Identity load +3
Patch anchors +2
Shared facts +2
Registry/activity reads +2
Domain publication −7
Outbound/row facts −8
Lifecycle −2
Other reads −3
Total +7

Boot +1 is a deferred-migration version read. Connect +11 is +0.916%, within the ≤2% non-turn tolerance: entry listing −24, cron mutation/scheduling +20, media +6, identity/images +6, native busy-timeout reads +2, queue +1. Second session +9 is unchanged publication/auth/recovery/projection work. These allowances are supported by unchanged producer stacks, not merely by the size of the differences.

The published-driver × candidate update cell is pending (lander). No release, package publication or Plugin SDK major bump is included.

Plugin state callbacks can perform SQLite work on the Gateway thread, including APIs that return a Promise.

Plugin authors gain a versioned worker-owned keyed store; existing synchronous and callback APIs keep their completion semantics through the current Plugin SDK major.
Native session bindings still expose host-thread persistence and synchronous preparation through harness adapters.

Native binding preparation and ordinary lifecycle mutations can complete through the worker while released synchronous integrations remain supported.
Conversation presentation and capture read native ownership on the Gateway thread even when their callers can await prepared facts.

Session rows and conversation capture retain their existing meaning while ordinary ownership preparation runs through workers.
Channel account inspection, setup and status can read persisted plugin state synchronously on the Gateway thread.

Channels can prepare saved-account state asynchronously without losing configured-account, saved-login or explicit report-scope behavior.
Command authorization and approval routing can force channel persistence reads onto the Gateway thread.

Command and approval preparation can await persisted channel state while retaining current authorization at dispatch and delivery.
Conversation binding APIs include synchronous writes and reads that prune state, and existing async methods can fall back to synchronous adapters.

Plugin authors gain a V2 binding contract with required async operations and coherent source assertions; released structural adapters remain compatible.
Message-action discovery and Matrix binding lookups can synchronously load persisted state, while queued snapshots can overwrite newer binding changes.

Saved-login Matrix accounts retain their actions and capabilities; binding activity and shutdown persistence remain correct with worker-owned storage.
@steipete

Copy link
Copy Markdown
Contributor Author

Landing under Peter's relaxed landing v4. Final head 3eb5006 merges main, preserves current owners outside this part, and retains the Matrix activity-write/committed-fact semantics. The sole own-scope conflict was documentation; no budget or limit increased.

Exact-head AWS Crabbox run_1ab16cdea45f3eb146358ee629dbdded passed all 22 Matrix thread-binding tests (60.924s command). Prior coordinator build/review proof is reused. The update cell is reused from #168478: published driver 2026.9.9 × candidate, run_3d6590a7c9c48b16a12382d7e111cda1.

Required CI was pending at last observation; no green CI claim. Native worktree allocation remained blocked beyond ten minutes on its managed allocation lease. The review attempt was stopped without submitting a merge request; using the explicitly authorized head-pinned REST squash fallback. Replacement proof capacity required waiting through AWS/Hetzner quota errors and a Testbox acquisition failure before AWS became available again.

@steipete
steipete merged commit 76a282c into main Oct 10, 2026
135 of 160 checks passed
@steipete
steipete deleted the dbasync/sw7b-7 branch October 10, 2026 23:54
steipete added a commit that referenced this pull request Oct 11, 2026
Account exactly for the Discord async session listing from #168483 and
Matrix's two async binding timeout setters from #168485. Both migrations
intentionally retain the synchronous exports. Preserve every runtime
surface classification and exact export-list assertion.

Linux proof: the unchanged guard fails on the new Discord export; the
candidate passes all seven cases. pnpm test
src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts
--maxWorkers=1 took 16.38s. Full plugin contract command: 1,149 tests
across 48 files in 88.20s. SDK surface report: six tests passed, already
repaired by f9940dc and 7562fd2. P2 review is clean.

Changed checks, owning test types, formatting, core and boundary lint
pass. check-changed retains one independently reproduced base failure:
Knip flags GatewayApprovalEventPublisherV2 in untouched Gateway code.
steipete added a commit that referenced this pull request Oct 11, 2026
The Matrix thread binding manager migrated to the worker-owned V2 store
in #168485. Its registry-backed contract fixture still installed only the
legacy store method, so the Matrix case failed before testing bindings.
Use the existing V2 test factory and forward action authority unchanged.
Keep every channel case and binding/cleanup assertion; remove the stale
legacy adapter and an unnecessary fixture cast.

Linux proof: original CI shard fails only the Matrix case; the candidate
passes all five cases. pnpm test
src/channels/plugins/contracts/session-binding.registry-backed.contract.test.ts
--maxWorkers=1 took 33.50s. Full owning channel-session config passes
34 tests across 13 files in 63.93s. Core and extension types, formatting,
core and boundary lint pass. P2 review is clean.

check-changed retains existing Knip findings in untouched session,
Gateway and UI code; the clean base reproduces the same findings.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
* refactor(plugin-sdk): share legacy persistence warning budgets

* feat(plugin-sdk): add worker-owned keyed state

Plugin state callbacks can perform SQLite work on the Gateway thread, including APIs that return a Promise.

Plugin authors gain a versioned worker-owned keyed store; existing synchronous and callback APIs keep their completion semantics through the current Plugin SDK major.

* refactor: move native binding preparation to workers

Native session bindings still expose host-thread persistence and synchronous preparation through harness adapters.

Native binding preparation and ordinary lifecycle mutations can complete through the worker while released synchronous integrations remain supported.

* refactor: prepare conversation ownership off the Gateway thread

Conversation presentation and capture read native ownership on the Gateway thread even when their callers can await prepared facts.

Session rows and conversation capture retain their existing meaning while ordinary ownership preparation runs through workers.

* refactor: resolve persisted channel accounts asynchronously

Channel account inspection, setup and status can read persisted plugin state synchronously on the Gateway thread.

Channels can prepare saved-account state asynchronously without losing configured-account, saved-login or explicit report-scope behavior.

* refactor: prepare command and approval eligibility asynchronously

Command authorization and approval routing can force channel persistence reads onto the Gateway thread.

Command and approval preparation can await persisted channel state while retaining current authorization at dispatch and delivery.

* feat(plugin-sdk): add worker-owned conversation binding APIs

Conversation binding APIs include synchronous writes and reads that prune state, and existing async methods can fall back to synchronous adapters.

Plugin authors gain a V2 binding contract with required async operations and coherent source assertions; released structural adapters remain compatible.

* refactor: move Matrix bindings and action discovery to workers

Message-action discovery and Matrix binding lookups can synchronously load persisted state, while queued snapshots can overwrite newer binding changes.

Saved-login Matrix accounts retain their actions and capabilities; binding activity and shutdown persistence remain correct with worker-owned storage.

* fix(matrix): encode targeted binding activity before worker persistence

* test: bind native lease fixtures to V2 action authority

* test: await channel setup registry fixtures

* test: complete keyed state runtime fixture

* test: align Matrix recovery and channel target fixtures

* test: retain approval replay subscriber across async eligibility

* test: implement async listing in ACP binding fixture

* test: specify manual Matrix binding removal

* refactor(plugin-state): separate offline migration entrypoints

* refactor(codex): share binding helpers and contract fixtures

* refactor: separate session row preparation and publications

* refactor: share channel lifecycle and test helpers

* refactor: colocate approval expiry observation

* refactor(slack): colocate action summary formatting

* test: synchronize approval client startup race

* refactor: prepare message action discovery asynchronously

* refactor(matrix): separate session binding adapter

* test: retain async status discovery arguments

* test(codex): model current conversation inspection boundary

* test(facetime): bind persistence barriers before runtime startup

* fix(slack): resolve bound parent before thread fallback

* docs: explain validated discussion account config

* test: exercise native binding lifecycle through worker settlement

* test: document isolated runtime dependencies

* test: document isolated runtime dependencies

* test: document isolated runtime dependencies

* test: document isolated runtime dependencies

* test: document isolated runtime dependencies

* fix: preserve native binding method receivers

* fix: bind model preparation authority to its reader

* style: resolve approval runtime lint findings

* style: avoid mutating action discovery entries

* style: keep Discord route reassignment local

* fix(matrix): preserve binding reconciliation error cause

* chore: regenerate worker and test guard baselines

* chore: regenerate worker and test guard baselines

* chore: reconcile worker migration baselines

* chore: reconcile async approval SDK baselines

* chore: record versioned binding SDK surface

* chore: prune migrated discovery mocks

* chore: prune migrated Matrix binding mock

* test: run native row ownership with the host broker

* fix: include async approval caller in its migration

* fix(plugin-sdk): preserve synchronous approval publication

Add an awaited publisher companion while preserving numeric synchronous delivery and legacy publisher objects. Refuse async-only eligibility before legacy delivery and keep rejected preparation observed. Bundled approval dispatch selects the new method before publication.

* chore: regenerate approval assertion baseline

* fix(clickclack): fence discussion cleanup and reconciliation

* test(clickclack): avoid shadowing store options
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
Account exactly for the Discord async session listing from openclaw#168483 and
Matrix's two async binding timeout setters from openclaw#168485. Both migrations
intentionally retain the synchronous exports. Preserve every runtime
surface classification and exact export-list assertion.

Linux proof: the unchanged guard fails on the new Discord export; the
candidate passes all seven cases. pnpm test
src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts
--maxWorkers=1 took 16.38s. Full plugin contract command: 1,149 tests
across 48 files in 88.20s. SDK surface report: six tests passed, already
repaired by 69da208 and b999946. P2 review is clean.

Changed checks, owning test types, formatting, core and boundary lint
pass. check-changed retains one independently reproduced base failure:
Knip flags GatewayApprovalEventPublisherV2 in untouched Gateway code.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
The Matrix thread binding manager migrated to the worker-owned V2 store
in openclaw#168485. Its registry-backed contract fixture still installed only the
legacy store method, so the Matrix case failed before testing bindings.
Use the existing V2 test factory and forward action authority unchanged.
Keep every channel case and binding/cleanup assertion; remove the stale
legacy adapter and an unnecessary fixture cast.

Linux proof: original CI shard fails only the Matrix case; the candidate
passes all five cases. pnpm test
src/channels/plugins/contracts/session-binding.registry-backed.contract.test.ts
--maxWorkers=1 took 33.50s. Full owning channel-session config passes
34 tests across 13 files in 63.93s. Core and extension types, formatting,
core and boundary lint pass. P2 review is clean.

check-changed retains existing Knip findings in untouched session,
Gateway and UI code; the clean base reproduces the same findings.
steipete added a commit that referenced this pull request Oct 13, 2026
…#170511)

## What Problem This Solves

Consolidate duplicate extension paths and remove speculative lifecycle defenses in Codex, Memory Core, Microsoft Teams, Matrix, Reef, and Workboard. The candidate removes **522 net production lines** (tests, fixtures, generated files, declaration files, and documentation excluded; both new production modules included). This uses the campaign's honest 500–999-line fallback after the scoped growth/largest-first pass; it does not remove features to reach a quota.

Workboard's four card actions now share one discriminated action component, its draft controls share one renderer, and menu-only pass-through components are gone. Reef's worker and released-host adapters share one pure seven-command trust-transition policy while retaining their own atomic storage boundaries. Teams reuses its Graph/context/setup owners. Memory keeps normal parallel-query and sync-generation retirement draining, expressed with simpler active-completion tracking rather than nested borrower wrappers.

An adjacent Workboard defect is fixed: conditional Solid fragments could run a popover ref before the preceding trigger entered the document, positioning the details menu at the page origin. Listener/anchor setup now runs after the DOM commit. The regression fails against the unchanged implementation and passes with this repair.

No SDK export, config, protocol, dependency, database schema, durability, retention, or permission contract is changed. The protected standalone session-memory backend is untouched. No changelog edit.

User impact: Workboard details menus anchor to their trigger instead of the page origin. Other changes simplify internal implementation, with the best-effort timing and diagnostic compromises below; no migration or operator action is required.

## Best-effort tradeoffs accepted

- Codex diagnostic accessors throwing or mutable transport identities: [#163388](#163388) adds synthetic throwing-accessor coverage, not an actual-use human report. Actual accessors are local reads and registration publishes frozen identities. Accessor programmer errors now surface; the diagnostic sink catch, disclosure allowlist, attempt isolation, and timeout/cleanup behavior remain.
- Offline Codex migration CAS conflicts: [#168479](#168479) introduced retry loops without a human competing-writer report. Gateway ownership excludes live foreign writers. One atomic attempt plus existing persisted-result validation now retains the source sidecar and reports a warning on conflict; a later Doctor run can retry.
- Retired Codex legacy JSON rewritten during migration: [#104504](#104504) added a synthetic locator-rewrite test; human [#104503](#104503) concerns fingerprint overflow, whose fix remains. Legacy indexes are offline inputs, so a second locator/lifecycle read is removed. Initial containment/malformed-owner validation and canonical session ownership checks remain; unsupported concurrent legacy edits are picked up next run.
- Memory manager acquisition repeatedly retrying failed global retirement: [#144252](#144252) has synthetic close failures, no human incident requiring recursive acquisition recovery. Acquisition now awaits the pending close once and reports its error; the retirement owner is retained and explicit close can retry.
- Abandoned, abort-ignoring memory diagnostic probes holding provider retirement indefinitely: [#113471](#113471) and [#166973](#166973) provide synthetic lifecycle proof, not a human abandoned-probe incident. Timed-out read-only diagnostics no longer retain a redundant inner borrower. Ordinary active searches, sync generations, healthy operations, and custom closable-provider draining remain protected.
- Teams simultaneous Gateway writers: [#88411](#88411) introduced the persistence migration/file lock without a human multi-Gateway incident and did not test live tenant traffic. The Gateway is the sole database owner. Removed cross-process stale-lock/backoff machinery; local FIFO remains. Unsupported simultaneous processes may overwrite each other rather than coordinate.
- Workboard stale cache publication and an exact-expiry late join: [#165896](#165896), [#165141](#165141), and [#165698](#165698) use synthetic performance/interleaving controls, not a human incident. One read may return an older projection/fallback; normal revision/age invalidation refreshes it next read. Measured caching, the 64-entry bound, and read authority remain.
- Workboard direct stop/start before asynchronous startup settles: [#146976](#146976) forces unsupported lifecycle ordering in a test. The host service owner already awaits raw startup before stop. Removed plugin-local generation/startup handoff; supported host lifecycle is unchanged, unsupported direct reentry no longer has a second lifecycle owner.
- Reef failed owner-notice dispatch/ack retry timing: [#109160](#109160) pins injected failures and exponential timers, without a human report requiring that second scheduler. Durable pending notices now retry during ordinary successful 30-second reconciliation or restart. A failed acknowledgement may redispatch conservative stop-only guidance; durable resend reservation/cooldown prevents granting a second resend. The per-peer queue also makes the removed in-flight set redundant.
- Reef synchronous intermediate lease theft: [#109380](#109380) and [#168340](#168340) describe synthetic interleavings, not human concurrent-writer incidents. SDK callbacks commit synchronously and there is no await between acquisition and settlement. Unsupported reentrant callbacks/foreign writers are no longer checked at every intermediate step. Initial acquisition, final head-owner check, staged recovery, uncertain-commit witness, rollback, and retention ordering remain.
- Workboard fabricated native event targets and repeated widget predicates: renderer port [#168606](#168606) added boilerplate without a human incident. JSX native bindings already guarantee `currentTarget` types, and the owning menu already excludes widgets. Fabricated direct handler calls may throw; real event dispatch, widget behavior, and untrusted `event.target` checks are unchanged.

## Coverage ledger

Discovery began with scoped three-day growth, then fourteen-day history and largest production owners. Each removed mechanism was checked against its introduction and current callers; no dormant/in-flight foundation was deleted. Exact and normalized duplicate scans informed structural inspection, not automatic rewrites.

| Owner / original location | Decision and evidence |
| --- | --- |
| Codex `app-server/request-diagnostics.ts:28,109,133` | Remove speculative accessor catches/identity copy; keep timeout sink and disclosure boundary (#163388). |
| Codex `command-handler-actions.ts:109` | Share sandbox/execution result assembly; preserve policy selectors, guards, currentness and release. |
| Codex `migration/session-binding-sidecars.ts:460,549,627` | Single CAS attempt and one legacy-input read; preserve sidecar on conflict and canonical effect validation (#168479, #104504). |
| Codex `installed-probe.ts:29`, native session preparation/monitor | KEEP isolated managed storage, credentials, native execution authority and ordinary write settlement. Upstream configuration/storage contract inspected directly. |
| Memory `memory/search-deadline.ts:42` | One rejected cancellation promise replaces sentinel race; preserve cancellation/error identity, abort ordering, wall-clock guard and cleanup (#95757, #147702). |
| Memory `manager-embedding-ops.ts:84`, `manager-registry.ts:264` | Simplify nested borrower bookkeeping and failed-close recovery; preserve outer leases, normal drain and documented retiring-cache fence (#113471, #166973, #144252). An initially broader removal was rejected during review. |
| Memory publication, database context, index generation, transfer and cache owners | KEEP user-data transaction/publication, Forget exclusion, bounded transfers, worker ownership, integrity, performance caches and normal shutdown settlement (#168860, #169164, #169251, #170183, #170302, #170407). |
| Memory paused deadlines, Unicode query, KNN/vector scan, watchers | KEEP human-reported SQLite stalls (#137056), dependency tokenizer behavior, external/native input validation, bounded resources and realistic cancellation. |
| Memory dreaming/REM, migration/repair, backfill and standing intents | KEEP user-facing features, privacy/source validation, persisted rollback and public formats. Phase E untouched. |
| Teams `sqlite-state.ts:27`, `graph.ts:85,177` | Remove redundant foreign-writer lock; one guarded Graph transport retains auth/SSRF, bounded parsing and release (#88411). |
| Teams `setup-surface.ts:102`, `graph-group-management.ts:32,96`, `channel.ts:267` | Consolidate identical saves/context/pending result bookkeeping; preserve provider-specific validation, labels, errors, ordering and direct results (#112811). |
| Matrix `matrix/actions/reactions.ts:135` | Remove duplicate missing-sender/empty-result guards; selector remains ownership boundary, empty list has no redactions. |
| Matrix crypto store, verification, readiness, send FIFO and thread binding owners | KEEP room-key durability, real throwing dependency getters, encryption/send authority, public compatibility and accepted writes (#160707, #70401, #163012, #168485, #169405). |
| Teams pending-upload dual owners | HOLD: persisting currently memory-only reply consent bytes would change privacy/persistence; deleting SQLite loses restart recovery. Needs an explicit policy choice, not a deslop shortcut. |
| Teams streaming, multi-account configuration and exported setup factory | KEEP Stop/partial-delivery/FIFO, credential isolation and published factory signature (#141348, #112811). |
| Reef `trust-state-operation.ts:164`, `trust-store.legacy.ts:115` | Share pure seven-command transitions, retain worker/native atomic adapters, schema checks, trust revisions and authorization (#168340). |
| Reef `owner-notice.ts:32,72,122,253`, `audit-state.legacy.ts:145–255` | Remove duplicate retry scheduler/in-flight set and synchronous intermediate lease checks; preserve durable recovery/security (#109160, #109380). |
| Reef released-host adapter and trust delivery settlement | KEEP declared host compatibility, accepted-write shutdown settlement, peer/key authority and user-data crash recovery. |
| X events/allowlist/verification | KEEP paid-event settlement, bounded polling and credential/access authority. |
| llama.cpp media/provider/install/orphan owners | KEEP confidentiality of local inputs, digest cache integrity and safe process identity before termination (#167902). |
| ClawRouter pool/dashboard | KEEP untrusted network projection, bounded responses and active features; no useful large duplicate justified added abstraction. |
| Workboard `view-card-actions.tsx:215`, `view-card.tsx:102`, `view-draft-choices.tsx:6` | Consolidate actions, menu wrappers and card/bulk draft controls; all callers migrated (#168606). |
| Workboard native handlers and `view-popover.ts:19` | Drop impossible bound-target guards; repair ordinary conditional-fragment anchor timing (#168606). |
| Workboard `sessions-board.ts:149,305`, `change-events.ts:6`, `gateway.ts:211` | Remove duplicate cache/lifecycle fences; share workspace input preparation while retaining workspace/security effect checks. |
| Workboard draft/focus/pending-write/editor, board save and label measurement owners | KEEP real unsaved input, async writes, keyboard focus, live-authority checks and measured layout batching. |

## Evidence

All local build/test/CLI commands use task-owned HOME, OpenClaw state/config and XDG directories. No real Gateway or user state is used. No timeout increases, retries, skips, new suppressions or weakened retained-behavior baselines.

Final proof receipts and exact-head CI attribution are recorded below. Cold compiled-worker preparation dominates several local timings; these are not CI timings or live-provider claims.

| Focused local proof | Result / wall cost |
| --- | --- |
| Codex request diagnostics | 14/14 pass; wrapper445.55s (cold worker/import dominated). |
| Codex commands + Doctor contract | 122/123 pass; wrapper1352.60s. Doctor contract passes. The one method-list assertion (`commands.test.ts:951`) also observes background monitor `thread/read` calls. It **reproduces with explicit clean-base source loaded from `56715acf0e5943edecd34fa6f451532cfa9d5f35`**: extra reads followed by the expected `thread/resume`, selected-case8.411s/Vitest403.28s. The affected test/support/actions/bindings/monitor files are byte-unchanged between that base and pinned main. No test skips or timing changes were added;99 unrelated cases were unselected for attribution. |
| Workboard backend (sessions-board, Gateway, change-events, registration lifecycle) | 48/48 pass, four files; wrapper587.54s, Vitest545.18s. |
| Workboard entire browser scope before final followups; final affected browser suites | 237/237 across29 files in59.03s; final103/103 across6 files in31.95s. New popover regression1/1 in9.34s; unchanged source fails intended geometry assertion in14.57s. |
| Workboard actual compiled WebKit consumer | Pass: anchored menu, filter keyboard dismissal, nested Escape preserving dialog, focus return, zero page errors. |
| Reef trust/friends/audit/receipt/outbound/notifier | 119/119 across6 files; wrapper927.25s, including cold worker compilation. Earlier unchanged channel proof25/25 pass. |
| Teams sqlite/Graph/read authority/setup | 72/72 across5 files; wrapper385.62s. |
| Teams Graph contexts/actions | 73/73 across3 files; wrapper327.91s. |
| Teams mutation callers/setup policy | 42/42 across5 files; wrapper776.30s. |
| Teams resolver + existing channel tests | Resolver4/4 pass; existing channel44 pass/2 fail, wrapper550.01s. **Both failures reproduce on full pinned main `3c63da22f046b15db9d56cf35769f20b398b8c9b`**,44 pass/2 fail, wrapper464.42s: approval-monitor startup timeout120000ms (`channel.test.ts:313`) and subsequent `MSTeams runtime not initialized` (`runtime-store.ts:85` → `monitor.ts:81` → `channel.test.ts:970`). No budgets changed; the second appears cascading, not separately diagnosed. |
| Matrix reaction ownership | 11/11 pass; wrapper339.25s. |
| Lint suppression contracts | 3/3 pass on frozen candidate; wrapper48.94s. No new suppressions. |
| Architecture | Zero runtime value cycles; zero static/Madge components. |

Memory owner/sibling proof: 108/109 pass across nine files, wrapper939.49s. The only failure was this patch's newly authored assertion expecting the provider's raw close error instead of the owner's existing normalized diagnostic. After correcting that assertion without a production change, its exact case passed (4.389s execution, Vitest350.74s, wrapper373.90s, dominated by transforms). The other twelve registry cases were unselected in that focused invocation, not skipped in source. Together the runs prove all109 selected contracts, including actual-query retirement, shutdown drain, fallback/reload, healthy probe, transport and deadline behavior.

Local tooling notes: the first changed-file run required removing one now-unused assertion-safety allowance. The corrected run passed conflict markers (27.14s), line-cap (4.43s), max-lines (69.87s), and assertion-safety (183.85s), then was intentionally stopped after the full-source SQLite worker inventory produced no result for 681.03s. This was incomplete local proof, not a passing inventory or an inherited source failure. Native production and test extension typegraphs both pass. Scoped lint could not begin analysis because SDK declaration preparation hit its unchanged 300000ms budget, both in the earlier Reef attempt and the final scoped attempt; neither produced a lint diagnostic. Final exact-head hosted CI below closes both gaps, with inventories running on the PR's frozen merge tree. Two custom-config attribution attempts were abandoned for harness setup failures; they are not behavior proof. Teams attribution above uses a normal full-main export and normal harness. No remote lease, live Teams tenant or live provider proof is claimed.

Final formatting: all changed source/test/doc files pass. Plugin boundary report passes (zero eligible compatibility removals); UI localization verification passes. No public SDK files/exports or package manifests changed, so an SDK API-surface diff is not applicable.

Independent review reported one P2 about an older Workboard read replacing newer `lastKnown` fallback facts before a subsequent backend outage. Declined as the explicitly accepted cache tradeoff, not silently ignored: fallback is presentation-only, availability remains visible, the next successful read repairs it, and `move` independently rereads authoritative facts/scope before its guarded write. The introducing controls are synthetic (#165896/#165141); no user-data, authorization, or persisted-write invariant is relaxed.

First hosted CI run `38334064250` on `dabbd9208a20068c24e6901b41a13415c04ac856` completed with two owned lint failures: `check-lint-extensions-2` (explicit boolean and exhaustive return in Reef) and `check-lint-extensions-3` (default generic argument/Promise iterable in Memory, exhaustive return/shadowed local in Workboard). Its `openclaw/ci-gate` failure aggregates those two jobs. All other planned jobs passed, including SQLite inventories, source contracts, types, extension tests, and QA smoke. The focused correction adds five production lines. The first PR-evidence run also failed because this body's headings did not match the required template; corrected headings passed in run `38334357043`. Metadata auto-response cancellations and the superseded evidence run contain no product test suite. No inherited-failure exception is being claimed for these owned failures.

**Final exact-head CI passes:** [run 38335564816](https://github.com/openclaw/openclaw/actions/runs/38335564816) on `b86c1ba06fa325f178007ba736c294cdd67a566d`, including `openclaw/ci-gate`, both extension-lint stripes, full inventories/ratchets, source contracts, typegraphs, selected extension bundles, security, and all QA smoke profiles. This closes the local inventory/lint tooling gaps described above. All exact-head check runs were enumerated; no failed, cancelled, timed-out, or pending check remains. No admin exception, manual rerun, dispatch, or rebase was used. CI job wall seconds: extension bundles 1/2/3/4-1/4-2/5 = 210/160/183/247/137/229; extension lint stripes 2/3 = 145/91; baseline ratchets = 271. These are parallel job wall times including setup, not added test execution time.

The lint-only correction also passes native production types, formatting, suppression contracts (3/3; 65.59s wrapper), runtime cycles (0), static/Madge cycles (0), Workboard actions (32/32; 17.93s) and popover (1/1; 16.16s), plus Reef trust/Memory provider lifecycle (51/51; 401.38s Vitest, 445.49s wrapper). Independent review of that delta is scoped-clean at P0–P2; the original explicitly declined display-cache tradeoff remains documented above.

## Visual proof

Before/after attachments show the actual built Workboard plugin against synthetic fixture data. Before: details menu at the page origin. After: anchored to its trigger. No pixel-identical claim across fixture timestamps.

![Before: synthetic Workboard details menu at the page origin](https://github.com/user-attachments/assets/4051b726-6af0-45fe-a0b6-e896b1c33a40)

![After: synthetic Workboard details menu anchored to its trigger](https://github.com/user-attachments/assets/26de3267-537f-46ef-b477-1adb5b0de290)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…openclaw#170511)

## What Problem This Solves

Consolidate duplicate extension paths and remove speculative lifecycle defenses in Codex, Memory Core, Microsoft Teams, Matrix, Reef, and Workboard. The candidate removes **522 net production lines** (tests, fixtures, generated files, declaration files, and documentation excluded; both new production modules included). This uses the campaign's honest 500–999-line fallback after the scoped growth/largest-first pass; it does not remove features to reach a quota.

Workboard's four card actions now share one discriminated action component, its draft controls share one renderer, and menu-only pass-through components are gone. Reef's worker and released-host adapters share one pure seven-command trust-transition policy while retaining their own atomic storage boundaries. Teams reuses its Graph/context/setup owners. Memory keeps normal parallel-query and sync-generation retirement draining, expressed with simpler active-completion tracking rather than nested borrower wrappers.

An adjacent Workboard defect is fixed: conditional Solid fragments could run a popover ref before the preceding trigger entered the document, positioning the details menu at the page origin. Listener/anchor setup now runs after the DOM commit. The regression fails against the unchanged implementation and passes with this repair.

No SDK export, config, protocol, dependency, database schema, durability, retention, or permission contract is changed. The protected standalone session-memory backend is untouched. No changelog edit.

User impact: Workboard details menus anchor to their trigger instead of the page origin. Other changes simplify internal implementation, with the best-effort timing and diagnostic compromises below; no migration or operator action is required.

## Best-effort tradeoffs accepted

- Codex diagnostic accessors throwing or mutable transport identities: [openclaw#163388](openclaw#163388) adds synthetic throwing-accessor coverage, not an actual-use human report. Actual accessors are local reads and registration publishes frozen identities. Accessor programmer errors now surface; the diagnostic sink catch, disclosure allowlist, attempt isolation, and timeout/cleanup behavior remain.
- Offline Codex migration CAS conflicts: [openclaw#168479](openclaw#168479) introduced retry loops without a human competing-writer report. Gateway ownership excludes live foreign writers. One atomic attempt plus existing persisted-result validation now retains the source sidecar and reports a warning on conflict; a later Doctor run can retry.
- Retired Codex legacy JSON rewritten during migration: [openclaw#104504](openclaw#104504) added a synthetic locator-rewrite test; human [openclaw#104503](openclaw#104503) concerns fingerprint overflow, whose fix remains. Legacy indexes are offline inputs, so a second locator/lifecycle read is removed. Initial containment/malformed-owner validation and canonical session ownership checks remain; unsupported concurrent legacy edits are picked up next run.
- Memory manager acquisition repeatedly retrying failed global retirement: [openclaw#144252](openclaw#144252) has synthetic close failures, no human incident requiring recursive acquisition recovery. Acquisition now awaits the pending close once and reports its error; the retirement owner is retained and explicit close can retry.
- Abandoned, abort-ignoring memory diagnostic probes holding provider retirement indefinitely: [openclaw#113471](openclaw#113471) and [openclaw#166973](openclaw#166973) provide synthetic lifecycle proof, not a human abandoned-probe incident. Timed-out read-only diagnostics no longer retain a redundant inner borrower. Ordinary active searches, sync generations, healthy operations, and custom closable-provider draining remain protected.
- Teams simultaneous Gateway writers: [openclaw#88411](openclaw#88411) introduced the persistence migration/file lock without a human multi-Gateway incident and did not test live tenant traffic. The Gateway is the sole database owner. Removed cross-process stale-lock/backoff machinery; local FIFO remains. Unsupported simultaneous processes may overwrite each other rather than coordinate.
- Workboard stale cache publication and an exact-expiry late join: [openclaw#165896](openclaw#165896), [openclaw#165141](openclaw#165141), and [openclaw#165698](openclaw#165698) use synthetic performance/interleaving controls, not a human incident. One read may return an older projection/fallback; normal revision/age invalidation refreshes it next read. Measured caching, the 64-entry bound, and read authority remain.
- Workboard direct stop/start before asynchronous startup settles: [openclaw#146976](openclaw#146976) forces unsupported lifecycle ordering in a test. The host service owner already awaits raw startup before stop. Removed plugin-local generation/startup handoff; supported host lifecycle is unchanged, unsupported direct reentry no longer has a second lifecycle owner.
- Reef failed owner-notice dispatch/ack retry timing: [openclaw#109160](openclaw#109160) pins injected failures and exponential timers, without a human report requiring that second scheduler. Durable pending notices now retry during ordinary successful 30-second reconciliation or restart. A failed acknowledgement may redispatch conservative stop-only guidance; durable resend reservation/cooldown prevents granting a second resend. The per-peer queue also makes the removed in-flight set redundant.
- Reef synchronous intermediate lease theft: [openclaw#109380](openclaw#109380) and [openclaw#168340](openclaw#168340) describe synthetic interleavings, not human concurrent-writer incidents. SDK callbacks commit synchronously and there is no await between acquisition and settlement. Unsupported reentrant callbacks/foreign writers are no longer checked at every intermediate step. Initial acquisition, final head-owner check, staged recovery, uncertain-commit witness, rollback, and retention ordering remain.
- Workboard fabricated native event targets and repeated widget predicates: renderer port [openclaw#168606](openclaw#168606) added boilerplate without a human incident. JSX native bindings already guarantee `currentTarget` types, and the owning menu already excludes widgets. Fabricated direct handler calls may throw; real event dispatch, widget behavior, and untrusted `event.target` checks are unchanged.

## Coverage ledger

Discovery began with scoped three-day growth, then fourteen-day history and largest production owners. Each removed mechanism was checked against its introduction and current callers; no dormant/in-flight foundation was deleted. Exact and normalized duplicate scans informed structural inspection, not automatic rewrites.

| Owner / original location | Decision and evidence |
| --- | --- |
| Codex `app-server/request-diagnostics.ts:28,109,133` | Remove speculative accessor catches/identity copy; keep timeout sink and disclosure boundary (openclaw#163388). |
| Codex `command-handler-actions.ts:109` | Share sandbox/execution result assembly; preserve policy selectors, guards, currentness and release. |
| Codex `migration/session-binding-sidecars.ts:460,549,627` | Single CAS attempt and one legacy-input read; preserve sidecar on conflict and canonical effect validation (openclaw#168479, openclaw#104504). |
| Codex `installed-probe.ts:29`, native session preparation/monitor | KEEP isolated managed storage, credentials, native execution authority and ordinary write settlement. Upstream configuration/storage contract inspected directly. |
| Memory `memory/search-deadline.ts:42` | One rejected cancellation promise replaces sentinel race; preserve cancellation/error identity, abort ordering, wall-clock guard and cleanup (openclaw#95757, openclaw#147702). |
| Memory `manager-embedding-ops.ts:84`, `manager-registry.ts:264` | Simplify nested borrower bookkeeping and failed-close recovery; preserve outer leases, normal drain and documented retiring-cache fence (openclaw#113471, openclaw#166973, openclaw#144252). An initially broader removal was rejected during review. |
| Memory publication, database context, index generation, transfer and cache owners | KEEP user-data transaction/publication, Forget exclusion, bounded transfers, worker ownership, integrity, performance caches and normal shutdown settlement (openclaw#168860, openclaw#169164, openclaw#169251, openclaw#170183, openclaw#170302, openclaw#170407). |
| Memory paused deadlines, Unicode query, KNN/vector scan, watchers | KEEP human-reported SQLite stalls (openclaw#137056), dependency tokenizer behavior, external/native input validation, bounded resources and realistic cancellation. |
| Memory dreaming/REM, migration/repair, backfill and standing intents | KEEP user-facing features, privacy/source validation, persisted rollback and public formats. Phase E untouched. |
| Teams `sqlite-state.ts:27`, `graph.ts:85,177` | Remove redundant foreign-writer lock; one guarded Graph transport retains auth/SSRF, bounded parsing and release (openclaw#88411). |
| Teams `setup-surface.ts:102`, `graph-group-management.ts:32,96`, `channel.ts:267` | Consolidate identical saves/context/pending result bookkeeping; preserve provider-specific validation, labels, errors, ordering and direct results (openclaw#112811). |
| Matrix `matrix/actions/reactions.ts:135` | Remove duplicate missing-sender/empty-result guards; selector remains ownership boundary, empty list has no redactions. |
| Matrix crypto store, verification, readiness, send FIFO and thread binding owners | KEEP room-key durability, real throwing dependency getters, encryption/send authority, public compatibility and accepted writes (openclaw#160707, openclaw#70401, openclaw#163012, openclaw#168485, openclaw#169405). |
| Teams pending-upload dual owners | HOLD: persisting currently memory-only reply consent bytes would change privacy/persistence; deleting SQLite loses restart recovery. Needs an explicit policy choice, not a deslop shortcut. |
| Teams streaming, multi-account configuration and exported setup factory | KEEP Stop/partial-delivery/FIFO, credential isolation and published factory signature (openclaw#141348, openclaw#112811). |
| Reef `trust-state-operation.ts:164`, `trust-store.legacy.ts:115` | Share pure seven-command transitions, retain worker/native atomic adapters, schema checks, trust revisions and authorization (openclaw#168340). |
| Reef `owner-notice.ts:32,72,122,253`, `audit-state.legacy.ts:145–255` | Remove duplicate retry scheduler/in-flight set and synchronous intermediate lease checks; preserve durable recovery/security (openclaw#109160, openclaw#109380). |
| Reef released-host adapter and trust delivery settlement | KEEP declared host compatibility, accepted-write shutdown settlement, peer/key authority and user-data crash recovery. |
| X events/allowlist/verification | KEEP paid-event settlement, bounded polling and credential/access authority. |
| llama.cpp media/provider/install/orphan owners | KEEP confidentiality of local inputs, digest cache integrity and safe process identity before termination (openclaw#167902). |
| ClawRouter pool/dashboard | KEEP untrusted network projection, bounded responses and active features; no useful large duplicate justified added abstraction. |
| Workboard `view-card-actions.tsx:215`, `view-card.tsx:102`, `view-draft-choices.tsx:6` | Consolidate actions, menu wrappers and card/bulk draft controls; all callers migrated (openclaw#168606). |
| Workboard native handlers and `view-popover.ts:19` | Drop impossible bound-target guards; repair ordinary conditional-fragment anchor timing (openclaw#168606). |
| Workboard `sessions-board.ts:149,305`, `change-events.ts:6`, `gateway.ts:211` | Remove duplicate cache/lifecycle fences; share workspace input preparation while retaining workspace/security effect checks. |
| Workboard draft/focus/pending-write/editor, board save and label measurement owners | KEEP real unsaved input, async writes, keyboard focus, live-authority checks and measured layout batching. |

## Evidence

All local build/test/CLI commands use task-owned HOME, OpenClaw state/config and XDG directories. No real Gateway or user state is used. No timeout increases, retries, skips, new suppressions or weakened retained-behavior baselines.

Final proof receipts and exact-head CI attribution are recorded below. Cold compiled-worker preparation dominates several local timings; these are not CI timings or live-provider claims.

| Focused local proof | Result / wall cost |
| --- | --- |
| Codex request diagnostics | 14/14 pass; wrapper445.55s (cold worker/import dominated). |
| Codex commands + Doctor contract | 122/123 pass; wrapper1352.60s. Doctor contract passes. The one method-list assertion (`commands.test.ts:951`) also observes background monitor `thread/read` calls. It **reproduces with explicit clean-base source loaded from `9b5bac5de29fac5a2df162265bbf01b6fb82e6ed`**: extra reads followed by the expected `thread/resume`, selected-case8.411s/Vitest403.28s. The affected test/support/actions/bindings/monitor files are byte-unchanged between that base and pinned main. No test skips or timing changes were added;99 unrelated cases were unselected for attribution. |
| Workboard backend (sessions-board, Gateway, change-events, registration lifecycle) | 48/48 pass, four files; wrapper587.54s, Vitest545.18s. |
| Workboard entire browser scope before final followups; final affected browser suites | 237/237 across29 files in59.03s; final103/103 across6 files in31.95s. New popover regression1/1 in9.34s; unchanged source fails intended geometry assertion in14.57s. |
| Workboard actual compiled WebKit consumer | Pass: anchored menu, filter keyboard dismissal, nested Escape preserving dialog, focus return, zero page errors. |
| Reef trust/friends/audit/receipt/outbound/notifier | 119/119 across6 files; wrapper927.25s, including cold worker compilation. Earlier unchanged channel proof25/25 pass. |
| Teams sqlite/Graph/read authority/setup | 72/72 across5 files; wrapper385.62s. |
| Teams Graph contexts/actions | 73/73 across3 files; wrapper327.91s. |
| Teams mutation callers/setup policy | 42/42 across5 files; wrapper776.30s. |
| Teams resolver + existing channel tests | Resolver4/4 pass; existing channel44 pass/2 fail, wrapper550.01s. **Both failures reproduce on full pinned main `4915e46c89b223ae4cdcdefe46fabc948b9bf7fa`**,44 pass/2 fail, wrapper464.42s: approval-monitor startup timeout120000ms (`channel.test.ts:313`) and subsequent `MSTeams runtime not initialized` (`runtime-store.ts:85` → `monitor.ts:81` → `channel.test.ts:970`). No budgets changed; the second appears cascading, not separately diagnosed. |
| Matrix reaction ownership | 11/11 pass; wrapper339.25s. |
| Lint suppression contracts | 3/3 pass on frozen candidate; wrapper48.94s. No new suppressions. |
| Architecture | Zero runtime value cycles; zero static/Madge components. |

Memory owner/sibling proof: 108/109 pass across nine files, wrapper939.49s. The only failure was this patch's newly authored assertion expecting the provider's raw close error instead of the owner's existing normalized diagnostic. After correcting that assertion without a production change, its exact case passed (4.389s execution, Vitest350.74s, wrapper373.90s, dominated by transforms). The other twelve registry cases were unselected in that focused invocation, not skipped in source. Together the runs prove all109 selected contracts, including actual-query retirement, shutdown drain, fallback/reload, healthy probe, transport and deadline behavior.

Local tooling notes: the first changed-file run required removing one now-unused assertion-safety allowance. The corrected run passed conflict markers (27.14s), line-cap (4.43s), max-lines (69.87s), and assertion-safety (183.85s), then was intentionally stopped after the full-source SQLite worker inventory produced no result for 681.03s. This was incomplete local proof, not a passing inventory or an inherited source failure. Native production and test extension typegraphs both pass. Scoped lint could not begin analysis because SDK declaration preparation hit its unchanged 300000ms budget, both in the earlier Reef attempt and the final scoped attempt; neither produced a lint diagnostic. Final exact-head hosted CI below closes both gaps, with inventories running on the PR's frozen merge tree. Two custom-config attribution attempts were abandoned for harness setup failures; they are not behavior proof. Teams attribution above uses a normal full-main export and normal harness. No remote lease, live Teams tenant or live provider proof is claimed.

Final formatting: all changed source/test/doc files pass. Plugin boundary report passes (zero eligible compatibility removals); UI localization verification passes. No public SDK files/exports or package manifests changed, so an SDK API-surface diff is not applicable.

Independent review reported one P2 about an older Workboard read replacing newer `lastKnown` fallback facts before a subsequent backend outage. Declined as the explicitly accepted cache tradeoff, not silently ignored: fallback is presentation-only, availability remains visible, the next successful read repairs it, and `move` independently rereads authoritative facts/scope before its guarded write. The introducing controls are synthetic (openclaw#165896/openclaw#165141); no user-data, authorization, or persisted-write invariant is relaxed.

First hosted CI run `38334064250` on `dabbd9208a20068c24e6901b41a13415c04ac856` completed with two owned lint failures: `check-lint-extensions-2` (explicit boolean and exhaustive return in Reef) and `check-lint-extensions-3` (default generic argument/Promise iterable in Memory, exhaustive return/shadowed local in Workboard). Its `openclaw/ci-gate` failure aggregates those two jobs. All other planned jobs passed, including SQLite inventories, source contracts, types, extension tests, and QA smoke. The focused correction adds five production lines. The first PR-evidence run also failed because this body's headings did not match the required template; corrected headings passed in run `38334357043`. Metadata auto-response cancellations and the superseded evidence run contain no product test suite. No inherited-failure exception is being claimed for these owned failures.

**Final exact-head CI passes:** [run 38335564816](https://github.com/openclaw/openclaw/actions/runs/38335564816) on `b86c1ba06fa325f178007ba736c294cdd67a566d`, including `openclaw/ci-gate`, both extension-lint stripes, full inventories/ratchets, source contracts, typegraphs, selected extension bundles, security, and all QA smoke profiles. This closes the local inventory/lint tooling gaps described above. All exact-head check runs were enumerated; no failed, cancelled, timed-out, or pending check remains. No admin exception, manual rerun, dispatch, or rebase was used. CI job wall seconds: extension bundles 1/2/3/4-1/4-2/5 = 210/160/183/247/137/229; extension lint stripes 2/3 = 145/91; baseline ratchets = 271. These are parallel job wall times including setup, not added test execution time.

The lint-only correction also passes native production types, formatting, suppression contracts (3/3; 65.59s wrapper), runtime cycles (0), static/Madge cycles (0), Workboard actions (32/32; 17.93s) and popover (1/1; 16.16s), plus Reef trust/Memory provider lifecycle (51/51; 401.38s Vitest, 445.49s wrapper). Independent review of that delta is scoped-clean at P0–P2; the original explicitly declined display-cache tradeoff remains documented above.

## Visual proof

Before/after attachments show the actual built Workboard plugin against synthetic fixture data. Before: details menu at the page origin. After: anchored to its trigger. No pixel-identical claim across fixture timestamps.

![Before: synthetic Workboard details menu at the page origin](https://github.com/user-attachments/assets/4051b726-6af0-45fe-a0b6-e896b1c33a40)

![After: synthetic Workboard details menu anchored to its trigger](https://github.com/user-attachments/assets/26de3267-537f-46ef-b477-1adb5b0de290)
steipete added a commit that referenced this pull request Oct 15, 2026
…3343)

## What Problem This Solves

Channel hot paths repeatedly reconstruct or validate facts their internal owner has already prepared. Several adapters also maintain parallel bookkeeping for the same delivery, preference, or pending-message state.

## User Impact

No intended user-visible feature or configuration change. Channel adapters consume prepared internal facts once; security checks, accepted delivery and ordinary restart behavior remain owned by their existing boundary. No operator action is required.

## Why This Change Was Made

- Discord uses its existing target resolver directly, carries one prepared channel/role projection, and trusts native Message and schema-validated configuration facts. Voice retains session-instance identity rather than a duplicate realtime counter; receive frames no longer get copied again after MessagePort cloning.
- Slack verifies its renderer's existing HMAC before consuming the signed typed plan, rather than rebuilding that plan. Send options and compiled message facts come from their existing owner instead of mirrored declarations and forwarding blocks.
- Matrix consumes SDK-hydrated events once, serializes owned delivery/sync facts without preliminary deep copies, and trusts binding snapshots captured inside its serialized persistence queue.
- iMessage shares accepted-send bookkeeping and content echo-cache entries. Signal tracks pending inbound entries in one map and consumes validated configuration facts. WhatsApp consumes its mandatory typed admission fact; redundant send-error log/rethrow wrappers are gone.

Authorization/effect checks, external-input parsing, FIFO, common restart durability, accepted-work settlement, cache bounds, public schemas/config keys/SDK exports and protocol shapes remain. Telegram is excluded and parked separately pending the required Test Server proof. The standalone Phase E memory backend is untouched.

## Best-effort tradeoffs accepted

- An internal consumer mutating a handed-off delivery plan, frame, speaker context, presentation array, or error snapshot can affect its other readers; inspected production consumers only read these owner-held values. Immediate serialization still detaches durable bytes, and shared borrowed cache freezes remain.
- A fake native Discord Message with divergent `channelId`, `channel_id`, or raw payload aliases no longer recovers through alternate layouts. The native constructor owns the canonical field; #173128 retired the old transport adapters. External channel payload projection still validates primitive fields.
- A fake gateway missing a required typed voice-cache method now fails instead of silently returning no roster. The native gateway contract supplies the method; absence of the gateway itself is still supported.
- Duplicate voice states supplied outside GatewayVoiceStateCache's one-state-per-user contract are not deduplicated by a second roster reconstruction. Normal roster ordering and both resource caps remain; the removed second pass came from #166974, not a cited human incident.
- A caller passing invalid numeric/config enum types directly into internal typed send/config helpers may fail rather than use a fallback. User config remains schema-validated once; numeric limits, defaults and all valid configuration choices are unchanged.
- A process clock rollback/restart can temporarily rank a future-dated model preference ahead of a new choice. Preference ordering is best effort; persisted input validation remains. #169405 and the inspected refactor history do not identify a human incident requiring the removed process-clock defenses.
- A JavaScript process at the Date representability limit no longer disables an internal short pairing cache. The existing 30-second TTL and cooldown remain; contemporary clocks behave identically.
- An unsupported foreign writer updating Matrix binding storage concurrently is not merged into an already-serialized owner's snapshot. #168485 describes an implementation hazard, not a linked human report; current snapshots are captured after earlier queued touches settle, and that ordering proof remains.
- A metadata class with inherited `toJSON` receives normal JSON serialization semantics instead of first being spread into a plain object. The metadata boundary still JSON-normalizes, detaches and strips undefined values; plain record behavior is unchanged.
- Discord request and WhatsApp send failures propagate their original error instead of an extra logging/rewrapping layer. No retry, approval, or accepted-receipt behavior is removed.

## Size

**519 net production lines removed** (638 added / 1,157 deleted), excluding tests, fixtures, support, generated files, declarations and nonproduction ratchet metadata. Signed repair head: 7abd83c.

## Evidence

- Completed initial Discord selection: 9 files, 161 tests passed.
- Completed iMessage echo-cache contracts: 1 file, 38 tests passed.
- Final focused lint-suppression contracts: 1 file, 3 tests passed.
- Matrix focused proof: 3 files, 44 tests passed. Initial Slack proof: 98 passed and one stale internal forwarding assertion failed; the assertion now checks forwarded config, while the existing real downloader contract verifies actual credential use. Corrected Slack replay: 2 files, 50 tests passed, plus lint-suppression contracts passed again (1 file, 3 tests).
- Production extension typecheck passed after correcting the Matrix caller's readonly annotation and retaining null-to-undefined conversion at Discord's raw snapshot boundary.
- Runtime import cycles: 0. Full Madge import cycles: 0. Formatting and diff whitespace passed. Only shrink-only assertion/max-lines baseline updates are included.
- Independent P2 review completed. Two findings proposed restoring shape checks in Slack's typed portable builders; both were declined after tracing raw presentation parsing in normalizeMessagePresentation/normalizeTableBlock/normalizeChartBlock and all production callers. Raw Block Kit parsing and platform semantic limits remain unchanged.
- The lint wrapper timed out during SDK boundary declaration preparation at its existing 300-second limit, before producing lint diagnostics. No timeout was raised. The older broad local focused attempts were stopped to release the checkout for corrections; unfinished shards are not reported as passes. Exact-head PR CI remains the broad proof.
- The required check-changed invocation initially found stale shrink-only baselines; those entries were pruned. Its later SQLite worker scan made no progress for over 50 minutes and was stopped; targeted types and cycle checks above finished. The committed SDK API comparison was stopped without a verdict after roughly an hour under severe host load; its helper worktrees were cleaned up. No SDK source, entrypoint metadata or dependency surface is changed. This is a local API-check gap, not a passing result.

### CI repair attribution

The original exact-head run38780915649 on b2dbcaf exposed owned fixture/options failures, not inherited main failures. The repair preserves every behavior assertion: the shared fake Discord client now supplies the required native Gateway roster contract through the real voice-state cache, including null for an unknown roster, and Slack no longer forwards positional text or an absent media-roots key as send options. Fresh independent P2 review of this two-file repair was scoped-clean; formatting and whitespace passed. Slack reply replay:29 tests passed, plus three suppression contracts. The redundant local voice build was stopped during prerequisite preparation after the current-head hosted voice/transcript jobs passed; local exit2 is not a passing replay. Current-head jobs116608971711,116608971178,116608970950,116608970910 and116608970865 passed, including the repaired native fixture and Slack reply families. Exact-head required CI gate passed in run38788900607/job116613171952 and the aggregate status passed in run38790431500. No old CI jobs were rerun and no timeout was changed.

| Exact-head failed job | Attribution / repair |
| --- | --- |
|116581625877 checks-node-compact-small-2-2|Owned shared Gateway fixture; transcript audio family.|
|116581625782 checks-node-changed-compact-large-21|Owned shared Gateway fixture; transcript lifecycle family.|
|116581625694 checks-node-changed-extensions-bundle-1-4|Owned shared Gateway fixture; voice receive/session/recording families.|
|116581625172 checks-node-changed-extensions-bundle-1-3|Owned shared Gateway fixture; realtime/consult/transcript families.|
|116581625548 checks-node-changed|Owned shared Gateway fixture; targeted voice-runtime E2E.|
|116581625674 checks-node-changed-extensions-bundle-2-1|Owned Slack send-options projection; existing strict assertion retained.|
|116599822613 openclaw/ci-gate|Aggregate rejection for the six owned suite failures above; no inherited-only exception claimed.|

An earlier PR-context failure116574789633 was repaired by the authored problem/evidence headings; its subsequent context run passed. Superseded auto-response/context cancellations are advisory, not missing suite proof. The repair head has its own completed hosted CI; prior-head green jobs are not represented as current-head evidence.
- A proposed Telegram storage-sanitizer deletion exposed undefined-field encoding failures and was fully reverted before parking. It is not part of this PR.

Local proof is isolated from operator state. Hosted CI on the exact submitted head is the broad gate. No live channel or platform claim is made.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…nclaw#173343)

## What Problem This Solves

Channel hot paths repeatedly reconstruct or validate facts their internal owner has already prepared. Several adapters also maintain parallel bookkeeping for the same delivery, preference, or pending-message state.

## User Impact

No intended user-visible feature or configuration change. Channel adapters consume prepared internal facts once; security checks, accepted delivery and ordinary restart behavior remain owned by their existing boundary. No operator action is required.

## Why This Change Was Made

- Discord uses its existing target resolver directly, carries one prepared channel/role projection, and trusts native Message and schema-validated configuration facts. Voice retains session-instance identity rather than a duplicate realtime counter; receive frames no longer get copied again after MessagePort cloning.
- Slack verifies its renderer's existing HMAC before consuming the signed typed plan, rather than rebuilding that plan. Send options and compiled message facts come from their existing owner instead of mirrored declarations and forwarding blocks.
- Matrix consumes SDK-hydrated events once, serializes owned delivery/sync facts without preliminary deep copies, and trusts binding snapshots captured inside its serialized persistence queue.
- iMessage shares accepted-send bookkeeping and content echo-cache entries. Signal tracks pending inbound entries in one map and consumes validated configuration facts. WhatsApp consumes its mandatory typed admission fact; redundant send-error log/rethrow wrappers are gone.

Authorization/effect checks, external-input parsing, FIFO, common restart durability, accepted-work settlement, cache bounds, public schemas/config keys/SDK exports and protocol shapes remain. Telegram is excluded and parked separately pending the required Test Server proof. The standalone Phase E memory backend is untouched.

## Best-effort tradeoffs accepted

- An internal consumer mutating a handed-off delivery plan, frame, speaker context, presentation array, or error snapshot can affect its other readers; inspected production consumers only read these owner-held values. Immediate serialization still detaches durable bytes, and shared borrowed cache freezes remain.
- A fake native Discord Message with divergent `channelId`, `channel_id`, or raw payload aliases no longer recovers through alternate layouts. The native constructor owns the canonical field; openclaw#173128 retired the old transport adapters. External channel payload projection still validates primitive fields.
- A fake gateway missing a required typed voice-cache method now fails instead of silently returning no roster. The native gateway contract supplies the method; absence of the gateway itself is still supported.
- Duplicate voice states supplied outside GatewayVoiceStateCache's one-state-per-user contract are not deduplicated by a second roster reconstruction. Normal roster ordering and both resource caps remain; the removed second pass came from openclaw#166974, not a cited human incident.
- A caller passing invalid numeric/config enum types directly into internal typed send/config helpers may fail rather than use a fallback. User config remains schema-validated once; numeric limits, defaults and all valid configuration choices are unchanged.
- A process clock rollback/restart can temporarily rank a future-dated model preference ahead of a new choice. Preference ordering is best effort; persisted input validation remains. openclaw#169405 and the inspected refactor history do not identify a human incident requiring the removed process-clock defenses.
- A JavaScript process at the Date representability limit no longer disables an internal short pairing cache. The existing 30-second TTL and cooldown remain; contemporary clocks behave identically.
- An unsupported foreign writer updating Matrix binding storage concurrently is not merged into an already-serialized owner's snapshot. openclaw#168485 describes an implementation hazard, not a linked human report; current snapshots are captured after earlier queued touches settle, and that ordering proof remains.
- A metadata class with inherited `toJSON` receives normal JSON serialization semantics instead of first being spread into a plain object. The metadata boundary still JSON-normalizes, detaches and strips undefined values; plain record behavior is unchanged.
- Discord request and WhatsApp send failures propagate their original error instead of an extra logging/rewrapping layer. No retry, approval, or accepted-receipt behavior is removed.

## Size

**519 net production lines removed** (638 added / 1,157 deleted), excluding tests, fixtures, support, generated files, declarations and nonproduction ratchet metadata. Signed repair head: 7abd83c.

## Evidence

- Completed initial Discord selection: 9 files, 161 tests passed.
- Completed iMessage echo-cache contracts: 1 file, 38 tests passed.
- Final focused lint-suppression contracts: 1 file, 3 tests passed.
- Matrix focused proof: 3 files, 44 tests passed. Initial Slack proof: 98 passed and one stale internal forwarding assertion failed; the assertion now checks forwarded config, while the existing real downloader contract verifies actual credential use. Corrected Slack replay: 2 files, 50 tests passed, plus lint-suppression contracts passed again (1 file, 3 tests).
- Production extension typecheck passed after correcting the Matrix caller's readonly annotation and retaining null-to-undefined conversion at Discord's raw snapshot boundary.
- Runtime import cycles: 0. Full Madge import cycles: 0. Formatting and diff whitespace passed. Only shrink-only assertion/max-lines baseline updates are included.
- Independent P2 review completed. Two findings proposed restoring shape checks in Slack's typed portable builders; both were declined after tracing raw presentation parsing in normalizeMessagePresentation/normalizeTableBlock/normalizeChartBlock and all production callers. Raw Block Kit parsing and platform semantic limits remain unchanged.
- The lint wrapper timed out during SDK boundary declaration preparation at its existing 300-second limit, before producing lint diagnostics. No timeout was raised. The older broad local focused attempts were stopped to release the checkout for corrections; unfinished shards are not reported as passes. Exact-head PR CI remains the broad proof.
- The required check-changed invocation initially found stale shrink-only baselines; those entries were pruned. Its later SQLite worker scan made no progress for over 50 minutes and was stopped; targeted types and cycle checks above finished. The committed SDK API comparison was stopped without a verdict after roughly an hour under severe host load; its helper worktrees were cleaned up. No SDK source, entrypoint metadata or dependency surface is changed. This is a local API-check gap, not a passing result.

### CI repair attribution

The original exact-head run38780915649 on b2dbcaf exposed owned fixture/options failures, not inherited main failures. The repair preserves every behavior assertion: the shared fake Discord client now supplies the required native Gateway roster contract through the real voice-state cache, including null for an unknown roster, and Slack no longer forwards positional text or an absent media-roots key as send options. Fresh independent P2 review of this two-file repair was scoped-clean; formatting and whitespace passed. Slack reply replay:29 tests passed, plus three suppression contracts. The redundant local voice build was stopped during prerequisite preparation after the current-head hosted voice/transcript jobs passed; local exit2 is not a passing replay. Current-head jobs116608971711,116608971178,116608970950,116608970910 and116608970865 passed, including the repaired native fixture and Slack reply families. Exact-head required CI gate passed in run38788900607/job116613171952 and the aggregate status passed in run38790431500. No old CI jobs were rerun and no timeout was changed.

| Exact-head failed job | Attribution / repair |
| --- | --- |
|116581625877 checks-node-compact-small-2-2|Owned shared Gateway fixture; transcript audio family.|
|116581625782 checks-node-changed-compact-large-21|Owned shared Gateway fixture; transcript lifecycle family.|
|116581625694 checks-node-changed-extensions-bundle-1-4|Owned shared Gateway fixture; voice receive/session/recording families.|
|116581625172 checks-node-changed-extensions-bundle-1-3|Owned shared Gateway fixture; realtime/consult/transcript families.|
|116581625548 checks-node-changed|Owned shared Gateway fixture; targeted voice-runtime E2E.|
|116581625674 checks-node-changed-extensions-bundle-2-1|Owned Slack send-options projection; existing strict assertion retained.|
|116599822613 openclaw/ci-gate|Aggregate rejection for the six owned suite failures above; no inherited-only exception claimed.|

An earlier PR-context failure116574789633 was repaired by the authored problem/evidence headings; its subsequent context run passed. Superseded auto-response/context cancellations are advisory, not missing suite proof. The repair head has its own completed hosted CI; prior-head green jobs are not represented as current-head evidence.
- A proposed Telegram storage-sanitizer deletion exposed undefined-field encoding failures and was fully reverted before parking. It is not part of this PR.

Local proof is isolated from operator state. Hosted CI on the exact submitted head is the broad gate. No live channel or platform claim is made.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: matrix Channel integration: matrix docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant