Skip to content

fix(config): use static channel metadata in docs baseline#51161

Merged
vincentkoc merged 2 commits intomainfrom
vincentkoc-code/fix-config-doc-baseline-static-channel-metadata
Mar 20, 2026
Merged

fix(config): use static channel metadata in docs baseline#51161
vincentkoc merged 2 commits intomainfrom
vincentkoc-code/fix-config-doc-baseline-static-channel-metadata

Conversation

@vincentkoc
Copy link
Copy Markdown
Member

Summary

  • Problem: pnpm release:check failed because config-doc baseline generation could pick up channel label/help from config-schema import side effects instead of the static metadata we actually want.
  • Why it matters: that path is brittle around plugin-loading boundaries and caused baseline drift for channels like Matrix where runtime blurbs differ from package metadata.
  • What changed: config doc baseline generation now sources channel label/help from the static channel catalog (openclaw.channel.label / blurb) and uses config-surface imports only for schema shape.
  • What did NOT change (scope boundary): no plugin loader/runtime behavior changed, and no channel config schema contract changed.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • 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 #

User-visible / Behavior Changes

None.

Security Impact (required)

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

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: local repo worktree
  • Model/provider: n/a
  • Integration/channel (if any): config docs / bundled channel plugins
  • Relevant config (redacted): n/a

Steps

  1. Run pnpm build.
  2. Run pnpm test -- src/config/doc-baseline.integration.test.ts src/config/doc-baseline.test.ts src/config/schema.test.ts.
  3. Run pnpm release:check.

Expected

  • Config baseline generation stays stable on static channel metadata.
  • release:check passes.

Actual

  • Passed.

Evidence

Attach at least one:

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

Human Verification (required)

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

  • Verified scenarios: regenerated config baseline, confirmed no diff, confirmed channels.matrix baseline help stays on the static package blurb instead of the runtime homeserver blurb.
  • Edge cases checked: targeted schema tests, repo check, fresh branch-from-origin/main rebuild, and release:check pack validation.
  • What you did not verify: full pnpm test suite.

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)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert this PR/commit.
  • Files/config to restore: src/config/doc-baseline.ts, src/config/doc-baseline.integration.test.ts.
  • Known bad symptoms reviewers should watch for: config baseline drift reappears or top-level plugin channel help starts reflecting runtime-side-effect blurbs/package names again.

Risks and Mitigations

  • Risk: static channel catalog metadata and runtime channel blurbs diverge intentionally for a given plugin.
    • Mitigation: the docs baseline now consistently follows the static package metadata seam; the added regression test locks that expectation for Matrix.

@openclaw-barnacle openclaw-barnacle bot added size: S maintainer Maintainer-authored PR labels Mar 20, 2026
@vincentkoc vincentkoc self-assigned this Mar 20, 2026
@vincentkoc vincentkoc marked this pull request as ready for review March 20, 2026 17:52
@vincentkoc vincentkoc merged commit c64893a into main Mar 20, 2026
@vincentkoc vincentkoc deleted the vincentkoc-code/fix-config-doc-baseline-static-channel-metadata branch March 20, 2026 17:52
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 20, 2026

Greptile Summary

This PR fixes a baseline drift issue in config doc generation by sourcing channel label and description (help text) from the static channel catalog (listChannelPluginCatalogEntries) rather than from plugin manifest fields that could be contaminated by runtime side-effects (e.g. Matrix's homeserver blurb replacing the intended package blurb). The fix is applied consistently across both the sequential debug path and the parallel production path in loadBundledConfigSchemaResponse, and a new regression test locks the expected static values for Discord, MS Teams, and Matrix.

Key changes:

  • loadBundledConfigSchemaResponse now eagerly builds a channelCatalogById map from the static catalog and uses catalogMeta?.label / catalogMeta?.blurb as the authoritative source, falling back to plugin.name/plugin.description only when no catalog entry exists.
  • loadChannelSurfaceMetadata gained a description parameter so the catalog-resolved value propagates through to the returned surface metadata.
  • A new integration test (uses human-readable channel metadata for top-level channel sections) asserts the label and help values are stable static strings and explicitly guards against npm package name leakage and runtime blurb leakage.

One style concern worth noting: catalogMeta?.blurb ?? plugin.description uses nullish-coalescing against ChannelMeta.blurb, which is always a string (normalized to "" when unset in toChannelMeta). This means a channel in the catalog with no blurb configured will silently produce an empty description rather than falling back to plugin.description. Using || in place of ?? would be safer for this fallback. The issue affects both the sequential and parallel paths at lines 311 and 335.

Confidence Score: 4/5

  • Safe to merge with one minor style fix recommended — no runtime behavior or schema contract changes.
  • The change is narrowly scoped to doc baseline generation, is well-tested with a targeted regression test, and the author verified release:check passes. The only concern is the ?? vs || operator choice for the empty-blurb fallback, which is a low-risk edge case for bundled channels that are expected to have non-empty blurbs. No plugin loader or channel config schema contracts were changed.
  • src/config/doc-baseline.ts lines 311 and 335 — the ?? plugin.description fallback should use || to also catch empty string blurbs from the catalog.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/config/doc-baseline.ts
Line: 311

Comment:
**Empty `blurb` silently wins over `plugin.description`**

`ChannelMeta.blurb` is always a `string` (never `undefined`) because `toChannelMeta` normalises it with `|| ""`. This means when a bundled channel plugin exists in the catalog but has no blurb configured, `catalogMeta?.blurb` evaluates to `""`, and the `??` operator does **not** fall through to `plugin.description` (since `""` is not nullish). The fallback is silently lost.

The same pattern is duplicated on line 335 in the parallel branch.

Consider using `||` instead of `??` so that an empty string also triggers the fallback:

```suggestion
            const description = catalogMeta?.blurb || plugin.description;
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/config/doc-baseline.ts
Line: 335

Comment:
**Same empty `blurb` issue in the parallel branch**

Same as the issue in the sequential debug branch above — `catalogMeta?.blurb ?? plugin.description` will not fall through to `plugin.description` when the catalog entry exists with an empty blurb.

```suggestion
            const description = catalogMeta?.blurb || plugin.description;
```

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: "Merge branch 'main' ..."

const loaded = await promise;
const catalogMeta = channelCatalogById.get(plugin.id);
const label = catalogMeta?.label ?? plugin.name ?? plugin.id;
const description = catalogMeta?.blurb ?? plugin.description;
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.

P2 Empty blurb silently wins over plugin.description

ChannelMeta.blurb is always a string (never undefined) because toChannelMeta normalises it with || "". This means when a bundled channel plugin exists in the catalog but has no blurb configured, catalogMeta?.blurb evaluates to "", and the ?? operator does not fall through to plugin.description (since "" is not nullish). The fallback is silently lost.

The same pattern is duplicated on line 335 in the parallel branch.

Consider using || instead of ?? so that an empty string also triggers the fallback:

Suggested change
const description = catalogMeta?.blurb ?? plugin.description;
const description = catalogMeta?.blurb || plugin.description;
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/config/doc-baseline.ts
Line: 311

Comment:
**Empty `blurb` silently wins over `plugin.description`**

`ChannelMeta.blurb` is always a `string` (never `undefined`) because `toChannelMeta` normalises it with `|| ""`. This means when a bundled channel plugin exists in the catalog but has no blurb configured, `catalogMeta?.blurb` evaluates to `""`, and the `??` operator does **not** fall through to `plugin.description` (since `""` is not nullish). The fallback is silently lost.

The same pattern is duplicated on line 335 in the parallel branch.

Consider using `||` instead of `??` so that an empty string also triggers the fallback:

```suggestion
            const description = catalogMeta?.blurb || plugin.description;
```

How can I resolve this? If you propose a fix, please make it concise.

bundledChannelPlugins.map(async (plugin) => {
const catalogMeta = channelCatalogById.get(plugin.id);
const label = catalogMeta?.label ?? plugin.name ?? plugin.id;
const description = catalogMeta?.blurb ?? plugin.description;
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.

P2 Same empty blurb issue in the parallel branch

Same as the issue in the sequential debug branch above — catalogMeta?.blurb ?? plugin.description will not fall through to plugin.description when the catalog entry exists with an empty blurb.

Suggested change
const description = catalogMeta?.blurb ?? plugin.description;
const description = catalogMeta?.blurb || plugin.description;
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/config/doc-baseline.ts
Line: 335

Comment:
**Same empty `blurb` issue in the parallel branch**

Same as the issue in the sequential debug branch above — `catalogMeta?.blurb ?? plugin.description` will not fall through to `plugin.description` when the catalog entry exists with an empty blurb.

```suggestion
            const description = catalogMeta?.blurb || plugin.description;
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eea9988fd4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +295 to +297
listChannelPluginCatalogEntries({
workspaceDir: repoRoot,
env,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exclude workspace overrides from channel metadata lookup

loadBundledConfigSchemaResponse now resolves channel labels/blurbs through listChannelPluginCatalogEntries({ workspaceDir: repoRoot, ... }), but that catalog API gives workspace entries higher priority than bundled. When a developer has a local .openclaw/extensions override for a channel ID (for example while testing a plugin), this code will pull that local label/blurb into the docs baseline, making release:check nondeterministic and potentially publishing non-bundled metadata. To keep the baseline stable, this path should use bundled-only metadata rather than discovery results that include workspace/config origins.

Useful? React with 👍 / 👎.

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

Labels

maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant