Skip to content

feat(config/channels): add reply_min_interval_secs to TelegramConfig#6389

Open
singlerider wants to merge 4 commits intozeroclaw-labs:masterfrom
singlerider:feat/6345-reply-min-interval-secs
Open

feat(config/channels): add reply_min_interval_secs to TelegramConfig#6389
singlerider wants to merge 4 commits intozeroclaw-labs:masterfrom
singlerider:feat/6345-reply-min-interval-secs

Conversation

@singlerider
Copy link
Copy Markdown
Collaborator

@singlerider singlerider commented May 5, 2026

Summary

Adds the reply_min_interval_secs: u64 field on TelegramConfig, defaulting to 0 (current behaviour: replies fire as soon as the LLM completes). The intended range is 0..=3600.

The threat model: on paired-identity channels under personal accounts, sub-second replies are a strong AI-tell and a platform-side anomaly signal. Raising this value paces the agent so its cadence resembles a human operator's.

This commit ships the schema field for Telegram. Mirroring the field to other channels, load-time range validation, and the per-(channel, peer-jid) outbound scheduler that honours the interval are tracked separately and will land in follow-up PRs against the same issue.

Closes #6345

Validation Evidence

cargo fmt --all -- --check
cargo clippy --workspace --exclude zeroclaw-desktop --all-targets --features ci-all -- -D warnings
cargo check --workspace --exclude zeroclaw-desktop

All three pass locally. Every existing TelegramConfig struct literal has the new field added (default 0); CI catches any new construction site that omits it.

Security & Privacy Impact

  • New permissions, capabilities, or filesystem access scope? No. The eventual scheduler is the actual safety lever; this commit only adds the schema surface.
  • New external network calls? No.
  • Secrets / tokens / credentials handling changed? No.
  • PII or real identities in diff, tests, fixtures, or docs? No.

Compatibility

  • Backward compatible? Yes. Default 0 preserves current behaviour byte-for-byte. Existing configs deserialize cleanly without the key set.
  • Config / env / CLI surface changed? Yes (additive). New reply_min_interval_secs key under [channels.telegram]. Same name will be added to other channels in follow-ups.

Rollback

git revert <merge-sha>. Schema-only diff; no runtime is wired to the field yet, so a revert is byte-equivalent to current behaviour.

First step of the zeroclaw-labs#6345 throttle. Adds the schema field on
TelegramConfig as a proof-of-concept for the broader rollout. The
field defaults to 0 (current behaviour preserved exactly) and is
gated to 0..=3600 by validation that lands in a follow-up commit.

Not in this commit (deliberately separate so the schema delta is
reviewable in isolation):

- Update every TelegramConfig struct-literal construction site to
  include the new field. CI will fail until this lands; that
  failure is the actionable list.
- Mirror the field on every other channel that supports outbound
  sends (Discord, Slack, Matrix, Signal, WhatsApp, etc.) per the
  issue's "Mirror in every channel that supports outbound sends"
  acceptance criterion.
- Range validation (0..=3600) at config load time.
- Per-conversation outbound scheduler that honors the interval
  (queue replies, dispatch with tokio::time::Instant for
  monotonic clock).
- Bounded per-conversation queue with overflow log + drop metric.
- Documentation entry in the channel section of the book.

Refs zeroclaw-labs#6345.
@singlerider singlerider added enhancement New feature or request channel Auto scope: src/channels/** changed. labels May 5, 2026
@singlerider singlerider self-assigned this May 5, 2026
@singlerider singlerider added config Auto scope: src/config/** changed. runtime Auto scope: src/runtime/** changed. labels May 5, 2026
@singlerider singlerider requested a review from Audacity88 May 5, 2026 04:20
@singlerider singlerider added risk: high Auto risk: security/runtime/gateway/tools/workflows. size: XS Auto size: <=80 non-doc changed lines. labels May 5, 2026
@github-actions github-actions Bot removed channel Auto scope: src/channels/** changed. config Auto scope: src/config/** changed. runtime Auto scope: src/runtime/** changed. labels May 5, 2026
…literals

CI surfaced 9 missing-field sites after the schema field add in the
previous commit. All TelegramConfig struct literals across daemon,
orchestrator, registry, config-mod, and three schema test fixtures
now set reply_min_interval_secs: 0 explicitly so the build compiles.

Sites fixed:
- crates/zeroclaw-runtime/src/daemon/mod.rs:1107, 1253, 1273
- crates/zeroclaw-channels/src/orchestrator/mod.rs:11802
- crates/zeroclaw-runtime/src/integrations/registry.rs:872
- src/config/mod.rs:73
- crates/zeroclaw-config/src/schema.rs:12330, 13235, 16657

Refs zeroclaw-labs#6345.
@github-actions github-actions Bot added docs Auto scope: docs/markdown/template files changed. config Auto scope: src/config/** changed. labels May 5, 2026
Two fixes on top of the schema field add:

* Drop the docs/book/theme/lang-switcher.js drive-by reorder. The file
  is generated by the mdbook build from locales.toml at the repo root,
  per its own header comment; manual edits are clobbered on next
  build. Reorder belongs in a standalone commit if at all.
* The original docstring claimed the field had load-time validation
  and a per-(channel, peer-jid) scheduler. Neither lands in this
  commit (per the PR body's own scope boundary). Rewrite the
  docstring so what it claims and what the code does match. The
  intended range and the follow-up sequencing are still documented;
  the false present-tense claims are gone.

Refs zeroclaw-labs#6345
@github-actions github-actions Bot removed the docs Auto scope: docs/markdown/template files changed. label May 5, 2026
@singlerider singlerider added this to the v0.7.5 milestone May 5, 2026
@singlerider singlerider changed the title feat(config/channels): add reply_min_interval_secs to TelegramConfig (#6345) feat(config/channels): add reply_min_interval_secs to TelegramConfig May 5, 2026
@singlerider singlerider marked this pull request as ready for review May 5, 2026 06:28
Copy link
Copy Markdown
Collaborator

@Audacity88 Audacity88 left a comment

Choose a reason for hiding this comment

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

Reviewed head a163123. I checked the fetched PR state, linked issue #6345, the existing #6345 triage comment, the full diff, the config-schema source around TelegramConfig, CI status at fetch time, and the relevant ZeroClaw review/docs/governance guidance. There are no prior PR comments, inline comments, or formal reviews. I did not run local cargo; CI is green. Local checks were git merge-tree --write-tree origin/master origin/pr/6389 and git diff --check origin/master...origin/pr/6389.

🟒 What looks good β€” the schema slice is narrow and default-safe

The actual code change is small and low-behavior-risk: reply_min_interval_secs is added to TelegramConfig with #[serde(default)], and every existing TelegramConfig struct literal is updated with 0. That preserves existing behavior for users who do not set the new key. The follow-up commits also cleaned up the stale present-tense docstring claims and removed the unrelated generated docs reorder, which keeps this PR focused.

πŸ”΄ Blocking β€” Closes #6345 would close work this PR explicitly defers

The PR body says this is only the Telegram schema-field slice. It explicitly defers mirroring the field to other outbound channels, load-time range validation, and the per-channel/per-peer outbound scheduler. The linked issue #6345 is broader than this PR: its acceptance criteria require the field across supported channels, 0..=3600 validation, delayed outbound delivery, bounded queue behavior, and docs.

If this merges with Closes #6345, GitHub will close the tracker even though the actual pacing behavior has not landed and the remaining acceptance criteria are still open. That would make the work look complete when the PR itself says it is only the first step.

Please either change this PR to Refs #6345 and keep #6345 open, or open/link concrete follow-up issues for the remaining scheduler, validation, cross-channel, queue, and docs work before closing the tracker. If the intent is for this PR to fully close #6345, then the remaining acceptance criteria need to land here.

🟑 Warning β€” validation evidence should include command output

The PR says fmt, clippy, and check all pass locally, but the validation section summarizes the results without command output. CI is green, so I am not treating this as a code blocker, but the section should paste the command output tails or explain why local output is intentionally omitted.

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

Labels

config Auto scope: src/config/** changed. enhancement New feature or request risk: high Auto risk: security/runtime/gateway/tools/workflows. size: XS Auto size: <=80 non-doc changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Per-channel reply-min-interval-secs (throttle outbound agent replies)

2 participants