Skip to content

fix(irc): config validation rejects the documented healthMonitor override - #117302

Merged
vincentkoc merged 13 commits into
openclaw:mainfrom
ayaangazali:fix/irc-health-monitor-schema
Sep 6, 2026
Merged

vincentkoc merged 13 commits into
openclaw:mainfrom
ayaangazali:fix/irc-health-monitor-schema

Conversation

@ayaangazali

@ayaangazali ayaangazali commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

docs/gateway/health.md documents channels.<provider>.healthMonitor.enabled and lists IRC among the channels that expose the override. IRC's strict schema rejects that key at both channel and named-account scope, so following the documentation refuses the configuration before the existing Gateway health-monitor precedence can use it.

Why This Change Was Made

The repair belongs in IRC's plugin-owned schema, beside its existing configWrites field. IRC hand-builds its account schema, so it declares the same optional strict boolean leaf already consumed by the Gateway. buildMultiAccountChannelSchema reuses that account base for root and named-account configuration.

The review-driven global contract expansion was removed. The existing channel-config-writes contract is restored byte-for-byte, and the proposed shared schema helper and global health-monitor contract are absent. One focused test beside IRC's configWrites test safe-parses both supported scopes and asserts their values.

User Impact

IRC operators can disable health-monitor restarts per channel or per account as documented instead of having the entire configuration rejected. Behavior is unchanged when the optional key is absent, and the Gateway's existing account-over-channel precedence is untouched.

Evidence

Retained contributor real behavior proof

The contributor built the CLI from source at both revisions and ran the same dry-run validation with an isolated OPENCLAW_STATE_DIR, so no real configuration was touched. The payload set the key at root scope and at a named account in one patch:

{
  "channels": {
    "irc": {
      "healthMonitor": { "enabled": true },
      "accounts": {
        "libera": {
          "healthMonitor": { "enabled": false }
        }
      }
    }
  }
}

Before, on main f1782c7a36d, the command exited 1:

$ openclaw config patch --stdin --dry-run
Dry run failed: config schema validation failed.
- channels.irc: invalid config: must not have additional properties: "healthMonitor"
- channels.irc.accounts.libera: invalid config: must not have additional properties: "healthMonitor"

After, on repaired production head af66cc8fb8e, the command exited 0:

$ openclaw config patch --stdin --dry-run
Dry run successful: 2 update(s) validated against <state>/openclaw.json

The current head retains the same IRC schema, type, and generated metadata repair. Its only follow-up change removes the global test/helper expansion and adds the focused IRC regression:

  • root healthMonitor.enabled safe-parses as false;
  • named-account healthMonitor.enabled safe-parses as true;
  • both parsed values are asserted;
  • the pre-existing global configWrites contract is restored exactly.

The contributor previously reported extensions/irc 166/166, the full plugin-contract lane green, zero core type errors, and a clean generated-metadata check on the repaired production bytes. The maintainer repair did not execute contributor code locally; fresh exact-head hosted CI is the execution authority.

Copilot AI review requested due to automatic review settings August 1, 2026 08:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 1, 2026
@clawsweeper clawsweeper Bot added the P2 Normal backlog priority with limited blast radius. label Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 1:54 AM ET / 05:54 UTC.

ClawSweeper review

What this changes

The PR lets IRC accept documented channel and account health-monitor settings, aligns its config type and generated metadata, and adds a focused validation regression test.

Merge readiness

✅ Ready for maintainer review

This repair remains necessary: current main and v2026.9.2 still omit the documented IRC override. The narrowed patch resolves the validation mismatch, retains convincing CLI proof, and has no actionable correctness findings.

