Skip to content

Fix config queue overrides for Matrix#79863

Closed
bdjben wants to merge 1 commit into
openclaw:mainfrom
bdjben:fix-matrix-queue-by-channel
Closed

Fix config queue overrides for Matrix#79863
bdjben wants to merge 1 commit into
openclaw:mainfrom
bdjben:fix-matrix-queue-by-channel

Conversation

@bdjben

@bdjben bdjben commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Problem: messages.queue.byChannel.matrix was rejected by config validation even though Matrix is an active OpenClaw channel.
  • Why it matters: Matrix deployments could not tune inbound queue behavior independently from the global queue mode.
  • What changed: Added matrix to the queue by-channel runtime schema and exported queue provider type, kept googlechat/mattermost schema/type drift aligned, and added regression coverage for validation and schema lookup.
  • What did NOT change (scope boundary): This does not relax the schema into an arbitrary provider record; unknown provider keys still fail validation.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Real behavior proof (required for external PRs)

  • Behavior or issue addressed: Matrix-specific queue overrides now validate under messages.queue.byChannel.
  • Real environment tested: local OpenClaw checkout on macOS, Node v24.15.0, pnpm v10.33.2.
  • Exact steps or command run after this patch:
node --import tsx - <<'NODE'
import { validateConfigObject } from './src/config/validation.ts';
import { buildConfigSchema, lookupConfigSchema } from './src/config/schema.ts';
for (const [name, cfg] of Object.entries({
  matrixSteer: { messages: { queue: { byChannel: { matrix: 'steer' } } } },
  matrixInterrupt: { messages: { queue: { byChannel: { matrix: 'interrupt' } } } },
  googlechat: { messages: { queue: { byChannel: { googlechat: 'queue' } } } },
  mattermost: { messages: { queue: { byChannel: { mattermost: 'queue' } } } },
  unknown: { messages: { queue: { byChannel: { unknown: 'queue' } } } },
})) {
  const r = validateConfigObject(cfg);
  console.log(name, r.ok, r.ok ? '' : r.issues.map((i) => `${i.path}: ${i.message}`).join(' | '));
}
const lookup = lookupConfigSchema(buildConfigSchema(), 'messages.queue.byChannel');
console.log('lookup_has_matrix', lookup?.children.some((child) => child.key === 'matrix'));
NODE
  • Evidence after fix:
matrixSteer true
matrixInterrupt true
googlechat true
mattermost true
unknown false messages.queue.byChannel: Unrecognized key: "unknown"
lookup_has_matrix true
  • Observed result after fix: Matrix queue overrides validate, schema lookup lists Matrix, and unknown provider keys remain rejected.
  • What was not tested: A live Matrix inbound message queue flow; this PR is limited to config schema/type acceptance.
  • Before evidence (optional but encouraged): The same config shape failed validation before this change with messages.queue.byChannel: Unrecognized key: "matrix".

Root Cause (if applicable)

  • Root cause: The queue by-channel schema was a closed object and did not include Matrix even though Matrix is a supported channel.
  • Missing detection / guardrail: There was no regression test asserting Matrix queue overrides validate or that schema lookup lists Matrix.
  • Contributing context (if known): The exported queue provider type and runtime schema had already drifted (googlechat vs mattermost), so this PR also aligns those keys while keeping the fix focused.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/config/config.schema-regressions.test.ts, src/config/schema.test.ts
  • Scenario the test should lock in: messages.queue.byChannel.matrix validates for steer and interrupt; schema lookup lists matrix; unknown queue provider keys remain rejected.
  • Why this is the smallest reliable guardrail: The bug is in config validation/schema exposure, so focused config schema tests exercise the failing contract directly.
  • Existing test that already covers this (if any): N/A
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

Operators can now configure Matrix-specific queue behavior with messages.queue.byChannel.matrix.

Diagram (if applicable)

Before:
messages.queue.byChannel.matrix -> config validation error

After:
messages.queue.byChannel.matrix -> validates -> Matrix can use per-channel queue mode

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: local Node v24.15.0 / pnpm v10.33.2
  • Model/provider: N/A
  • Integration/channel (if any): Matrix config schema
  • Relevant config (redacted):
{
  "messages": {
    "queue": {
      "byChannel": {
        "matrix": "steer"
      }
    }
  }
}

Steps

  1. Validate a config object containing messages.queue.byChannel.matrix.
  2. Look up messages.queue.byChannel in the generated config schema.
  3. Verify an unknown queue provider key is still rejected.

Expected

  • Matrix validates.
  • Schema lookup lists Matrix.
  • Unknown provider keys remain rejected.

Actual

  • Matrix validates.
  • Schema lookup lists Matrix.
  • Unknown provider keys remain rejected.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Additional local verification:

pnpm exec vitest run --config test/vitest/vitest.runtime-config.config.ts src/config/config.schema-regressions.test.ts src/config/schema.test.ts --maxWorkers=1
✓ 2 files / 58 tests passed

pnpm build:plugin-sdk:dts
✓ passed

pnpm check
✓ passed

pnpm build
✓ passed

pnpm check:changed
✓ passed

codex review --base origin/main
✓ no regression found in the modified path

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: Matrix steer, Matrix interrupt, googlechat, and mattermost queue overrides validate; unknown queue provider keys remain rejected; schema lookup includes Matrix.
  • Edge cases checked: Unknown provider rejection is preserved.
  • What you did not verify: Live Matrix message delivery/queue behavior, because this PR changes schema/type acceptance only.

AI-assisted: yes. I understand the change: it extends the closed queue provider schema/type keys and adds direct regression coverage for the config contract.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) Yes — existing configs may now use messages.queue.byChannel.matrix.
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: Expanding the closed provider key list could accidentally permit unintended keys.
    • Mitigation: The schema remains strict, and a regression test asserts unknown provider keys still fail.

@openclaw-barnacle openclaw-barnacle Bot added size: S proof: supplied External PR includes structured after-fix real behavior proof. labels May 9, 2026
@clawsweeper

clawsweeper Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

Summary
The PR adds Matrix, Google Chat, and Mattermost queue override key alignment in config schema/types, with regression tests and a changelog entry.

Reproducibility: yes. Source inspection on current main shows Matrix is an active bundled channel id, the strict queue override schema omits matrix, and the runtime resolver reads messages.queue.byChannel by normalized channel key.

Real behavior proof
Sufficient (live_output): The PR body includes copied live output showing after-fix Matrix validation and schema lookup, with unknown-key rejection preserved; no additional proof action is needed.

Next step before merge
A narrow automated repair can replace the stale queue samples with current queue modes and rerun focused config/queue checks without changing product scope.

Security
Cleared: The diff only changes config schema/types, focused tests, and changelog text; it does not touch dependencies, CI, secrets, network calls, or code execution paths.

Review findings

  • [P2] Use current queue modes in the alignment test — src/config/config.schema-regressions.test.ts:208-210
Review details

Best possible solution:

Land the schema/type key alignment with regression coverage using current queue modes, while leaving broader per-channel cap/drop design to #55858.

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

Yes. Source inspection on current main shows Matrix is an active bundled channel id, the strict queue override schema omits matrix, and the runtime resolver reads messages.queue.byChannel by normalized channel key.

Is this the best way to solve the issue?

No, not as currently written. The schema/type alignment is the narrow maintainable fix, but the added tests need to replace the retired queue values with current queue modes before merge.

Full review comments:

  • [P2] Use current queue modes in the alignment test — src/config/config.schema-regressions.test.ts:208-210
    The added alignment test uses the retired queue mode for googlechat, mattermost, and matrix. Current main only accepts steer, followup, collect, and interrupt, so after this branch is refreshed the test will fail before it proves provider-key alignment.
    Confidence: 0.92

Overall correctness: patch is incorrect
Overall confidence: 0.9

Acceptance criteria:

  • node scripts/run-vitest.mjs src/config/config.schema-regressions.test.ts src/config/schema.test.ts
  • node scripts/run-vitest.mjs src/auto-reply/reply/queue/settings.test.ts
  • node scripts/crabbox-wrapper.mjs run --shell -- "pnpm check:changed"

What I checked:

  • Current schema gap: Current main defines queue modes as steer, followup, collect, and interrupt; the strict messages.queue.byChannel schema omits matrix and googlechat while retaining additionalProperties: false behavior through .strict(). (src/config/zod-schema.core.ts:456, caf8fa2ebf39)
  • Current type drift: QueueModeByProvider includes googlechat but does not include mattermost or matrix, matching the drift the PR tries to repair. (src/config/types.queue.ts:4, caf8fa2ebf39)
  • Runtime contract uses channel id: Queue resolution indexes messages.queue.byChannel by normalized channel id, and the bundled Matrix entry declares the canonical channel id matrix. (src/auto-reply/reply/queue/settings.ts:27, caf8fa2ebf39)
  • PR blocker: The PR's added provider-alignment test validates googlechat, mattermost, and matrix with value queue, which is not accepted by the current QueueModeSchema. (src/config/config.schema-regressions.test.ts:208, 56c4fe07d5bf)
  • Related scope remains separate: The related open feature request is about per-channel debounce/cap/drop semantics; its comments clarify that per-channel mode overrides are the existing surface, so this PR should stay limited to accepted channel keys.
  • History provenance: Recent queue contract work in commit 70df2b8 changed the current queue modes and touched the schema/type/resolver area, which explains why the PR's older queue test values are stale. (src/config/zod-schema.core.ts:456, 70df2b8fe28d)

Likely related people:

  • fuller-stack-dev: Authored recent queue contract work that changed accepted queue modes and touched the schema, queue types, and resolver paths implicated by the stale queue test values. (role: recent queue contract contributor; confidence: high; commits: 70df2b8fe28d; files: src/config/zod-schema.core.ts, src/config/types.queue.ts, src/auto-reply/reply/queue/settings.ts)
  • steipete: Recent commits in queue config and resolver history touched the affected files and docs, making them a useful reviewer for the config contract and fallback behavior. (role: adjacent queue runtime/config contributor; confidence: medium; commits: 4a6e10ece842, 10dcd5784641; files: src/auto-reply/reply/queue/settings.ts, src/config/zod-schema.core.ts, docs/concepts/queue.md)
  • gumadeiras: Recent Matrix channel work makes them a plausible reviewer for Matrix-specific impact, though this PR mostly changes shared config schema code. (role: recent Matrix channel contributor; confidence: medium; commits: 99159f89da03; files: extensions/matrix/index.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against caf8fa2ebf39.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 9, 2026
@Takhoffman

Copy link
Copy Markdown
Contributor

@clawsweeper automerge

@clawsweeper clawsweeper Bot added the clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge label May 19, 2026
@clawsweeper

clawsweeper Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

🦞🔧
ClawSweeper automerge is enabled.

Draft PRs stay fix-only until GitHub marks them ready for review. Pause with /clawsweeper stop.

Automerge progress:

  • 2026-05-19 11:01:03 UTC review queued 56c4fe07d5bf (queued)

@clawsweeper

clawsweeper Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper 🐠 reef update

Thanks for the contribution here. ClawSweeper could not safely push to this branch, so it opened a replacement PR from a writable branch and carried the contributor trail along with it.

Why replacement: ClawSweeper could not update the source PR branch directly; GitHub did not grant sufficient push rights to the bot for that branch.
Replacement PR: #84104
Why close: this run explicitly closes the superseded source PR after the credited replacement PR is open, so review continues in one place.
Closing this source PR only because source-PR closing was explicitly enabled for this run.
The replacement PR carries the original credit trail forward.
Co-author credit kept:

fish notes: model gpt-5.5, reasoning high; reviewed against 301a370.

@clawsweeper clawsweeper Bot closed this May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants