Skip to content

Config: require Discord ID strings#18220

Merged
thewilloftheshadow merged 4 commits intomainfrom
fix/discord-id-strings
Feb 16, 2026
Merged

Config: require Discord ID strings#18220
thewilloftheshadow merged 4 commits intomainfrom
fix/discord-id-strings

Conversation

@thewilloftheshadow
Copy link
Member

@thewilloftheshadow thewilloftheshadow commented Feb 16, 2026

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: Discord config allowlists accepted numeric IDs, which can be parsed inconsistently across JSON5/users.
  • Why it matters: Discord IDs should be treated as strings everywhere to avoid truncation or schema ambiguity.
  • What changed: Enforced string-only Discord IDs in config schema/types and added doctor repairs to convert numeric IDs.
  • What did NOT change (scope boundary): No changes to non-Discord providers or runtime routing logic beyond type validation.

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

  • Discord config now rejects numeric IDs in allowlists; run openclaw doctor --fix to convert numeric IDs to strings.

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:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any): Discord
  • Relevant config (redacted):

Steps

  1. Set channels.discord.allowFrom: [123].
  2. Run config validation or openclaw doctor.

Expected

  • Config validation fails with a Discord ID string error, or doctor converts to strings.

Actual

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: Not run locally.
  • Edge cases checked: Not run locally.
  • What you did not verify: Automated tests and manual Discord flows.

Compatibility / Migration

  • Backward compatible? (No)
  • Config/env changes? (Yes)
  • Migration needed? (Yes)
  • If yes, exact upgrade steps:
    • Run openclaw doctor --fix to convert numeric Discord IDs to strings.

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Revert this PR or remove the schema restriction.
  • Files/config to restore: src/config/zod-schema.providers-core.ts, src/commands/doctor-config-flow.ts.
  • Known bad symptoms reviewers should watch for: Discord configs with numeric IDs marked invalid.

Risks and Mitigations

  • Risk: Users with numeric Discord IDs in config will see validation errors.
    • Mitigation: Doctor repair converts numeric IDs to strings.

Greptile Summary

Enforced string-only Discord IDs across config schema, types, and runtime to prevent JSON parsing inconsistencies and truncation. Added DiscordIdSchema validator with .refine() that accepts numbers but only passes strings, providing clear error messages. Implemented maybeRepairDiscordNumericIds() in doctor flow to auto-convert numeric IDs to strings via structuredClone + map transformation across all Discord allowlist paths (DMs, guilds, channels, roles, approvers). Updated 10 files with comprehensive type changes from Array<string | number> to string[] for type safety.

Confidence Score: 4/5

  • Safe to merge with minor migration risk for users with numeric Discord IDs in config
  • Well-designed implementation with thorough test coverage, automatic migration via doctor, and clear error messages. Schema validation is sound and type changes are consistent. One concern: users must run openclaw doctor --fix to migrate, which could cause friction if not communicated clearly.
  • No files require special attention - implementation is clean and well-tested

Last reviewed commit: e73a3d6

@openclaw-barnacle openclaw-barnacle bot added channel: discord Channel integration: discord commands Command implementations size: M maintainer Maintainer-authored PR labels Feb 16, 2026
@github-actions
Copy link
Contributor

⚠️ Formal models conformance drift detected

The formal models extracted constants (generated/*) do not match this openclaw PR.

This check is informational (not blocking merges yet).
See the formal-models-conformance-drift artifact for the diff.

If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there.

1 similar comment
@github-actions
Copy link
Contributor

⚠️ Formal models conformance drift detected

The formal models extracted constants (generated/*) do not match this openclaw PR.

This check is informational (not blocking merges yet).
See the formal-models-conformance-drift artifact for the diff.

If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there.

@github-actions
Copy link
Contributor

⚠️ Formal models conformance drift detected

The formal models extracted constants (generated/*) do not match this openclaw PR.

This check is informational (not blocking merges yet).
See the formal-models-conformance-drift artifact for the diff.

If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there.

@github-actions
Copy link
Contributor

⚠️ Formal models conformance drift detected

The formal models extracted constants (generated/*) do not match this openclaw PR.

This check is informational (not blocking merges yet).
See the formal-models-conformance-drift artifact for the diff.

If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there.

@thewilloftheshadow thewilloftheshadow merged commit 1b73010 into main Feb 16, 2026
24 checks passed
@thewilloftheshadow thewilloftheshadow deleted the fix/discord-id-strings branch February 16, 2026 18:23
archerhpagent pushed a commit to howardpark/openclaw that referenced this pull request Feb 18, 2026
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord commands Command implementations maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant