Skip to content

refactor(acp): keep ordinary metadata work off the Gateway thread - #159084

Merged
steipete merged 22 commits into
mainfrom
codex/acp-metadata-worker-20260926
Sep 27, 2026
Merged

steipete merged 22 commits into
mainfrom
codex/acp-metadata-worker-20260926

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Related: #158782

What Problem This Solves

Ordinary ACP session metadata reads and writes still perform database work on the Gateway thread. This moves singular session/ACP joins and finite metadata mutations to the existing SQLite workers, and migrates ordinary manager, dispatch, status, close/reset, Gateway and task-cleanup callers. The initiating request retains its canonical source, session identity and live authority across awaited work.

The reader preserves alias precedence, missing/unreadable-store results and thrown source revocation. Writes invoke the host mutation callback once through the existing admission protocol, publish finite entry changes through the canonical replacement owner, then reread provenance. Callers revalidate before backend effects; failed preflight settles only its own task attempt.

A metadata-read failure during manual-spawn task-owner selection now returns the existing UNAVAILABLE response with the original diagnostic. It cannot select another tracking owner and create a second task record. Missing metadata retains its existing fallback; a failed request can retry after storage recovers.

The synchronous JavaScript metadata reader and manager resolver shipped in v2026.9.4 remain deprecated companions. This does not promote the ACP facade into the typed public SDK or change configuration, schemas, retention or permissions.

Scope boundary

Discord and Telegram startup binding cleanup retain their exact pre-existing synchronous metadata-read semantics. Discord's cleanup module matches the integration-main source; Telegram's existing cleanup block is mechanically extracted to keep its owner small. Their original cleanup tests remain. This does not add a synchronous fallback.

Those channel consumers require a subsequent conditional-deletion cut: metadata eligibility must be checked inside the binding mutation transaction, rather than carried as a detached observation across a probe or persistence wait. That separate SDK proposal is not included here. Existing cleanup races remain named unfinished work; this PR does not claim that migration complete. Hard cancellation, resume ownership preflight, Gateway projections, process-held incognito state and host transaction-coordinator SQL also remain separate required cuts.

Evidence

  • Real SQLite and registered manager/task flows cover alias precedence, unreadable stores, foreign row replacement, absence-to-presence races, callback revocation, metadata/provenance rollback, and close/reset with a held backend. A registered RPC regression reproduced image writes after Stop/replacement, then proved zero media/backend/transcript effects after the authority guard. Manual-spawn coverage proves no owner/task effects on read failure and successful same-ID retry.
  • An integrity-verified [email protected] package created a persistent ACP session through its public manager. The candidate read and updated it through workers; a second process reopened it with session ID, lifecycle and unrelated metadata intact. This is stored-data compatibility proof, not an updater-driver run. Published-state proof.
  • The full build, isolated Discord/Telegram cold-import profiles and cleanup verification passed. Applicable coverage includes 166 owner cases, six RPC/Stop cases, 11 worker-mutation cases, 18 legacy migration cases and the 79-case sessions-tool suite. Build/profile proof.
  • Current-main integration passed 34 maintenance/ACP cases, 28 native preparation cases, 360 routing checks, core/task-test types and typed lint. One canonical maintenance preparation closure now serves both the visitor and ACP cleanup. The Gateway resume fixture repair passed all six cases, its test type graph and typed lint. Gateway fixture proof.
  • Final main composition passed all 47 turn-preflight/result, worker-mutation and native-close-recovery cases, 361 routing checks, core plus two relevant test type graphs, and typed lint. The sole merge conflict preserves the awaited preflight and applies main's equivalent actor-check cleanup. Composition proof.
  • The channel-boundary restoration passed source parity checks, fresh scoped review, all 61 affected channel cases, extension production/test type graphs and typed lint. The metadata reader and persistence behavior match the pre-existing channel owners.

The last routing oracle now distinguishes the worker-backed ACP metadata suite from an isolated ACP store suite. All 90 routing cases and typed lint pass; the 361 ownership checks also pass.

CI fixture repairs preserve assertions, timeouts and baselines. Main's canonical pending-preparation grep fix superseded the temporary search shim; the restricted-PATH regression remains. An earlier hosted fixture hit spawn ETXTBSY before 17 cases ran. A same-head retry recovered that coverage, but the executable-contention cause remains unresolved and is not claimed as a flaky-test fix. The unrelated main suppression regression from the Codex observer helper was repaired in #159553 without a new baseline exception.

Exact-head CI 36314955025 passed for e8afea9, including the enforced CI gate. Native maintainer preparation passed; final merge admission remains required. Interrupted runs and failed transfers remain incomplete evidence. Testbox wrapper exits establish the reported proof results; lease Actions runs can show canceled after cleanup. No live channel messages were sent.

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: telegram Channel integration: telegram gateway Gateway runtime commands Command implementations agents Agent runtime and tooling size: XL labels Sep 26, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 27, 2026, 7:25 AM ET / 11:25 UTC (Revision 18).

ClawSweeper review

What this changes

Moves ordinary Agent Client Protocol (ACP) session metadata reads and writes to SQLite workers, updates Gateway and task callers, retains shipped synchronous plugin entry points, and reorganizes channel cleanup coverage.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep open. Current main still uses synchronous single-session ACP metadata access; the merged session-listing change covers a different operation. The branch remains useful, with one test synchronization finding and a separate updater compatibility proof gap.

Priority: P2
Reviewed head: e8afea901f1e12b260abb5be4c825c3eea83f442

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong boundary and existing-state evidence supports a useful patch, while the unchanged polling test and updater handoff gap limit merge readiness.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR reports a real v2026.9.6 package creating a persistent ACP session, candidate worker read and update, and second-process reopen with identity and unrelated metadata intact. Registered Gateway RPC and SQLite task-cleanup harnesses exercise allowed and stale-authority final effects. The linked job's raw logs were unavailable through the reviewer proxy. The existing-state round trip supports data-model compatibility; a published updater-to-candidate handoff remains a separate repository upgrade gate.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR reports a real v2026.9.6 package creating a persistent ACP session, candidate worker read and update, and second-process reopen with identity and unrelated metadata intact. Registered Gateway RPC and SQLite task-cleanup harnesses exercise allowed and stale-authority final effects. The linked job's raw logs were unavailable through the reviewer proxy. The existing-state round trip supports data-model compatibility; a published updater-to-candidate handoff remains a separate repository upgrade gate.
Evidence reviewed 10 items Current main remains synchronous: Current main's ordinary ACP metadata mutation begins with a synchronous session-store read and state write transaction; it has no new worker reader.
Worker-backed reader: The introduced reader joins a session entry and ACP metadata through the read-only worker while retaining the selected source.
Worker-backed mutation: The branch prepares a mutation through worker admission, updates the canonical entry, and commits ACP metadata through the shared-state worker.
Findings 1 actionable finding [P3] Signal probe startup without polling
Security None None.

How this fits together

ACP session control joins stored session entries with runtime metadata. Gateway turns and task cleanup use that result to decide which backend action or reply can proceed.

flowchart LR
A[Gateway turn or task cleanup] --> B[ACP session manager]
B --> C{Session storage}
C -->|File backed| D[SQLite workers]
C -->|Incognito| E[Native in-memory store]
D --> F[Session metadata and identity]
E --> F
F --> G[Backend action or reply]
Loading

Before merge

  • Signal probe startup without polling (P3) - Both new startup concurrency cases poll probeCallCount with vi.waitFor while holding a probe promise. Signal the second and eighth probe starts from their callbacks and await those signals before releasing the held probes; that preserves the concurrency assertions without timer-dependent waits. This finding remains from the prior review.
  • Resolve merge risk (P1) - A published v2026.9.6 updater has not been shown driving this candidate against an existing persistent ACP session. The direct stored-state round trip does not prove that upgrade handoff.
  • Complete next step (P2) - Replace both probe-start polling waits with deferred signals, then provide a published v2026.9.6 updater-to-candidate run on a copied persistent ACP session before merge.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.

Findings

  • [P3] Signal probe startup without polling — extensions/discord/src/monitor/thread-bindings.acp-reconciliation.test.ts:368-370
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Production and test line delta production +2795/-1175; tests +5283/-2901 Production growth implements worker admission and caller cutover; the PR body explains that scope and reports boundary coverage.
Plugin compatibility surface 2 async entry points added; 2 synchronous entry points retained Existing JavaScript plugin consumers retain their shipped calls while ordinary internal consumers move to workers.

Stored data model

Persistent data-model change detected: unknown-truncated-pull-files. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Merge-risk options

Maintainer options:

  1. Verify the published updater handoff (recommended)
    Run the shipped v2026.9.6 updater against a copied persistent ACP session, start the candidate, and show that its identity and metadata remain usable.

Technical review

Best possible solution:

Keep one worker-owned path for ordinary file-backed ACP metadata while preserving the shipped synchronous plugin contract and existing session identity through upgrades.

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

Yes, current-main source shows the ordinary ACP metadata read and mutation path still performs synchronous database work. This read-only review did not run a timing reproduction.

Is this the best way to solve the issue?

Yes, the branch uses existing SQLite workers for file-backed metadata and retains the shipped plugin calls. The updater handoff still needs its required proof.

Full review comments:

  • [P3] Signal probe startup without polling — extensions/discord/src/monitor/thread-bindings.acp-reconciliation.test.ts:368-370
    Both new startup concurrency cases poll probeCallCount with vi.waitFor while holding a probe promise. Signal the second and eighth probe starts from their callbacks and await those signals before releasing the held probes; that preserves the concurrency assertions without timer-dependent waits. This finding remains from the prior review.
    Confidence: 0.96

Overall correctness: patch is correct
Overall confidence: 0.84

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2d65bdd956d9.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded ACP responsiveness and ownership improvement without evidence of an urgent user-facing outage.
  • merge-risk: 🚨 compatibility: The worker cutover changes persisted-session lifecycle handling and plugin access paths, while the published updater handoff remains unproven.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR reports a real v2026.9.6 package creating a persistent ACP session, candidate worker read and update, and second-process reopen with identity and unrelated metadata intact. Registered Gateway RPC and SQLite task-cleanup harnesses exercise allowed and stale-authority final effects. The linked job's raw logs were unavailable through the reviewer proxy. The existing-state round trip supports data-model compatibility; a published updater-to-candidate handoff remains a separate repository upgrade gate.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR reports a real v2026.9.6 package creating a persistent ACP session, candidate worker read and update, and second-process reopen with identity and unrelated metadata intact. Registered Gateway RPC and SQLite task-cleanup harnesses exercise allowed and stale-authority final effects. The linked job's raw logs were unavailable through the reviewer proxy. The existing-state round trip supports data-model compatibility; a published updater-to-candidate handoff remains a separate repository upgrade gate.

Evidence

Acceptance criteria:

  • [P1] pnpm test extensions/discord/src/monitor/thread-bindings.acp-reconciliation.test.ts --maxWorkers=1.
  • [P1] git diff --check.

What I checked:

  • Current main remains synchronous: Current main's ordinary ACP metadata mutation begins with a synchronous session-store read and state write transaction; it has no new worker reader. (src/acp/runtime/session-meta.ts:303, 2d65bdd956d9)
  • Worker-backed reader: The introduced reader joins a session entry and ACP metadata through the read-only worker while retaining the selected source. (src/acp/runtime/session-meta-read.ts:53, e8afea901f1e)
  • Worker-backed mutation: The branch prepares a mutation through worker admission, updates the canonical entry, and commits ACP metadata through the shared-state worker. (src/acp/runtime/session-meta-write.ts:278, e8afea901f1e)
  • Shipped plugin compatibility: The synchronous JavaScript entry point remains exported beside the new asynchronous entry point; the migration guide documents the compatibility window and the unchanged channel startup cleanup. (src/plugin-sdk/acp-runtime.ts:33, e8afea901f1e)
  • Authority boundary coverage: The registered Gateway RPC case checks allowed execution and verifies that Stop or reservation replacement prevents media, transcript, and backend effects; the SQLite task-cleanup cases also exercise task and session-owner changes before final effects. (src/gateway/server.agent-metadata-read-authority.test.ts:125, e8afea901f1e)
  • Reported existing-state proof: The PR body reports that an integrity-verified v2026.9.6 package created a persistent ACP session, the candidate read and updated it, and a second process reopened it with its identity and unrelated metadata intact. Its linked Actions run was canceled after the Testbox wrapper exited; raw job logs were blocked by the review proxy, so that inspection limit is not attributed to the contributor. (e8afea901f1e)

Likely related people:

  • Peter Steinberger: Raw commit 8301f00 adds src/acp/runtime/session-meta-list.ts:43 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8301f006137e; files: src/acp/runtime/session-meta-list.ts)
  • JackS1237: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • kevin2966n: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Replace both Discord probe-start polling waits with deferred completion signals.
  • Show a published v2026.9.6 updater driving the candidate against a copied persistent ACP session.

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.

History

Review history (17 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-26T23:12:26.333Z sha 785cde1 :: blocked before merge. :: [P1] Keep supported older hosts starting with ACP bindings | [P2] Recheck ACP state before removing a Telegram binding
  • reviewed 2026-09-26T23:39:01.571Z sha 2c25d03 :: blocked before merge. :: [P1] Keep supported older hosts starting with ACP bindings | [P2] Recheck ACP state before removing a Telegram binding | [P2] Recheck Discord ACP state before unbinding
  • reviewed 2026-09-27T00:31:24.224Z sha 460ead9 :: blocked before merge. :: [P1] Preserve startup on hosts allowed by the Discord manifest
  • reviewed 2026-09-27T01:41:58.780Z sha 861544e :: needs real behavior proof before merge. :: [P2] Recheck ACP state before deleting a Discord binding | [P2] Keep recovered Telegram bindings through persistence
  • reviewed 2026-09-27T04:17:47.297Z sha 89a06da :: needs real behavior proof before merge. :: [P2] Recheck ACP state before committing Discord unbind | [P2] Recheck ACP state within Telegram binding deletion
  • reviewed 2026-09-27T05:58:54.195Z sha 5be2cce :: needs real behavior proof before merge. :: [P2] Recheck ACP state before committing Discord unbind | [P2] Keep recovered Telegram bindings through deletion | [P3] Wait for probe startup without polling
  • reviewed 2026-09-27T07:40:25.480Z sha 3174acd :: needs real behavior proof before merge. :: [P2] Revalidate ACP state at Discord binding deletion | [P2] Keep recovered Telegram bindings through deletion | [P3] Signal probe startup without polling
  • reviewed 2026-09-27T10:21:44.184Z sha b9bde29 :: blocked before merge. :: [P3] Wait for probe startup with completion signals

@steipete
steipete force-pushed the codex/acp-metadata-worker-20260926 branch from 1640b01 to 65dde73 Compare September 26, 2026 18:55
@steipete
steipete force-pushed the codex/acp-metadata-worker-20260926 branch from 65dde73 to 94c81bb Compare September 26, 2026 19:18
@steipete
steipete marked this pull request as ready for review September 26, 2026 19:19
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 26, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. labels Sep 27, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer review disposition for e8afea9: the two probe-start polling waits are unchanged bodies moved from the existing Discord lifecycle tests. This cut deliberately preserves those cleanup cases and their synchronous cleanup path; there is no observed polling regression to repair here.

This diff changes no updater, Doctor, schema, config default, or plugin-loader contract. The published 2026.9.6 persistent-session round trip proves stored-data compatibility, not an updater-driver handoff; the latter was not run and is not claimed. Shipped synchronous plugin entry points remain available. Conditional channel cleanup is explicitly deferred to its separate owner cut.

Exact-head CI 36314955025 and the enforced CI gate passed. The focused channel restoration, registered Gateway/SQLite authority cases, routing checks, types, build, and independent review evidence are recorded in the PR body. The suggested generic updater/config expansion and inherited P3 synchronization cleanup are not correctness blockers for this scoped migration.

@steipete
steipete merged commit ac4c248 into main Sep 27, 2026
243 of 245 checks passed
@steipete
steipete deleted the codex/acp-metadata-worker-20260926 branch September 27, 2026 12:27
@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 28, 2026
…enclaw#159084)

* refactor(acp): move ordinary session metadata work to workers

* refactor(gateway): keep preparation responses with the dedupe owner

* refactor(acp): keep metadata dispatch with its worker owner

* fix(acp): resolve cutover export and contract checks

* refactor(tasks): remove orphaned active-status predicate

* test(acp): run real metadata consumers with the database broker

* test(acp): align metadata failure and write-boundary fixtures

* fix(acp): preserve older host loading and worker fixture ownership

* test(acp): seed canonical resume fixtures and isolate binding reconciliation

* test(acp): preserve canonical Gateway test ownership

* fix(acp): preserve channel startup on older hosts

* test(pr): provide required command surface in prepare fixtures

* test(gateway): retain configured store in resume fixtures

* refactor(acp): keep channel cleanup with its conditional migration

* test(acp): align routing assertions with worker ownership

* test(acp): retain isolated routing branch coverage
steipete added a commit that referenced this pull request Sep 28, 2026
…line

The first case of bot-message-context.body.test.ts pays cold worker-backed preparation (ACP metadata since #159084, reply admission since #159632) inside grammY's 10 s webhookCallback timer and timed out on loaded Linux CI. Production acknowledges durable ingress and drains through bot.handleUpdate, so feed updates the same way as the dm-session sibling fixture.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
…line

The first case of bot-message-context.body.test.ts pays cold worker-backed preparation (ACP metadata since openclaw#159084, reply admission since openclaw#159632) inside grammY's 10 s webhookCallback timer and timed out on loaded Linux CI. Production acknowledges durable ingress and drains through bot.handleUpdate, so feed updates the same way as the dm-session sibling fixture.
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

agents Agent runtime and tooling channel: discord Channel integration: discord channel: telegram Channel integration: telegram commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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