Priority: P2
Reviewed head: afed2f9f4ad46628fe89285a541345e32443853b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable repair with relevant before/after CLI evidence and no remaining actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The retained isolated, built-CLI config patch dry-run exercises IRC's production validation boundary: both scopes fail before the repair and validate afterward. Current source and decoded metadata preserve that contract; the focused regression is supplemental.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The retained isolated, built-CLI config patch dry-run exercises IRC's production validation boundary: both scopes fail before the repair and validate afterward. Current source and decoded metadata preserve that contract; the focused regression is supplemental.
Evidence reviewed 8 items Current main still lacks the repair: The strict IRC account schema omits healthMonitor; its base supplies both root and named-account schemas. ReplyRuntimeConfigSchemaShape also does not supply this setting.
Latest release has the same omission: The IRC schema at the supplied latest release, v2026.9.2, likewise lacks healthMonitor. No supplied merged related PR fixes this particular setting.
Established documented contract: The health guide documents both scopes, explicitly includes IRC, and specifies that the account override wins over the channel setting.
Findings None None.
Security None None.

How this fits together

IRC configuration passes through plugin-owned validation before the Gateway can use it. The Gateway already reads account and channel health-monitor settings to decide whether automatic health-monitor restarts are enabled.

flowchart LR
  A[IRC channel settings] --> C[IRC config validation]
  B[Named account settings] --> C
  C --> D[Validated configuration]
  D --> E[Account override then channel default]
  E --> F[Monitor restarts enabled or skipped]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +12, Tests +16, Generated 0. Total +28 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 2 12 0 +12
Tests 1 16 0 +16
Docs 0 0 0 0
Config 0 0 0 0
Generated 3 16 16 0
Other 0 0 0 0
Total 6 44 16 +28

Review metrics

None.

Technical review

Best possible solution:

Keep the repair in IRC's schema and type while preserving the Gateway's existing precedence and enabled-by-default behavior.

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

Yes. Current-main strict schemas reject healthMonitor at both IRC scopes, and the contributor supplies a matching before/after built-CLI validation transcript; this review did not execute target code.

Is this the best way to solve the issue?

Yes. Adding the existing contract to IRC's schema fixes the rejection at its owner without introducing another resolver, changing defaults, or widening the shared plugin SDK.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5579546f18c8.

Labels

Label justifications:

  • P2: This is a bounded IRC configuration-validation repair for an existing documented override.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The retained isolated, built-CLI config patch dry-run exercises IRC's production validation boundary: both scopes fail before the repair and validate afterward. Current source and decoded metadata preserve that contract; the focused regression is supplemental.
  • proof: sufficient: Contributor real behavior proof is sufficient. The retained isolated, built-CLI config patch dry-run exercises IRC's production validation boundary: both scopes fail before the repair and validate afterward. Current source and decoded metadata preserve that contract; the focused regression is supplemental.

Evidence

What I checked:

  • Current main still lacks the repair: The strict IRC account schema omits healthMonitor; its base supplies both root and named-account schemas. ReplyRuntimeConfigSchemaShape also does not supply this setting. (extensions/irc/src/config-schema.ts:36, 5579546f18c8)
  • Latest release has the same omission: The IRC schema at the supplied latest release, v2026.9.2, likewise lacks healthMonitor. No supplied merged related PR fixes this particular setting. (extensions/irc/src/config-schema.ts:36, 3928bad9badf)
  • Established documented contract: The health guide documents both scopes, explicitly includes IRC, and specifies that the account override wins over the channel setting. Public docs: docs/gateway/health.md. (docs/gateway/health.md:46, afed2f9f4ad4)
  • Existing runtime consumer: The Gateway reads raw account configuration first, falls back to the channel override, and otherwise enables monitoring. The health monitor checks this result before considering restarts; the PR does not alter this policy. (src/gateway/server-channels.ts:407, afed2f9f4ad4)
  • Generated metadata is narrowly additive: Read-only parsing of the complete base and head metadata found exactly the IRC root and account healthMonitor objects added, each containing an optional boolean enabled property and rejecting extra properties. Removing those two additions makes the metadata structurally identical. (src/config/bundled-channel-config-metadata.generated.ts:24, afed2f9f4ad4)
  • Retained production CLI proof: The supplied PR body and fix(irc): config validation rejects the documented healthMonitor override #117302 (comment) record separately built CLI runs using isolated state: main f1782c7 rejected both scopes with exit 1; repaired af66cc8fb8e accepted both with exit 0 and two validated updates. This directly exercises the changed config-validation boundary. The historical proof commit is unavailable locally, so byte equivalence to that older build was not independently established; the captured body explicitly retains its proof and the current source implements the same boolean contract. (af66cc8fb8e0)

Likely related people:

  • ayaangazali: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

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

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

Workflow

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

History

Review history (90 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-03T18:45:48.168Z sha af66cc8fb8e0af2d3167134a2ce0c9b77430b12f :: needs real behavior proof before merge. :: [P3] Guard the account-envelope assertion
  • reviewed 2026-09-04T03:14:20.854Z sha af66cc8fb8e0af2d3167134a2ce0c9b77430b12f :: blocked before merge. :: [P2] Consolidate the duplicate schema-combinator evaluator | [P3] Guard the parent account-envelope assertion
  • reviewed 2026-09-05T23:27:04.357Z sha ac07c6ab3568f05f9c7feeef0e6b199eb3afac94 :: blocked before merge. :: none
  • reviewed 2026-09-05T23:34:39.989Z sha 7a2fd41655db84cec58d4d7bff3b564e9cc28862 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T01:53:08.072Z sha 42967e5d59e1f1f7e8416a0f9a36b329975cdec2 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T02:59:43.690Z sha 9889ce5d62faf336908b2faa4652dd656a799927 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T05:10:42.614Z sha 7301c70 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T05:22:43.461Z sha b4d0f2e :: needs maintainer review before merge. :: none

@ayaangazali

Copy link
Copy Markdown
Contributor Author

CI note: checks-node-compact-small-4 is red here, and I do not think it comes from this change.

The failing case is src/scripts/test-projects.test.ts > test-projects args > routes extension helper targets to importing extension tests. It asserts the vitest run plan for extensions/memory-core/... and the received plan carried extra memory-core test files:

+ "extensions/memory-core/src/memory/manager.watcher-config.test.ts"
+ "extensions/memory-core/src/session-search-visibility.test.ts"
+ "extensions/memory-core/src/tools.test.ts"
  ... (7 added entries)

Why I do not think this PR caused it:

  • The diff is three files and none of them are tooling or memory-core: extensions/irc/src/config-schema.ts, the regenerated bundled-channel-config-metadata.generated.ts, and a new contract test. An optional IRC schema leaf cannot change how the test-projects planner enumerates memory-core files.
  • It does not reproduce locally on either side. On current main (dccb1b90138) node scripts/run-vitest.mjs src/scripts/test-projects.test.ts gives Tests 85 passed (85), and on this branch head it gives the same 85 passed.
  • It is currently failing on other open PRs at the same time. fix(video): harden DashScope task and media lifecycle #117303 is red on checks-node-compact-small-4 too, and test(tooling): refresh memory helper routing #117301 is red on checks-node-compact-small-2. Those are not mine and are unrelated to channel schemas.
  • I checked the "new upstream files" theory and it does not hold either: all the added entries exist both in this branch's base and in current main, so it is not a stale-base enumeration gap.

So this looks like a shard/environment issue rather than a defect in the change. I have not pushed anything speculative at gateway, tooling, or memory-core level, since nothing here touches them. Happy to rebase onto the newest main or push an empty change to re-trigger the shard if that is useful, and if it fails again on a fresh run I will dig into the planner properly rather than assume.

@ayaangazali
ayaangazali force-pushed the fix/irc-health-monitor-schema branch from 3b93111 to 2e9d539 Compare August 1, 2026 08:53
@ayaangazali

Copy link
Copy Markdown
Contributor Author

Follow-up: rebased onto current main and pushed 2e9d539a451, which re-triggers that shard. No code change, the diff is the same three files.

The evidence that this is not from this PR got a bit stronger while I waited:

I will report the result of the fresh run either way. If it fails again on this head I will stop treating it as environmental and dig into the planner properly.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 1, 2026
@ayaangazali

Copy link
Copy Markdown
Contributor Author

Closing the loop: checks-node-compact-small-4 came back green on the rebased head 2e9d539a451, and there are no failing checks on this PR now. So the earlier red was environmental rather than anything from this change, consistent with it having been red at the same time on unrelated PRs while my other two PRs from the same base stayed green. No code changes were needed.

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 1, 2026
@ayaangazali

Copy link
Copy Markdown
Contributor Author

Pushed a baseline fix: scripts/generate-config-doc-baseline.ts --check was reporting a hash mismatch on this branch because adding a config key changes the generated config-surface baseline, and I had not regenerated it.

Regenerated with the repo generator (--write), so docs/.generated/config-baseline.counts.json and config-baseline.sha256 are now current and the gate passes. The channel count stays within the existing budget, so no budget raise was needed here.

I hit the same thing on my other schema PRs today and have fixed each one the same way.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Both findings addressed in daf09b1b5f7, and the second one turned out to matter more than it looked.

1. healthMonitor on IrcAccountConfig. Correct, same typed-contract gap you caught on #117287: the schema accepted a key the exported type denied. Added to extensions/irc/src/types.ts beside configWrites, typed as { enabled?: boolean } to mirror the core leaf.

2. Traverse composed schema alternatives. Also correct, and fixing it exposed a real defect in a sibling PR. rejectsKey only looked at properties and additionalProperties on the top-level object, so any channel publishing a union fell through to "not rejecting" and got a free pass. Twitch is exactly that case (z.union([SimplifiedSchema, MultiAccountSchema])). The helper now recurses through anyOf/oneOf and treats a key as refused only when every alternative refuses it.

That does not change this PR's verdict, because Twitch is not one of the nine channels docs/gateway/health.md:42 lists for the health-monitor override, so it stays out of scope here. It did change #117520, where I had claimed every bundled channel accepted heartbeatVisibility; with the corrected helper Twitch was still refusing it, so I fixed Twitch there and said so on that PR.

$ node scripts/run-vitest.mjs src/plugins/contracts/channel-health-monitor.contract.test.ts
Tests  18 passed (18)

$ node scripts/run-vitest.mjs extensions/irc
Tests  140 passed (140)

$ node --import tsx scripts/generate-config-doc-baseline.ts --check
OK

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 1, 2026
@ayaangazali

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (46e44baf460). This branch had picked up the recurring conflict in the generated config baseline (docs/.generated/config-baseline.counts.json and config-baseline.sha256); it is now 0 commits behind and merge-clean.

The baseline was not hand-merged. I reset both generated files to main and re-ran both generators, so the artifacts match what CI regenerates:

node --import tsx scripts/generate-config-doc-baseline.ts --check                  clean
node --import tsx scripts/generate-bundled-channel-config-metadata.ts --check      clean

Local proof at head e3233aa856a:

src/plugins/contracts + src/config/schema.help.quality.test.ts   43 files, 1076 passed
src/cli/config-cli.test.ts                                      190 passed

On the red marks: check-lint, check-lint-core-5 and check-docs are failing here, and I do not believe any of them are this branch. All three die during pnpm install before their actual check step runs (::error::pnpm install failed, then Process completed with exit code 1), with no rule violations or docs drift reported. check-lint and check-lint-core-5 are also currently red on main itself (for example 44b41d5686d). This branch touches no package.json, pnpm-lock.yaml or pnpm-workspace.yaml.

I also think I made that worse: I pushed nine rebases within about a minute, so nine fork CI runs hit dependency install at once. That was my mistake in batching, not a change in the code. Happy to re-push to re-trigger if you would rather see a clean run.

AI-assisted.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (0 behind, merge-clean), both generated-artifact gates clean, contracts 1076 and config-cli 190 green.

The checks-node-changed-extensions-config-37 red is a bounded-timing test in the QA lab, in a package this PR does not touch:

FAIL extension-qa extensions/qa-lab/src/test-file-scenario-command-lifecycle.test.ts
  > qa scenario command real POSIX lifecycle > settles within a bound after ...
AssertionError: expected true to be false

The same job also logged a separate QA matrix harness error, which is not a test assertion at all:

[code-mode-matrix] FAIL harness_error ollama-qwen3-5-9b-07d79b62ba-code-read-1 0ms

Measured on this head:

node scripts/run-vitest.mjs extensions/qa-lab/src/test-file-scenario-command-lifecycle.test.ts
8 passed (8)

This branch changes the IRC config schema, one contract test and the generated baselines. It touches nothing under extensions/qa-lab.

Worth noting how this lane gets selected: it is triggered by changed extension config paths, so touching extensions/irc pulls the whole extension-config shard in. That means this PR causes the test to run, but the test asserts a wall-clock settle bound that a loaded shard can miss, and a 0ms harness error alongside it suggests the runner had its own trouble. Selection is not causation here.

Not pushing anything speculative. Happy to push a no-op refresh to re-trigger if a rerun is inconvenient.

AI-assisted.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (19c916be139), 0 behind and merge-clean.

The check-lint and check-docs red on the previous head was not this branch. Both lanes run oxfmt --check, and it was failing repo-wide on .agents/skills/openclaw-release-validation/SKILL.md, which drifted in with #126055. That is fixed on main now by #126060, so this rebase picks the repair up and those lanes should go green.

Verified at this head, both generated-artifact gates clean and the suites this PR owns passing. Nothing about the change itself moved; same diff, newer base.

AI-assisted.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (784676537c9), 0 behind and merge-clean.

The jump to ten red checks on the previous head, including check-test-types and check-additional-extension-package-boundary, was a stale base rather than anything in this branch. My earlier rebase landed on main during a window where this was broken:

src/agents/subagents/announce/subagent-announce-direct-delivery.ts(85,5):
error TS2353: Object literal may only specify known properties, and
'resolveGatewayContext' does not exist ...
[tsgo] FAILED (exit 1)

main has since fixed it (#126040 and #126062 bound those dispatches to the Gateway instance, and that file now carries the comment "No resolveGatewayContext: this dispatch is bound to the Gateway instance"). I confirmed the current tip is clean by running the same lane on a pristine checkout of main, which exits 0, and again on this rebased head:

node scripts/run-tsgo-core-test-shards.mjs    exit 0

So this push simply moves the branch past that window. Nothing about the change itself moved; same diff, newer base.

AI-assisted.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Rebased head is 0 behind and merge-clean.

checks-node-changed-extensions-config-2 is a timeout in an unrelated plugin:

FAIL extensions extensions/onepassword/src/secret-ref-cli.test.ts
Error: Test timed out in 120000ms.
FAIL extensions extensions/onepassword/src/secret-ref-resolver.test.ts

This branch changes the IRC health-monitor config schema. It touches nothing under extensions/onepassword.

Worth restating how this lane selects work, since it keeps looking incriminating: changed-extensions-config-* is triggered by changed extension config paths, so touching extensions/irc pulls the whole extension-config shard in and runs 1Password's suite too. Selection is not causation, and a 120000ms timeout is a wall-clock bound rather than a wrong value.

AI-assisted.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Finding accepted, fixed in 334963e701c. You were right that the collapse reports an invalid oneOf as accepted.

rejectsKey and rejectsNestedKey now count accepting branches for oneOf and keep the union reading for anyOf:

if (Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {
  const accepting = schema.oneOf.filter((branch) => !rejectsKey(asSchema(branch), key)).length;
  if (accepting !== 1) {
    return true;
  }
}
if (Array.isArray(schema.anyOf) && schema.anyOf.length > 0) {
  return schema.anyOf.every((branch) => rejectsKey(asSchema(branch), key));
}

New schema combinator semantics block covers all three directions: a oneOf matched by two branches is refused, a oneOf matched by exactly one is accepted, and anyOf still accepts when several branches match. I checked the first case is not vacuous by restoring the old collapse and rerunning: × treats a oneOf matched by two branches as refused, 1 failed | 42 passed.

One deliberate exception, and it is worth flagging because my first attempt got it wrong. I initially applied the same counting to acceptsDocumentedOverride and one of my own new assertions failed. That helper returns a vacuous true for a component that says nothing about the leaf:

const healthMonitor = asSchema(schema.properties?.healthMonitor);
if (!healthMonitor) {
  return true;  // "constrains nothing here"
}

So counting its trues would treat "constrains nothing" as a matching oneOf branch, and a two-branch oneOf where only one branch mentions the leaf would come out as two matches. Exactly-one counting is only well defined in the key helpers, where a branch either admits the key or refuses it. I left that helper on the union reading with a comment explaining why, rather than making the numbers line up.

Validation at 334963e701c, 0 behind:

  • src/plugins/contracts: 1084 passed, 43 files
  • src/config/schema.help.quality.test.ts: 24 passed
  • src/cli/config-cli.test.ts: 198 passed
  • extensions/irc: 161 passed
  • both generator --check gates: exit 0
  • run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json: exit 0

The runtime schema repair is unchanged, as you noted it needed to be.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

checks-node-changed-extensions-config-6 is not from this diff, and I have not pushed a fix for it.

The failure is one browser test: extensions/browser/src/browser/chrome.test.ts > browser chrome helpers > does not close a replacement browser that reused the managed CDP port, with expected [] to deeply equal [ 'SystemInfo.getProcessInfo' ].

This PR changes the IRC config schema, its types, and a contract test. It contains no browser files, and extensions/browser/src/browser/chrome.test.ts is byte identical to current main. Locally it passes 36/36 on this PR's head, three consecutive runs.

The test drives a mock CDP server through withMockChromeCdpServer and asserts that a specific CDP call was observed. Getting an empty list back means the probe had not landed when the assertion ran, which is a race in the harness rather than a schema question.

This is the second distinct browser test to fail on this same shard across two of my unrelated PRs today. #125977, which touches only packages/ai and src/agents, failed invoke-browser.test.ts > retains staged copies when the timeout wins before dispatch settles on checks-node-changed-extensions-config-6 as well, and that one also passes locally and is byte identical to main. Two different browser tests, two unrelated diffs, one shard.

That mirrors #125976, where the same shape was recorded for gateway-server-chat failing across two unrelated PRs that touched no gateway code.

I have rebased onto current main to pick up a fresh run rather than leave the red mark sitting, since gh run rerun is not available to fork contributors.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

checks-node-compact-small-49 failed on two cases in test/scripts/vitest-fork-shutdown.test.ts (joins 'vmForks' shutdown with 'raw' setup and joins 'custom-opt-in' shutdown with 'raw' setup).

Not from this diff. This PR changes three files under extensions/irc and src/config, and touches nothing in test/scripts.

That harness is being actively stabilised on main. Two fixes for this exact file landed after this branch's merge base and were not in it:

I rebased so the branch carries both. New head 273779e2fe1, IRC lane 166/166, and the change itself is unchanged at three added lines in extensions/irc/src/config-schema.ts, verified before the rebase, after it, and again from the pushed branch.

One caveat I would rather state than leave implied: this file also fails locally for me on pristine upstream/main, though on different cases (slow-exit, natural-exit) than the ones that failed in CI here. So I am not claiming the rebase makes it deterministically green, only that the branch now carries the two fixes it was missing and no longer runs an older copy of the harness.

This is the fourth failure on this PR in two days where the failing file was one the diff does not touch and the cause was the branch trailing a main-side fix: ci-platform-checkout, the max-lines count on state-migrations.media-persistence.test.ts, vitest-projects-config, and now this one.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Added the final-head both-scopes proof the last review asked for.

The earlier terminal readback was root-scope only and was not tied to a specific head, which is what left this at needs proof. This one names both revisions and covers root and named-account in a single patch, run through an isolated OPENCLAW_STATE_DIR so no real config was touched.

main at f1782c7a36d rejects both scopes (exit 1), and the final head af66cc8fb8e accepts both (exit 0, two updates validated). Full traces are in the PR body under Evidence.

I built the CLI from source on each revision rather than reusing one build, so the before and after come from their own trees.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Pushed the consolidation, rebased onto current main. All three review points are addressed.

P1/P2, one evaluator instead of two. The duplicate now lives in src/plugins/contracts/test-helpers/channel-schema-keys.ts, and both channel-health-monitor and channel-config-writes import it. Neither contract keeps a private copy, so there is nothing left to drift.

One thing worth flagging, because I got it wrong on the first attempt. I started by extracting the evaluator from channel-config-writes, assuming the two were equivalent. They are not. That version flattens every combinator and reports a key as rejected when any reachable closed alternative omits it. Under anyOf that is wrong: a config validates as soon as one branch accepts, so a key declared by branch B is accepted even though branch A is closed without it. The health-monitor version models the combinators properly, including oneOf exclusivity, where a key that two branches both accept is refused at load time. I kept that one and threw mine away. Consolidating on the weaker evaluator would have quietly loosened the configWrites contract, which is the opposite of what you asked for.

The schema combinator semantics suite moved with it and now covers the shared helper directly.

P3, the vacuous account assertion. Fixed, and here is the channel it was hiding. I counted the account-entry schemas each documented channel actually resolves to:

discord=1  googlechat=1  imessage=1  irc=1
msteams=0  <-- no accounts envelope
signal=1   slack=1  telegram=1  whatsapp=1

msteams publishes no accounts envelope, so asSchema(accounts?.additionalProperties) was undefined and the old parent assertion passed there without testing anything. Account entries are now enumerated, channels without an envelope are skipped explicitly with a comment saying why, and the other eight are genuinely asserted.

Validation, all at the final rebased head

  • channel-health-monitor + channel-config-writes + channel-history-limit: 105 passed
  • extensions/irc: 20 files, 177 passed
  • both generators re-run with --write, both --check gates pass
  • oxlint clean on the three touched files

One proof gap, stated plainly: run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json reports no errors in any file this PR touches, but it does not exit clean overall. It fails on src/agents/embedded-agent-runner/run/assistant-failure.test.ts with TS2339: Property 'maybeRetryTransient' does not exist. That directory is byte-identical between this branch and main, so the failure is pre-existing and unrelated to this change. It looks like #139397 added maybeRetryTransient while #139410 narrowed the Pick it is read through. I have not touched it here.

Net effect on the two contracts is -141 lines; the shared helper is 156.

Follow-up, not in this PR. channel-history-limit.contract.test.ts has a third, shallower walk that handles only a top-level anyOf and ignores allOf/oneOf. It predates this change, and tightening it could fail for reasons unrelated to healthMonitor, so I left it alone rather than widen this diff. Happy to do it separately if you want it.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Three red checks on 9889ce5d62f, out of 205. None of them come from this diff, so I have not pushed a speculative fix. Evidence for each:

check-additional-boundaries and openclaw/ci-gate. The boundary scripts all report no violations; the job fails on lint:tmp:tsgo-core-boundary:

Core test shards must cover every canonical test root exactly once and stay at or below 720 roots:
- services: 721 test roots exceeds the 720 limit

This is the same failure already diagnosed on #139598: #139592 added src/logging/diagnostic-gc.test.ts, which took the services group from 720 to 721 against an unchanged limit. I verified it independently rather than assuming: pnpm run lint:tmp:tsgo-core-boundary on a pristine checkout of main at 8bb79984593 fails with the identical message and the identical count of 721. Since this branch reports 721 as well, the file it adds (src/plugins/contracts/test-helpers/channel-schema-keys.ts) contributes no test root. Raising that limit is a ratchet change and belongs to whoever owns the shard partition, not to this PR.

checks-node-compact-small-2. A heap OOM, not an assertion:

FAIL src/commands/doctor-session-sqlite.memory.test.ts
  > imports public transcripts and completes branch projections under a 256 MiB heap
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

This branch changes no file in that test's graph. The diff is limited to the IRC config schema, two contract tests, one new test helper, and the regenerated config baseline artifacts, with nothing under src/commands/ or src/state/. Running that file locally on pristine main passes all three cases, including the one that failed here, so this reads as runner memory pressure on that shard rather than a defect on main. I would rather say that plainly than push a change to make a red mark disappear.

I do not have rerun rights on this repository, so I cannot retry the two jobs myself. Happy to rebase again whenever the shard limit is sorted out.

The parent-key assertions pass for a strict empty healthMonitor object while
the documented enabled setting is refused, so they did not pin the contract.
An allOf component that is closed and omits healthMonitor entirely refuses the
leaf at config load, but the helper reported it as not rejecting, so the
contract stayed green on a schema that cannot load.
…ust its shape

The leaf assertions only proved healthMonitor.enabled was structurally present
and not rejected, so a leaf typed as anything else would pass while real config
loading refused the documented { enabled: false }.
…d branch

The value check reused propertySchema, which returns the first matching branch,
so an allOf sibling typing enabled as a string would still report the documented
boolean as accepted while real config loading refused it.
…check

Flattening anyOf/oneOf into the same every() as allOf over-rejected a valid
union, where one accepting branch is enough. The value check now mirrors the
combinators rejectsKey uses: alternatives need one match, components need all.
…helpers

The key helpers collapsed anyOf and oneOf into one any-branch reading, so a
oneOf whose documented value matches two branches was reported as accepted
even though config load refuses it. Count accepting branches for oneOf and
keep the union reading for anyOf.

acceptsDocumentedOverride keeps the union reading on purpose: it returns a
vacuous true for a component that says nothing about the leaf, so counting
those trues would treat "constrains nothing" as a matching branch.
… contracts

The health-monitor and configWrites contracts each carried their own
JSON-Schema combinator walk. The two had already drifted: the configWrites
copy flattened every combinator and reported a key as rejected when any
reachable closed alternative omitted it, which is wrong under anyOf, where a
config validates as soon as one branch accepts. The health-monitor copy models
oneOf exclusivity, anyOf union and allOf intersection properly.

Move the correct evaluator to a shared test helper and point both contracts at
it, so the same schema can no longer produce two different answers. The
combinator unit tests now cover the shared helper directly.

Also fixes a vacuous assertion: msteams publishes no accounts envelope, so the
parent account-scope check resolved to undefined and passed without testing
anything. Account entries are now enumerated, and channels without an envelope
are skipped explicitly rather than silently.
@ayaangazali

Copy link
Copy Markdown
Contributor Author

Rebased onto 883d4d65bad. The shard limit that caused the red above is resolved on main now: pnpm run lint:tmp:tsgo-core-boundary exits 0 on current main and on this branch, where both reported services: 721 test roots exceeds the 720 limit earlier today. CI is re-running on 7301c7057a8, so check-additional-boundaries and openclaw/ci-gate should clear on their own.

Nothing about the change itself moved. Still 8 files, 3 of them the regenerated config baseline artifacts, and 3 added lines of IRC production code. Contracts pass 98, extensions/irc passes 177.

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 6, 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:

@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: irc docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants