Skip to content

feat(matrix): intelligent multi-agent communication via fast AI-guided participation control and fresh-message redrafting - #113115

Merged
steipete merged 9 commits into
openclaw:mainfrom
bdjben:codex/matrix-pr73455-port-20260723
Aug 30, 2026
Merged

steipete merged 9 commits into
openclaw:mainfrom
bdjben:codex/matrix-pr73455-port-20260723

Conversation

@bdjben

@bdjben bdjben commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

AI-assisted: yes.

Related: #73455

What Problem This Solves

Matrix rooms containing several OpenClaw agent accounts currently force an awkward choice: require a mechanical mention for every response, or allow every eligible agent to answer the same message. A response can also become stale while it is being generated when a human or another agent adds relevant context before terminal delivery.

This PR adds opt-in, Matrix-scoped intelligent participation and a bounded fresh-message decision immediately before an answer is delivered:

  • one fast utility-model decision classifies participation for the current local room roster;
  • only a strongly-silent decision suppresses an agent before its expensive full run;
  • newer authenticated room activity can cause a completed candidate to be redrafted, discarded, or sent as-is; and
  • the utility model chooses policy only—it never writes or rewrites the selected agent's answer.

A redraft stays on the selected agent's existing provider, model, authentication, persona, session, and runtime. Completed tool results remain in context, while external tools are disabled for the replacement pass so side effects are not replayed. Native CodeMode may retain isolated JavaScript with an empty tool registry; normal lifecycle hooks, including the finalization gate, still run.

Scope and defaults

The user-facing feature is deliberately Matrix-only and off by default.

  • Configuration and room eligibility live under channels.matrix.
  • An eligible room must be unencrypted and contain at least two distinct, live, enabled, locally configured Matrix agent accounts.
  • One-human/one-agent rooms remain unchanged.
  • A room can opt out with groups.<room>.turnTaking: false.
  • Encrypted rooms fail closed for the enhanced protocol and retain ordinary Matrix E2EE behavior.
  • No other channel opts in.
  • No public Plugin SDK callback, public package subpath, or generic cross-channel finalization contract is added.

Shared core and the bundled Codex integration contain narrow private plumbing used by the Matrix implementation. That plumbing does not make this feature available to iMessage, Slack, Signal, Discord, Telegram, or another channel.

Configuration

{
  channels: {
    matrix: {
      turnTaking: {
        enabled: true,
        redraftDepth: 1,
        nextStep: { decider: "ai" },

        // Fixed-policy alternative:
        // nextStep: { decider: "user", action: "redraft" },
        // action: "redraft" | "discard" | "send-as-is"
      },
      groups: {
        "!quiet-room:example.org": { turnTaking: false },
      },
    },
  },
}

turnTaking is one channel-wide Matrix policy and cannot be overridden per account.

Participation

For each eligible native Matrix message, one deterministic local owner makes one bounded, low-reasoning utility-model decision for the current roster:

  • strongly-speak: context strongly indicates that this agent should answer;
  • strongly-silent: context strongly indicates that this agent should not answer; or
  • neutral: neither conclusion is strong, so the agent remains eligible.

Only strongly-silent suppresses a turn. Invalid output, timeout, or classifier failure fails open to neutral. The decision is shared across account monitors, avoiding competing classifier calls for one Matrix event. Commands, including /steer, retain their existing command path.

Explicit turn-taking enablement authorizes authenticated protocol finals from a currently joined configured sibling account to pass the legacy bot/mention gates. It does not bypass room policy, sender allowlists, per-room user restrictions, room enablement, room opt-out, self-message rejection, replay protection, or bot-pair loop protection. Arbitrary bot traffic and unmarked bot messages retain their existing handling.

Fresh-message action

After the selected agent completes a candidate, but before assistant persistence and terminal Matrix delivery, OpenClaw checks bounded newer room activity.

  • {decider:"ai"} lets the utility model choose redraft, discard, or send-as-is.
  • {decider:"user",action:...} fixes one of those actions in configuration.

redraftDepth is exactly 0, 1, or 2:

  • 0: participation only; no pre-send freshness check;
  • 1: one check and at most one replacement; or
  • 2: after an actual replacement, one additional check and at most one final replacement.

There is no unbounded rewrite loop. Utility-model failure or invalid output selects send-as-is.

discard is deterministic host behavior: it abandons the preview, removes the rejected candidate, and completes silently without asking a model to emit NO_REPLY.

redraft is a hidden retry with external tools disabled through the selected agent's normal full runtime. The utility model does not perform the rewrite.

Preview streaming and sibling ingress

Eligible rooms support Matrix partial, quiet, and progress previews. Preview edits remain one correlated response lineage. Block streaming is disabled only for an eligible enhanced turn without rewriting stored configuration; ineligible, opted-out, single-agent, and encrypted rooms preserve ordinary streaming behavior.

Only one authenticated logical answer final is promoted into sibling ingress. Partial previews, ancillary media, tool progress, abandoned previews, malformed protocol frames, and stale terminal events do not launch sibling turns. Media-bearing replacements close the old preview before publishing the replacement final.

Preview awareness is transient and bounded. A later redraft or discard can edit or remove the live preview, but it cannot make text already rendered by a client retroactively invisible.

Supported runtime boundary

Participation-only depth 0 works with every otherwise supported runtime.

Freshness depths 1 and 2 require a runtime that can hand the completed candidate back to OpenClaw before persistence and delivery:

  • the built-in embedded OpenClaw path is supported;
  • the prepared CLI runner is supported; and
  • among plugin harnesses, only the registry-attested bundled Codex harness receives the private finalization capability.

Copilot is intentionally outside the plugin freshness path at depths 1 and 2. An unsupported freshness-enabled harness is rejected before provider/model work with a visible explanation and recovery choices: use a supported embedded/CLI/bundled-Codex path, allow normal fallback to one, or use depth 0 for participation only. OpenClaw does not silently run an unsupported plugin candidate and deliver it without the configured freshness gate.

"Registry-attested bundled Codex" identifies trusted harness registration and provenance. It is not an equality pin to Codex 0.150.1, does not impose a version ceiling, and does not replace OpenClaw's existing minimum-version-and-higher compatibility rule.

The managed Codex source contract is pinned to tag rust-v0.150.1, commit 90854393966b21e9ebfd21b122334eb09a20c93d, and the exact upstream turn loop, hook runtime, Stop event parser, and hook engine. The managed pin protects the source-level Stop contract; user-supplied and ChatGPT-bundled compatible binaries remain governed by the existing external minimum version, with no ceiling.

Private Matrix boundary and source authority

  • Public GetReplyOptions, harness-attempt parameter types, and native-relay handles omit the private Matrix finalization fields; compile-time contract tests preserve those absences.
  • Matrix creates its private request locally in source-finalization-request.ts. It has no JavaScript package export, public Plugin SDK entrypoint, declaration, or generic channel callback.
  • Core redemption in source-finalization-private.ts requires the exact admitted source-context object, an opaque live bundled-Matrix owner capability, matching Matrix facets, and admitted source authority.
  • Structural copies, cross-context replay, ownerless contexts, retired owners, globally installed lookalikes, and non-Matrix contexts fail closed.
  • Ordinary plugin projection strips the private fields. Only the loader-marked, registry-attested bundled Codex harness receives the guarded finalizer through a private call shape.
  • The finalizer and continuation are guarded by the host capability before and after asynchronous work. Retaining either closure after attempt closure fails closed.
  • Exact-source message-tool delivery retains the originating Matrix dispatcher, freshness gate, presentation state, authenticated marker, and source authority. Rich payloads and reply relationships remain intact.
  • Deferred source delivery revalidates retained-source liveness after awaited beforeDeliver work and again at the final provider-I/O boundary. A source retired during the wait cannot deliver through stale retained state.

Maintainer verification

Final candidate: 3231d78ab114769844e96460c426f0167f7129e6. Benjamin Badejo's (@bdjben) original contribution, attribution and historical evidence below remain preserved.

The maintainer repair applies receiving-account access policy at every shared Matrix context read and removes duplicate policy. CLI replacement text stays private until runtime binding and cleanup validate. Real-flow testing also exposed two lifecycle gaps: provisional previews were withheld until completion, and accepted embedded redrafts failed to settle their owned transcript projection before retry. Those repairs belong to the subscriber and existing retry owner; global-hook quarantine, ordinary fail-fast reads and real failure/auth outcomes remain intact. No SQLite schema change was needed. Repairing these owners prevents exposure before delivery; downstream send guards or another retry loop would not preserve that boundary.

Native redrafts previously emptied OpenClaw dynamic tools without denying all native sources. The repair reuses complete native tool denial and MCP attestation while preserving ordinary lifecycle hooks and authoritative Stop; strict isolation modes remain strict. Pinned Codex tool-mode selection and runtime source were inspected directly. Forced CodeModeOnly still advertises isolated exec/wait; the unchanged strict-zero diagnostic remains failed. A separate actual-binary probe verified empty tool/catalog registries, rejected external access attempts, successful computation, and clean final delivery/history. It invoked exec once and did not invoke wait.

V7 real-flow proof ran at 1f60272f3a5b480975e3228b4e2d1eda52875ae5: all four standard embedded/native redraft/discard cases passed. Matrix, Gateway, accounts and Codex 0.150.1 were real; model HTTP was synthetic. The final candidate adds test/lint corrections and only one production refactor: consolidating adjacent planning defaults, net -9 lines. Exact source comparison and 324 serialized configuration comparisons confirm unchanged values, precedence and property order. This equivalence does not relabel the final SHA as live-tested.

Local proof includes the 506-test native owner/sibling suite, 128 projection tests and the final 19-test cleanup/retry rerun; these suites overlap and are not summed. Final configured P0-only review found no actionable defects (confidence 0.99); it is not an all-severity approval. All five final local static checks passed, including sidecar and import cycles. CI: attempt 2 passed at exact 3231d78. Attempt 1 failed only a current-main QA released-port rebind probe (EADDRINUSE); the unchanged failed-jobs rerun passed. Native review, prepare and merge verification completed; landed as 5d7bd83a4af5. The competing port owner was not captured, so the observation race remains a named QA follow-up.

{
  "liveProofHead": "1f60272f3a5b480975e3228b4e2d1eda52875ae5",
  "finalCandidateHead": "3231d78ab114769844e96460c426f0167f7129e6",
  "standard": {
    "passed": 4,
    "failed": 0,
    "redraftReplacementTools": 0,
    "redraftFinalsPerCase": 1,
    "discardFinalsPerCase": 0,
    "staleAcceptedAssistants": 0
  },
  "forcedMetadataStrictZero": {
    "status": "failed",
    "actualTools": ["exec", "wait"],
    "laterHistoryAssertions": "not reached"
  },
  "separateSemanticProbe": {
    "status": "passed",
    "toolNames": [],
    "catalogNames": [],
    "hostGlobalsAbsent": ["fetch", "process", "require", "Deno"],
    "importRejected": true,
    "guessedToolRejected": true,
    "compute": 42,
    "execCalls": 1,
    "waitCalls": 0,
    "externalToolCalls": 0,
    "computeOutputLeaked": false,
    "acceptedNativeMirrors": 1,
    "staleAcceptedAssistants": 0
  },
  "combinedProofExit": 1,
  "configurationEquivalenceCases": 324,
  "ci": { "run": 33283466358, "attempt": 2, "status": "success", "head": "3231d78ab114769844e96460c426f0167f7129e6" }
}

