Skip to content

fix(cli): allow zero Discord timeout duration#93329

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
rohitjavvadi:fix/discord-timeout-zero
Jun 15, 2026
Merged

fix(cli): allow zero Discord timeout duration#93329
vincentkoc merged 1 commit into
openclaw:mainfrom
rohitjavvadi:fix/discord-timeout-zero

Conversation

@rohitjavvadi

@rohitjavvadi rohitjavvadi commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes a CLI/runtime mismatch for Discord timeout clearing.
  • openclaw message timeout --duration-min 0 should be accepted because the Discord runtime treats zero minutes as clearing the timeout.
  • The shared CLI numeric validator now treats durationMin as non-negative, matching deleteDays and the Discord moderation path.
  • Out of scope: changing Discord moderation auth, live Discord delivery behavior, or other numeric CLI flags.

Linked context

Closes #93327

Related #92483, #92490

Was this requested by a maintainer or owner?

No. This is a focused bug fix from source-level behavior evidence.

Real behavior proof (required for external PRs)

  • Behavior or issue addressed: the CLI rejected --duration-min 0 before dispatch, even though Discord timeout clearing is represented downstream by durationMinutes: 0 and communication_disabled_until: null.
  • Real environment tested: macOS local checkout on current PR branch fix/discord-timeout-zero, rebuilt locally with node scripts/build-all.mjs cliStartup from PR SHA e18ca11d.
  • Exact steps or command run after this patch:
node scripts/build-all.mjs cliStartup
tmp_home=$(mktemp -d)
HOME="$tmp_home" \
XDG_CONFIG_HOME="$tmp_home/.config" \
XDG_DATA_HOME="$tmp_home/.local/share" \
XDG_STATE_HOME="$tmp_home/.local/state" \
node openclaw.mjs message timeout \
  --channel discord \
  --guild-id 123456789012345678 \
  --user-id 234567890123456789 \
  --duration-min 0 \
  --dry-run \
  --json
rm -rf "$tmp_home"

pnpm vitest run src/cli/program/message/helpers.test.ts
pnpm vitest run extensions/discord/src/actions/runtime.test.ts
OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs src/cli/program/message/helpers.test.ts extensions/discord/src/actions/runtime.test.ts extensions/discord/src/actions/handle-action.test.ts extensions/discord/src/send.creates-thread.test.ts
pnpm oxlint src/cli/program/message/helpers.ts src/cli/program/message/helpers.test.ts
pnpm oxfmt src/cli/program/message/helpers.ts src/cli/program/message/helpers.test.ts --check
git diff --check
pnpm tsgo:core
pnpm tsgo:core:test
  • Evidence after fix:
$ node scripts/build-all.mjs cliStartup
[build-all] phase timings: total 14.7s; slowest write-cli-startup-metadata 8.15s; tsdown 5.08s; runtime-postbuild 966ms; check-cli-bootstrap-imports 296ms; write-cli-compat 99ms; build-stamp 53ms; runtime-postbuild-stamp 50ms

$ HOME="$tmp_home" XDG_CONFIG_HOME="$tmp_home/.config" XDG_DATA_HOME="$tmp_home/.local/share" XDG_STATE_HOME="$tmp_home/.local/state" node openclaw.mjs message timeout --channel discord --guild-id 123456789012345678 --user-id 234567890123456789 --duration-min 0 --dry-run --json
{
  "action": "timeout",
  "channel": "discord",
  "dryRun": true,
  "handledBy": "dry-run",
  "payload": {
    "ok": true,
    "dryRun": true,
    "channel": "discord",
    "action": "timeout"
  }
}

src/cli/program/message/helpers.test.ts: 41 tests passed
extensions/discord/src/actions/runtime.test.ts: 94 tests passed
Combined CLI + Discord shard run: 4 files passed, 183 tests passed
Focused agent delivery-target test that timed out once in CI: passed locally
oxlint: passed
oxfmt --check: all matched files use the correct format
git diff --check: passed
tsgo:core: passed
tsgo:core:test: passed
  • Observed result after fix: the real CLI accepts --duration-min 0 and reaches the dry-run dispatch path instead of failing with --duration-min must be a positive integer. The helper regression test also proves durationMin: "0" reaches messageCommand for the timeout action without a CLI validation error, while malformed values still fail before plugin loading or dispatch.
  • What was not tested: a live Discord guild/member timeout clear against the Discord API was not executed.
  • Proof limitations or environment constraints: the changed behavior is at the local CLI validation boundary, so live guild mutation was intentionally avoided. The dry-run CLI proof exercises the public command path without sending a Discord moderation request.
  • Before evidence: prior code placed durationMin in STRICT_POSITIVE_INTEGER_OPTIONS, causing --duration-min 0 to fail with --duration-min must be a positive integer.

Tests and validation

Commands run are listed above.

Regression coverage added:

  • src/cli/program/message/helpers.test.ts now verifies durationMin: "0" is allowed through the CLI helper for the timeout action.
  • Existing malformed numeric coverage was kept and now expects the correct non-negative validation wording for --duration-min.

What failed before this fix: --duration-min 0 was rejected by the CLI validator before reaching the Discord timeout path.

Risk checklist

Did user-visible behavior change? (Yes/No)

Yes. The CLI now accepts an explicit zero-minute Discord timeout duration.

Did config, environment, or migration behavior change? (Yes/No)

No.

Did security, auth, secrets, network, or tool execution behavior change? (Yes/No)

No.

What is the highest-risk area?

Discord moderation command validation.

How is that risk mitigated?

The change only widens durationMin from positive integer to non-negative integer, matching the Discord runtime validator and existing agent tool schema. Malformed and fractional values remain rejected before dispatch. The real CLI dry-run output proves --duration-min 0 now passes the validation boundary without sending a live Discord moderation request.

Current review state

What is the next action?

Ready for automated checks and maintainer review.

What is still waiting on author, maintainer, CI, or external proof?

Waiting on CI and maintainer/automation review.

Which bot or reviewer comments were addressed?

ClawSweeper asked for real CLI behavior proof. The PR body now includes the exact after-fix dry-run command and output.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 15, 2026
@clawsweeper

clawsweeper Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 15, 2026, 11:28 AM ET / 15:28 UTC.

Summary
The PR moves durationMin from strict-positive to non-negative message CLI validation and adds helper coverage for zero-minute Discord timeout dispatch.

PR surface: Source +2, Tests +23. Total +25 across 2 files.

Reproducibility: yes. source-reproducible: current main validates durationMin as strictly positive before dispatch, while the Discord bridge/runtime already accept non-negative timeout minutes. I did not run the CLI in this read-only review, but the call path and existing tests make the failure boundary clear.

Review metrics: 1 noteworthy metric.

  • CLI Validation Range: 1 option widened from positive to non-negative. Maintainers should notice that the user-visible accepted input range changes only for --duration-min.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Next step before merge

  • [P2] No repair lane is needed because this open PR already contains the narrow fix and has no actionable review findings.

Security
Cleared: The diff only changes CLI numeric validation and tests; it does not touch dependencies, workflows, secrets, auth, package execution, or supply-chain surfaces.

Review details

Best possible solution:

Land this narrow validator/test alignment after ordinary maintainer and check gates, and let the merge close #93327.

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

Yes, source-reproducible: current main validates durationMin as strictly positive before dispatch, while the Discord bridge/runtime already accept non-negative timeout minutes. I did not run the CLI in this read-only review, but the call path and existing tests make the failure boundary clear.

Is this the best way to solve the issue?

Yes. The best fix is to align the shared CLI validator with the existing Discord runtime contract instead of changing downstream runtime behavior or adding a command-specific special case.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This fixes a valid Discord moderation CLI bug with limited blast radius and no config, migration, dependency, or auth changes.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes after-fix terminal output from a rebuilt public CLI dry-run showing --duration-min 0 reaches dispatch instead of failing validation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal output from a rebuilt public CLI dry-run showing --duration-min 0 reaches dispatch instead of failing validation.
Evidence reviewed

PR surface:

Source +2, Tests +23. Total +25 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 2 +2
Tests 1 25 2 +23
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 29 4 +25

What I checked:

Likely related people:

  • RomneyDa: Git blame ties the current shared message CLI helper, Discord bridge, sender, and zero-duration runtime test lines to commit 1f8c4d3 from merged work by RomneyDa. (role: recent area contributor; confidence: high; commits: 1f8c4d3958b2; files: src/cli/program/message/helpers.ts, src/cli/program/message/helpers.test.ts, extensions/discord/src/actions/handle-action.guild-admin.ts)
  • rohitjavvadi: Beyond this PR, Rohit authored recently merged Matrix and Canvas CLI numeric-validation fixes, making him relevant to the validation pattern under review. (role: recent adjacent contributor; confidence: high; commits: e18ca11dfb3a, 3429e33feb39, e55cebf4c278; files: src/cli/program/message/helpers.ts, src/cli/program/message/helpers.test.ts, extensions/matrix/src/cli.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@rohitjavvadi
rohitjavvadi force-pushed the fix/discord-timeout-zero branch from faf4bb1 to e18ca11 Compare June 15, 2026 15:04
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 15, 2026
@rohitjavvadi

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 15, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 15, 2026
@vincentkoc vincentkoc self-assigned this Jun 15, 2026
@vincentkoc
vincentkoc merged commit 794bd89 into openclaw:main Jun 15, 2026
217 of 225 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS 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.

[Bug]: CLI rejects --duration-min 0 for clearing Discord timeouts

2 participants