Limits: no original external tool-effect replay, E2EE turn-taking proof or universal sandbox certification is claimed. The strict diagnostic failure is retained separately from semantic proof. Reserved com.openclaw.preview frames remain consumed with a recorded reason; the suggested ordinary-message fallback was explicitly declined to prevent private draft leakage and sibling loops.

Named follow-ups remain: generic registration-owned finalization authority, classifier roster precision for unmarked bot traffic, concurrent test-cache invalidation, current-main QA released-port rebind probing, and supervised restriction-to-normal hosted-search restoration. The MCP restoration fixture does not claim hosted-search restoration. Final classified production delta against pinned main is +9,119/-1,290 (net +7,829), implementing the feature and its owner boundaries; tests are +12,486/-524, with test support, tooling and generated files counted separately.

Contributor evidence (historical)

The following ledger is the contributor’s original evidence for the heads named below; it is not a claim that those runs exercised the current maintainer candidate.

The exact final head was validated by 806 non-overlapping targeted tests, core and extension type checks, assertion-safety and public-SDK boundary checks, a clean full production build, and a real six-account Matrix run correlated across Element, Gateway logs, Matrix response lineages, and per-agent durable state. The precise candidate identity, validation results, exact-head live proof, and the earlier redraft/discard proof follow.

Historical contributor candidate provenance

Identity Exact value
PR head 1ffd5187c115c7bf49cf31e484f2f33c95b5e235
Tree 9723c7a307d8e4b30f5c2023a4c8d59502d6ad82
Frozen main parent 7fc93d88013e7263cf6634c37efc5bf930e21ef7
Commit shape One squashed feature commit on the frozen parent
Installed runtime OpenClaw 2026.8.1 (1ffd518)
Build ID 2026.8.1-1ffd5187c115-2026-08-29T08-48-45.122Z

The final-head update rebases the already-live-tested feature onto the frozen main parent, resolves current-main integration boundaries, repairs assertion-safety sites, and extracts one helper without changing semantics. It does not change the feature's configuration, reserved protocol-marker behavior, room eligibility, participation dispositions, freshness actions, redraft limits, or user-visible delivery policy.

Historical contributor head validation

Completed on exact head 1ffd5187c115c7bf49cf31e484f2f33c95b5e235:

  • 806 non-overlapping targeted tests passed:
    • 278 Matrix tests, including the production-boundary integration path;
    • 188 bundled-Codex/runtime tests; and
    • 340 core, host-capability, message-tool, outbound, and private-finalization tests.
  • A focused 240-test message-tool regression lane was rerun after the helper extraction and passed. Those 240 tests overlap the 806-test total and are not counted a second time.
  • Core TypeScript validation passed with pnpm tsgo:core.
  • Extension TypeScript validation passed with pnpm tsgo:extensions.
  • The assertion-safety ratchet passed against frozen parent 7fc93d88013e7263cf6634c37efc5bf930e21ef7: 4184 files, 12970 grandfathered assertions.
  • The assertion baseline remained byte-identical to the frozen parent.
  • Bundled-channel configuration metadata validation passed.
  • Plugin SDK public-subpath export validation and the no-monolithic-import checks passed.
  • Focused formatting passed across the 21 relevant files.
  • Focused Oxlint passed after the semantics-preserving helper extraction.
  • git diff --check passed.
  • The full production build passed, including 63 external plugins, the CLI bootstrap guard, runtime postbuild, all 147 public Plugin SDK subpaths, the Control UI build/performance checks, and exact dist/build-info.json generation.
  • The working tree remained clean after the build.

Historical contributor exact-head Matrix proof

The final candidate above was installed in the real OpenClaw runtime without changing openclaw.json. The pre- and post-cutover configuration SHA-256 is 4d085fc823309f2a40d2f31360cd3ea8daa485f022487f89d16b9221f5b45028. Gateway RPC reported the exact build ID above; /healthz was live, /readyz was ready with a non-degraded event loop, and all six configured Matrix accounts reported running=true, connected=true, healthState=healthy, and lifecycle=ready, with no account error.

At 2026-08-29 12:03 IDT, the ordinary Element desktop client sent one uniquely tagged user message into a real unencrypted Matrix room with six connected OpenClaw accounts. The source requested exact replies from agent1 and agent6, required agent2 through agent5 to remain silent, and prohibited tool use.

Evidence boundary Exact-head result
Source one user event; room sha256:d8cf3668b00d; event sha256:b807180d9b97; marker SEL-1FFD518-1
Participation logs exactly four turn-taking-strongly-silent skips in the source-admission window
agent1 one source transcript; one source-correlated run (sha256:58e94047de76) in session sha256:0a575b399baf; one model completion; zero tool events; one durable terminal ALLOW-1FFD518-A1
agent6 one source transcript; one source-correlated run (sha256:1fae30db7ed4) in session sha256:bda59f78d82f; one model completion; zero tool events; one durable terminal ALLOW-1FFD518-A2
agent2 through agent5 zero matching source transcripts, zero source-window runtime starts, zero model completions, zero tool events, and zero terminals
Matrix/Element result two distinct response lineages, base events sha256:d6e3db82e1ed and sha256:5b39728261ac; Element rendered exactly ALLOW-1FFD518-A1 and ALLOW-1FFD518-A2; no third or duplicate terminal appeared

This proof correlates the user-visible Element result, Gateway source-admission logs, Matrix response lineages, per-agent durable transcript state, and source-window trajectory events on the exact final head. Private room, user, event, session, run, response, and account identifiers are represented only by pseudonyms or 12-hex SHA-256 prefixes.

Earlier full redraft/discard behavior proof

The deeper real-room scenarios below were captured on 2026-08-28 from the same real, unencrypted six-account Matrix topology. They predate the final rebase and were captured on the prior exact feature head:

Identity Exact value
Live-proof head 9ecb322750a3a2e1f6b1d133d7f5ddf6bed30408
Tree 1fd9f9b93fbf4f000ea80e2c4f54f6adce0f1322
Frozen parent 221c89c1a20a3e3bd605774142725ed2812f97f7
Installed runtime OpenClaw 2026.8.1 (9ecb322)
Build ID 2026.8.1-9ecb322750a3-2026-08-28T17-56-41.458Z

Agents were pseudonymized as agent1 through agent6. Private room, user, event, session, run, response, preview, and account identifiers were replaced by short SHA-256 correlators. Evidence was correlated across Element-rendered behavior, Matrix wire events, OpenClaw per-agent SQLite state, and the underlying bundled-Codex rollout.

Selective participation

One source explicitly selected agent1 and agent6.

  • Each selected account performed exactly one source-correlated full run and emitted exactly one authenticated final.
  • agent2 through agent5 recorded zero matching transcript events, zero trajectory events, zero full runs, and zero terminals.
  • Element showed exactly the two requested replies.
  • Each selected preview lineage finalized once.
  • No late or duplicate final appeared during the observation window.

Fresh-message redraft without tool replay

agent1 completed exactly 12 read-only tool calls and produced provisional terminal KEEP-9ECB322-R1. A newer room message then changed the required terminal to REVIEW-9ECB322-R1.

  • The replacement stayed in the same OpenClaw run.
  • The replacement pass exposed zero tools and repeated zero tool calls or results.
  • All six agents recorded zero independent update-triggered runs.
  • Durable state contained zero KEEP assistant terminals, exactly one REVIEW assistant terminal, and exactly one terminal total.
  • Matrix retained one correlated response lineage and emitted exactly one final.
  • The sole final contained REVIEW; no final contained KEEP.
  • Element displayed only the corrected terminal.

Deterministic discard of a completed Codex candidate

With fixed nextStep={decider:"user",action:"discard"}, agent1 completed exactly 12 tool calls and the private bundled-Codex rollout produced DISCARD-CANDIDATE-9ECB322-D1.

  • The other five agents started no matching source-correlated run.
  • The update started no independent run on any account.
  • OpenClaw persisted zero non-tool assistant terminals and zero run-terminal records.
  • Matrix emitted zero final events.
  • The preview ended in the abandoned state and its base event was redacted.
  • Element rendered Message deleted and showed no terminal response.

This distinguishes an intentional host-side discard from model non-generation: the model-layer candidate existed, but it crossed neither the durable OpenClaw terminal boundary nor the Matrix final boundary.

After the proof run, the temporary discard configuration was restored byte-for-byte. The Gateway remained healthy and all six Matrix accounts returned to running=true, connected=true, healthState=healthy, and lifecycle=ready, with no account errors.

The optional sanitized readable ledger and machine-readable JSON contains the pseudonymized correlators underlying these earlier scenarios; the behavioral proof above does not depend on the reviewer being able to access that artifact.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: matrix Channel integration: matrix size: XL labels Jul 23, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 31, 2026
@clawsweeper

clawsweeper Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 28, 2026, 2:31 PM ET / 18:31 UTC.

ClawSweeper review

What this changes

This PR adds an opt-in Matrix policy that selects participating local agents and can redraft or discard a reply when newer room activity arrives.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 6 items remain

Keep open: the branch introduces a P2 Matrix message-suppression defect, while the broader opt-in configuration and Codex finalization boundary need maintainer direction and independent contract verification.

Priority: P2
Reviewed head: 9ecb322750a3a2e1f6b1d133d7f5ddf6bed30408
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The branch has substantial focused coverage and a detailed claimed live ledger, but one concrete message-loss defect and unverified external contract remain.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The PR body provides detailed exact-head Matrix, Element, wire, and SQLite claims and links a redacted ledger, but GitHub DNS prevented inspecting that artifact; this is a reviewer-environment limitation, not a request for the contributor to add proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The PR body provides detailed exact-head Matrix, Element, wire, and SQLite claims and links a redacted ledger, but GitHub DNS prevented inspecting that artifact; this is a reviewer-environment limitation, not a request for the contributor to add proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Introduced suppression path: The preflight file is new relative to the pinned PR base. Its marker-presence branch returns consume before normal ingress whenever turn-taking is inactive, so a message with the custom field is silently dropped.
Marker is not authentication: The marker helper tests only whether com.openclaw.preview exists in arbitrary Matrix event content; parsing and sender validation occur later.
Regression is encoded by a new test: The new test asserts that a valid-looking reserved frame is always consumed while the feature is disabled, rather than proving ordinary ingress remains available for arbitrary user content.
Findings 1 actionable finding [P2] Do not consume arbitrary marker-bearing messages while disabled
Security Needs attention Verify the native Stop-hook contract against upstream: The branch pins Codex Stop behavior but the local test calls OpenClaw's relay directly, so it cannot establish that the real Codex hook parser and turn loop honor the required control output.

How this fits together

Matrix room events enter the Matrix monitor, which decides whether local agents should respond and whether a completed answer is still current. The resulting reply passes through the agent runtime and delivery pipeline before it is sent back to the room.

flowchart LR
  A[Matrix room event] --> B[Matrix monitor]
  B --> C[Turn-taking eligibility]
  C --> D[Agent response]
  D --> E[Freshness decision]
  E --> F[Reply delivery]
  F --> G[Matrix room]
Loading

Decision needed

Question Recommendation
Should OpenClaw adopt this Matrix-only multi-agent policy, its new turnTaking configuration, and its bundled-Codex-only freshness scope as a supported product direction? Sponsor the constrained Matrix design: Fix the marker-suppression defect, verify the upstream Stop contract and real Matrix evidence, then continue with Matrix-only opt-in scope.

Why: This is a large new user-facing capability with a new configuration contract and cross-runtime delivery boundary; no maintainer sponsorship is visible in the reviewed context.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The PR body provides detailed exact-head Matrix, Element, wire, and SQLite claims and links a redacted ledger, but GitHub DNS prevented inspecting that artifact; this is a reviewer-environment limitation, not a request for the contributor to add proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Do not consume arbitrary marker-bearing messages while disabled (P2) - This new preflight consumes any Matrix event that merely has com.openclaw.preview before parsing or sender validation when turn-taking is disabled. Matrix event content permits arbitrary custom fields, so an ordinary human message carrying that field is silently dropped despite the feature being off. Only consume frames after a trusted, eligible preview has been recognized; add disabled and untrusted-sender fallback coverage.
  • Resolve security concern: Verify the native Stop-hook contract against upstream - The branch pins Codex Stop behavior but the local test calls OpenClaw's relay directly, so it cannot establish that the real Codex hook parser and turn loop honor the required control output.
  • Resolve merge risk (P1) - The new Matrix configuration is a public behavior and delivery-policy contract; maintainer sponsorship is needed before adopting its permanent scope.
  • Resolve merge risk (P1) - The bundled Codex finalization path relies on a pinned upstream Stop contract that could not be independently inspected in this environment.

Findings

  • [P2] Do not consume arbitrary marker-bearing messages while disabled — extensions/matrix/src/matrix/monitor/handler-turn-taking-preflight.ts:143-148
  • [medium] Verify the native Stop-hook contract against upstream — extensions/codex/src/app-server/run-attempt.turn-local-finalization.test.ts:92
Agent review details

Security

Needs attention: The new cross-runtime finalization boundary needs upstream Codex Stop-contract verification before its security properties can be cleared.

Review metrics

Metric Value Why it matters
Configuration surface 1 policy root, 3 nested controls, 1 room opt-out The documented Matrix configuration changes response-selection and final-delivery behavior, so its permanent product scope matters before merge.
Production vs test LOC Unavailable from trustworthy introduction data The local PR head is parentless and the supplied PR file patches are truncated, so a classified introduced LOC delta cannot be computed without misattributing base drift.

Stored data model

Persistent data-model change detected: unknown-data-model-change: extensions/matrix/src/config-schema.ts, unknown-data-model-change: src/config/bundled-channel-config-metadata.generated.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: canonical
Canonical: #113115
Summary: This PR is the active rewrite of the same Matrix participation/freshness proposal previously attempted in a closed unmerged PR.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Repair ingress and re-verify boundaries (recommended)
    Let the focused fix preserve ordinary marker-bearing messages, then re-review the exact head with upstream Codex and real-Matrix evidence available.
  2. Pause for product scope
    Hold the PR if maintainers do not want to support this new Matrix configuration and bundled-runtime delivery contract.

Technical review

Best possible solution:

Preserve ordinary Matrix ingress unless a parsed, authenticated local preview is eligible for interception; then obtain maintainer approval for the Matrix-only policy and independently verify the pinned Codex Stop contract before merge.

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

Yes, from source: send a normal Matrix room message containing com.openclaw.preview while turnTaking is absent or disabled; the introduced preflight returns consume before normal ingress. A focused handler regression should assert that the ordinary inbound run still occurs.

Is this the best way to solve the issue?

No: reserving a custom field must not silently hide arbitrary Matrix messages when the feature is off or the frame is not an authenticated eligible preview. Interception should follow parsing and eligibility/trust validation.

Full review comments:

  • [P2] Do not consume arbitrary marker-bearing messages while disabled — extensions/matrix/src/matrix/monitor/handler-turn-taking-preflight.ts:143-148
    This new preflight consumes any Matrix event that merely has com.openclaw.preview before parsing or sender validation when turn-taking is disabled. Matrix event content permits arbitrary custom fields, so an ordinary human message carrying that field is silently dropped despite the feature being off. Only consume frames after a trusted, eligible preview has been recognized; add disabled and untrusted-sender fallback coverage.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: A new Matrix preflight path can silently consume otherwise ordinary room messages carrying a custom field.
  • merge-risk: 🚨 compatibility: The PR adds a documented Matrix configuration contract that changes opt-in reply behavior.
  • merge-risk: 🚨 message-delivery: The introduced preflight can suppress a user message before normal Matrix ingress.
  • merge-risk: 🚨 security-boundary: The feature adds a cross-account finalization and delivery authority path whose upstream Stop contract is not independently verified here.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: needs maintainer proof decision: A ClawSweeper-authored PR needs a maintainer proof capture or override decision. Needs stronger real behavior proof before merge: The PR body provides detailed exact-head Matrix, Element, wire, and SQLite claims and links a redacted ledger, but GitHub DNS prevented inspecting that artifact; this is a reviewer-environment limitation, not a request for the contributor to add proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Verify the native Stop-hook contract against upstream — extensions/codex/src/app-server/run-attempt.turn-local-finalization.test.ts:92
    The branch pins Codex Stop behavior but the local test calls OpenClaw's relay directly, so it cannot establish that the real Codex hook parser and turn loop honor the required control output.
    Confidence: 0.88

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs extensions/matrix/src/matrix/monitor/handler.test.ts.
  • [P1] node scripts/run-vitest.mjs extensions/matrix/src/matrix/monitor/production-boundary.integration.test.ts.
  • [P1] git diff --check.

What I checked:

Likely related people:

  • steipete: Recent history includes the Matrix monitor pipeline split and a subsequent Matrix reply-formatting repair. (role: recent Matrix and channel-runtime contributor; confidence: high; commits: 21f0cef5d5ae, 45de8e7a9e59; files: extensions/matrix/src/matrix/monitor/handler.ts)
  • joshavant: Recent history covers admitted channel-participant identity and Matrix preview lifecycle repairs that overlap this feature's authority boundary. (role: admission-identity and preview-lifecycle contributor; confidence: medium; commits: 97a53a9b35a8, 93cf912695e0; files: src/channels/message-access/admission-evidence.ts, extensions/matrix/src/matrix/monitor/handler.ts)

Rank-up moves

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

  • Preserve normal ingress for marker-bearing messages unless a trusted eligible preview is validated.
  • Have a maintainer inspect the three pinned Codex source blobs and the linked redacted Matrix ledger against the exact head.

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 (32 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-27T02:52:18.566Z sha 7421de676bdd48ad0a3470d908155321ac4906c7 :: needs real behavior proof before merge. :: [P1] Bind the private finalization bridge to the bundled Matrix owner | [P1] Revalidate source liveness before each Matrix cleanup egress
  • reviewed 2026-08-28T02:19:40.202Z sha 44eb40595a6c16bc5719123cb5928a5923eff265 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-28T02:40:58.663Z sha 5ff97f000740ad8e9174bdd935c225771fdbdbd8 :: needs real behavior proof before merge. :: [P2] Align the Stop-contract test with the managed Codex version
  • reviewed 2026-08-28T03:34:54.007Z sha f594ea96a1bfcc58fdc67d1f91d2ed96cab74464 :: needs real behavior proof before merge. :: [P1] Preserve Matrix replies for non-Codex harnesses
  • reviewed 2026-08-28T04:05:41.492Z sha e0409037018282d79952c1b6b87de5827513217c :: needs real behavior proof before merge. :: [P1] Replace the bundled-only Matrix finalization backdoor
  • reviewed 2026-08-28T04:43:28.109Z sha eb904e12404decb670a23187ceb67d8b023d9285 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-28T04:58:25.514Z sha eb904e12404decb670a23187ceb67d8b023d9285 :: needs real behavior proof before merge. :: [P1] Honor finalization for every eligible agent runtime | [P1] Revalidate the source immediately before sending
  • reviewed 2026-08-28T17:34:59.334Z sha 30558571336699fdcbd1c7db31eeebf32b87174c :: needs real behavior proof before merge. :: [P2] Remove the Matrix-specific finalization ABI from core

@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. and removed merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 31, 2026
@bdjben bdjben changed the title feat(matrix): add opt-in participation and draft freshness controls feat(matrix): intelligent multi-agent communication (AI-guided participation control and fresh-message redrafting) Aug 24, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 25, 2026
@bdjben
bdjben force-pushed the codex/matrix-pr73455-port-20260723 branch from cfc21e7 to a3e8cda Compare August 25, 2026 03:30
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling labels Aug 25, 2026
@bdjben bdjben changed the title feat(matrix): intelligent multi-agent communication (AI-guided participation control and fresh-message redrafting) feat(matrix): intelligent multi-agent communication via fast AI-guided participation control and fresh-message redrafting Aug 25, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 25, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Aug 25, 2026
@bdjben
bdjben force-pushed the codex/matrix-pr73455-port-20260723 branch from 4a16a8f to 05174d2 Compare August 25, 2026 08:41
@bdjben

bdjben commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@bdjben
bdjben marked this pull request as ready for review August 25, 2026 09:02
@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@bdjben

bdjben commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@bdjben

bdjben commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@bdjben

bdjben commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Upstream Codex Stop-hook contract verification

The prior ClawSweeper review recorded an environment limitation: its review runtime did not have the sibling Codex checkout, and GitHub DNS was unavailable, so it could not inspect the pinned upstream sources. I independently inspected the official openai/codex source at commit 90854393966b21e9ebfd21b122334eb09a20c93d, corresponding to the managed rust-v0.150.1 contract recorded in this PR. The source-level behavior is:

  • The Codex turn loop passes the completed assistant text to run_turn_stop_hooks before it accepts turn completion.
  • The hook runtime places that text in StopRequest.last_assistant_message and synchronously runs the configured Stop hooks.
  • The hook engine permits control effects only for synchronous handlers, and the Stop parser converts authorized {"continue":false} output into should_stop=true.
  • The upstream regression test continue_false_overrides_block_decision proves that continue:false takes precedence over a simultaneous block/continuation request.

That is the contract used by the bundled-Codex finalization bridge: OpenClaw receives the candidate through the Stop relay before persistence/delivery and can either accept completion or synchronously stop that completion so the selected agent performs the bounded, tool-disabled replacement pass.

The 0.150.1 value is the managed source-provenance pin, not a user-binary equality constraint or version ceiling. The external app-server compatibility check remains an inclusive minimum of 0.149.0 and accepts newer compatible Codex versions through the existing semver floor check.

@bdjben

bdjben commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Reserved com.openclaw.preview protocol marker

The com.openclaw.preview field is a reserved OpenClaw Matrix protocol discriminant, not an authentication claim. This PR intentionally keeps fail-closed collision behavior: a Matrix event carrying that reserved field is treated as protocol traffic and is consumed when turn-taking is inactive, opted out, unsupported, malformed, or not accepted as an authenticated sibling final. It is not reinterpreted as ordinary user prose merely because the frame fails protocol admission.

The boundary is layered:

  • preview-protocol.ts defines and strictly parses the reserved marker shape.
  • The preflight boundary consumes reserved frames when the enhanced protocol is unavailable for the room.
  • Enabled-room ingress separately requires the sender to be a currently eligible, configured sibling account before accepting the frame; untrusted or malformed frames are consumed by the preview-ingress admission check.

Ordinary Element/Element X messages do not emit this OpenClaw-specific content key. A sender controls only its own event, and merely supplying the key does not grant sibling authority or cause a full agent run. Changing this to collision-tolerant fallback would be a separate protocol-policy decision with different loop and replay consequences; it is deliberately not part of this PR or the final-head assertion-safety update.

@bdjben

bdjben commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor

Maintainer review is in progress. I reproduced two gaps on 1ffd5187c115c7bf49cf31e484f2f33c95b5e235 and am repairing them in this PR:

  • Shared Matrix freshness context must honor each receiving account's own access/context policy. Both preview and final-message regressions reproduced cross-account context visibility; the initial repair now passes both cases and is receiving sibling/lifecycle coverage.
  • CLI final-candidate acceptance must revalidate its selected runtime after awaited finalization and cleanup. Rejected replacement output previously escaped the validation catch; intentional discard also lacked the terminal marker needed to avoid an empty-reply error. The repaired path passes all 11 focused cases, including prepared-resource cleanup.

The initial exact-head baseline passed 254 focused tests on sanitized direct AWS. I also checked the exact Codex Stop implementation and schema at upstream 90854393966b21e9ebfd21b122334eb09a20c93d. A clean-machine full build passed; the new real Gateway/Matrix proof overlay needs its static QA module registration before that scenario can execute. That is being corrected, and no live feature proof is claimed yet.

I will retain the reserved preview-marker behavior, preserve contributor credit, resolve the current mainline conflicts, and update this PR with final proof before landing. No action needed from the author while these repairs are underway.

steipete and others added 2 commits August 29, 2026 06:42
Resolve Matrix context visibility through each live receiver and intersect classifier context without duplicating the transport journal. Invalidate monitor-bound decisions, preserve native thread correlation, and bound the complete classifier request.

Keep CLI runtime-binding failures terminal, publish validated replacements atomically, clean failed preparations, and preserve intentional discard semantics. Add regressions for policy isolation, lifecycle changes, input bounds, and runtime drift.

Co-authored-by: Benjamin Badejo <[email protected]>
Preserve mainline failure classification and auth bookkeeping while discarding rejected terminal text and pending client actions. Keep rewound transcript snapshots alongside nested-tool activity, and retain both private reply capabilities.

Add a failed-attempt plus accepted-discard regression, correct the production-boundary fixture to use real receiver handlers and a closed classifier roster, and remove an unused receiver-access type export.

Co-authored-by: Benjamin Badejo <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

Maintainer repair update at 5e45009: receiver-specific Matrix context authorization, monitor lifecycle invalidation, native source-thread correlation, bounded classifier input, and CLI finalization ownership are repaired with failing-before/passing-after regressions. Main conflicts are resolved without losing failure metadata when a discarded attempt also fails. Thanks @bdjben; contributor credit and PR ancestry are preserved.

Validation so far: 380 focused repair tests, then 265 integrated tests (including the Matrix production owner/delivery boundary); core and plugin production types; local build; and four final-branch independent review passes at the configured P0 threshold. A stale integration fixture now creates both actual receiver handlers and returns the classifier's closed roster; its unchanged 30-second test passes in 2.15 seconds. The initial concurrent test/check run collided in Vitest's shared transform cache; the affected tests were rerun sequentially with unchanged assertions.

ClawSweeper rank-up disposition: I personally inspected the pinned upstream Codex turn loop, hook runtime, synchronous Stop parser/control, and output schema at 90854393966b21e9ebfd21b122334eb09a20c93d, and inspected the linked contributor ledger. Native Stop prevents acceptance but does not delete native candidate history; OpenClaw's mirror and Matrix delivery remain separate boundaries. The reserved com.openclaw.preview discriminant intentionally remains fail-closed when disabled, opted out, malformed, or untrusted, with a recorded consume reason: turning an unvalidated control frame into ordinary conversation could expose drafts and trigger loops. This is an explicit skip of the proposed ordinary-ingress fallback, not an overlooked finding. The requested maintainer landing sponsors the existing constrained Matrix-only opt-in scope; no further config, public SDK, or database surface was added by these repairs.

Final changed gates, new-head CI, and corrected real Tuwunel + Gateway redraft/discard proof are still running. That proof uses deterministic model HTTP responses and does not claim live native-Codex execution or prior tool-effect replay coverage. I will add the final results before landing.

Named follow-ups: express the narrow Matrix finalization permission through an explicit private owner-registration contract without broadening other channels' authority; refine unmarked allowBots: "mentions" classifier roster precision (the existing content gate already prevents unauthorized drafts).

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

steipete and others added 3 commits August 29, 2026 14:48
Extract receiver access preparation into its existing owner and preserve source-finalization assertions in a focused suite. Update stale nested activity fixtures and normalize concurrent gate results.

Co-authored-by: Benjamin Badejo <[email protected]>
Preserve source delivery authority alongside post-compaction failure rendering. Keep Codex steering and finalization coverage, remove a duplicate shard entry, and use a neutral runtime-model test fixture.

Co-authored-by: Benjamin Badejo <[email protected]>
Keep source-owned preview callbacks live during generation while committed
assistant events and block replies remain behind terminal acceptance.
Preserve global finalization hook buffering and avoid replaying previews
when deferred events drain.

Cover the real preparation/subscription boundary for local continue,
redraft and discard plus global-hook quarantine. Repair the Matrix access
type declaration and rebalance complete CLI test families under the
existing type-shard limit.

Co-authored-by: Benjamin Badejo <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

Maintainer update for 9d7b12df2a39ec8498c2cabbf60110bfcaec8433:

Fresh proof with a real disposable Matrix server, Gateway, and two Matrix accounts reproduced a preview timing defect on 3bf824d: the embedded runtime held partial previews until after freshness review, so an update sent after observing the preview arrived too late and the stale answer was finalized. Both redraft and discard scenarios failed; those runs are not being counted as successful proof.

The repair keeps source-owned provisional preview callbacks live during generation while committed assistant events and block replies remain gated. Global finalization hooks retain their existing buffering behavior, including when a source-local finalizer is also installed. Deferred terminal delivery cannot replay an already streamed preview. The documentation now names that global-hook exception.

The regression failed in all three source-local cases before the repair; both global-hook cases already passed. The repaired owner and sibling suites passed 52 tests across six files. The final, fully typed five-case fixture was rerun successfully; it overlaps those 52 tests. Core production and affected test types pass, and the final independent Codex review reported no actionable findings at its configured P0 threshold. The same commit also fixes the erased Matrix type import and rebalances complete CLI test families under the unchanged type-shard limit.

Fresh four-scenario remote validation is running for embedded and native Codex redraft/discard. It uses real transport/runtime boundaries with deterministic model HTTP; it does not claim previous tool-side-effect replay or encrypted-room turn-taking proof. CI for the exact head is also running. No landing or live success is claimed yet.

Rank-up disposition remains explicit: reserved com.openclaw.preview frames are intentionally consumed with recorded reasons rather than entering ordinary ingress when malformed, disabled, or untrusted; this prevents draft leakage and sibling loops. Unmarked messages keep ordinary ingress. The pinned Codex source and contributor ledger were inspected, retaining the ledger's historical-head limits. In upstream 90854393966b21e9ebfd21b122334eb09a20c93d, codex-rs/core/src/session/turn.rs:502-565 and codex-rs/hooks/src/events/stop.rs:250-322,401-447,535-557 distinguish native Stop acceptance from deletion of native history; OpenClaw mirror filtering owns the accepted visible history.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

steipete and others added 2 commits August 29, 2026 16:07
Reuse the existing owned-retry projection barrier after rejecting a final candidate. Cover both global and source-local finalization alongside compaction, and clarify Matrix preview behavior with global finalization hooks.

Co-authored-by: Benjamin Badejo <[email protected]>
Apply the existing native tool policy and MCP attestation to ordinary
tools-disabled retries while preserving their lifecycle and Stop hooks.
Keep strong policy modes isolated and reuse the prepared restriction in
start/resume verification. Cover inherited MCP, managed requirements,
transient bindings, restored tools, and authoritative finalization.

Clarify external-tool isolation versus native compute in Matrix docs and
keep the projection retry fixture aligned with the literal revision type.

Co-authored-by: Benjamin Badejo <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

The maintainer repair is pushed at 1f60272. Thanks @bdjben; contributor credit is retained.

The preceding real Matrix run on f06bd5d passed embedded redraft, embedded discard, and native Codex discard. Native redraft reached a fresh final but failed its replacement-tool assertion: the actual Codex 0.150.1 process still exposed request_user_input, skills list/read, and tool_search. The new repair applies the existing complete native restriction policy to ordinary tools-disabled retries, including inherited MCP verification on start/resume, while preserving their lifecycle and authoritative Stop hooks. It removes duplicate verification predicates; this repair is production +26/-25 (net +1).

The baseline reproduced four local failures. The final owner/sibling suite passes 506 tests across five files, including transient binding restoration, managed requirements, inherited MCP isolation, and Stop handling. Independent scoped Codex review reports no actionable P0 findings. The prior CI fixture type error is fixed without widening the production contract. Formatting passes; remaining static checks, exact-head CI, and fresh Matrix proof are still running, so this is not yet a merge-ready claim.

The additional proof also checks models whose native metadata requires Code Mode. Their exec/wait interface may remain as isolated computation with an empty tool registry. The probe will exercise the installed binary, assert empty callable/deferred inventories and blocked external access, and check that tool/notify output cannot bypass final Matrix delivery. The original strict tool-count result is retained separately; no failed assertion is silently discarded. The documented guarantee is disabled external tool actions with normal lifecycle hooks retained.

Disposition of the latest ClawSweeper rank-up suggestions remains explicit: reserved com.openclaw.preview protocol frames are consumed with a recorded reason, including disabled/untrusted/malformed frames, to prevent preview text becoming ordinary bot input; unmarked ingress is unchanged. We are not adopting the suggested marker fallback. The pinned upstream Stop parser and turn-loop sources were personally inspected at 90854393966b21e9ebfd21b122334eb09a20c93d, including codex-rs/core/src/session/turn.rs:502-565, core/src/hook_runtime.rs:311-402, and hooks/src/events/stop.rs:250-322,401-447,535-557. Contributor evidence remains attributed to its historical heads; new maintainer evidence is tied to each actual candidate.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

Use ordinary tool-enabled startup, schema and cleanup fixtures. Preserve
the shared web-disabled cleanup configuration and expect no app-policy
fingerprint when no plugin policy is configured. Keep restriction,
cleanup, cancellation and retry assertions intact without larger timeouts.

Consolidate adjacent native planning defaults without changing their
values, property order or precedence, and remove a shadowed test binding.

Co-authored-by: Benjamin Badejo <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

@steipete

Copy link
Copy Markdown
Contributor

Reverted at maintainer request by #132977, landed as 8286e2502667. The Matrix turn-taking feature and associated runtime changes have been removed, preserving unrelated changes that landed afterward. The only retained difference is a publication-safe synthetic model name in an existing test fixture.

The revert passed 442 focused tests and CI on its exact commit. The landed tree matches the reviewed revert. No new live deployment was performed.

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: matrix Channel integration: matrix docs Improvements or additions to documentation extensions: codex extensions: xai gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: needs maintainer proof decision A ClawSweeper-authored PR needs a maintainer proof capture or override decision. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants