Skip to content

chore(messaging): remove redundant manifest fields - #5994

Merged
jyaunches merged 16 commits into
mainfrom
chore/messaging-manifest-normalize
Jun 30, 2026
Merged

jyaunches merged 16 commits into
mainfrom
chore/messaging-manifest-normalize

Conversation

@sandl99

@sandl99 sandl99 commented Jun 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Remove redundant messaging manifest fields while preserving existing channel behavior.

This PR now covers the first schema cleanup slice for issue #5984:

  • input-level envAliases are removed from manifests and kept as internal compatibility metadata.
  • manifest-owned state.persist and state.rebuildHydration are removed because config inputs with statePath are durable by default.

Runtime envAliases, runtime visibility metadata, startup placeholder handling, and provider/runtime artifact validation are intentionally left unchanged.

Changes

  • Removed envAliases from the shared manifest input type and from Discord/Teams built-in inputs.
  • Kept legacy config env compatibility through the metadata helper used by channel config resolution.
  • Removed ChannelManifest.state, ChannelStateSpec, and all built-in state.persist / state.rebuildHydration blocks.
  • Changed planStateUpdates() to derive persist-inputs and rebuild-hydration entries from config inputs that declare statePath.
  • Added manifest regression tests proving built-in inputs no longer carry input aliases and all built-in config inputs are durable by default.
  • Updated the internal messaging README authoring model.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes — internal messaging README authoring text only.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — this narrowed PR changes messaging manifest metadata and preserves runtime/startup behavior.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • Git hooks passed during commit and push, or npx prek run --from-ref main --to-ref HEAD passes
  • Targeted tests pass for changed behavior: npx vitest run src/lib/messaging/channels src/lib/messaging/manifest src/lib/messaging/compiler src/lib/messaging-channel-config.test.ts
  • Full npm test passes (broad runtime changes only)
  • Type-check passed: npm run typecheck:cli
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: San Dang [email protected]

@sandl99 sandl99 self-assigned this Jun 29, 2026
@copy-pr-bot

copy-pr-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR removes envAliases from messaging contracts, manifests, compiler/runtime code, and startup paths. It adds credentialBindings-based provider placeholder handling, compat env-key resolution, derived state-update planning, and updated tests and docs.

Changes

envAliases → credentialBindings migration

Layer / File(s) Summary
Contracts, compat keys, and state planning
src/lib/messaging/manifest/types.ts, src/lib/messaging/channels/metadata.ts, src/lib/messaging-channel-config.ts, src/lib/messaging/compiler/engines/state-update-engine.ts, src/lib/messaging/provider-placeholders.ts, agents/hermes/runtime-config-guard.py, ci/test-file-size-budget.json
Messaging types drop envAliases, config metadata adds compat env-key mapping, channel config resolution switches to compat keys, state planning derives persist and rebuild-hydration updates from config inputs with state paths, and provider placeholder normalization/guarding is updated for credentialBindings and scoped placeholders.
Runtime setup and placeholder normalization
src/lib/messaging/compiler/engines/runtime-setup-engine.ts, src/lib/messaging/applier/build/messaging-build-applier.mts, src/lib/messaging/applier/host-state-applier.ts, src/lib/messaging/applier/setup-applier.ts, src/lib/messaging/compiler/workflow-planner.ts, src/lib/messaging/persistence.ts, src/lib/messaging/plan-validation.ts, agents/hermes/Dockerfile
Runtime setup planning, merging, filtering, normalization, persistence, and validation no longer carry envAliases, while build sanitization and Hermes guard logic use credentialBindings and scoped placeholder matching.
Channel manifests and manifest metadata
src/lib/messaging/channels/discord/manifest.ts, src/lib/messaging/channels/slack/manifest.ts, src/lib/messaging/channels/teams/manifest.ts, src/lib/messaging/channels/telegram/manifest.ts, src/lib/messaging/channels/wechat/manifest.ts, src/lib/messaging/channels/whatsapp/manifest.ts, src/lib/messaging/channels/manifests.test.ts, src/lib/messaging/channels/metadata.ts, src/lib/messaging/channels/metadata.test.ts, src/lib/messaging/channels/manifest-runtime-metadata.test.ts, src/lib/messaging/channels/telegram/hooks/allowlist-aliases.ts, src/lib/messaging/channels/telegram/hooks/allowlist-aliases.test.ts
Channel manifests remove envAliases and state hydration wiring, OpenClaw runtime blocks are simplified, and manifest metadata tests switch to compat-key and state-update assertions with derived visibility helpers and allowlist alias warnings.
Startup script and runtime placeholder flow
scripts/nemoclaw-start.sh, test/nemoclaw-start*.test.ts, test/nemoclaw-start-slack-runtime.test.ts, test/hermes-runtime-api-key.test.ts, test/messaging-build-applier.test.ts
The startup script switches from env aliases to credential bindings, validates provider placeholders, exports provider env vars during startup, and updates both non-root and root execution paths to call the placeholder applier; matching runtime-plan and placeholder tests are updated.
Tests, docs, and fixtures
src/lib/messaging/compiler/manifest-compiler.test.ts, src/lib/messaging/plan-validation.test.ts, src/lib/onboard/machine/handlers/sandbox-messaging.ts, src/lib/onboard/machine/handlers/sandbox-messaging.test.ts, test/canonical-credential-resolution.test.ts, docs/manage-sandboxes/messaging-channels.mdx, src/lib/messaging/README.md, src/lib/messaging/provider-placeholders.test.ts, src/lib/messaging-channel-config.test.ts
Compiler, onboarding, canonical-resolution, plan-validation, README, and messaging-channel docs are updated to match the new credentialBindings, compat-key, and reduced runtime plan shapes, alongside supporting allowlist, config-resolution, and provider-placeholder tests.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~90 minutes

Possibly related issues

Suggested labels

refactor

Suggested reviewers

  • cjagwani
  • ericksoa
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 1.45% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately captures the main messaging-manifest cleanup in this changeset.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/messaging-manifest-normalize

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

github-code-quality Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in the chore/messaging-mani... branch is 96%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main chore/messaging-mani... cc4b00d +/-
nemoclaw/src/se...cret-scanner.ts — 100% —
nemoclaw/src/commands/slash.ts — 100% —
nemoclaw/src/li...bprocess-env.ts — 100% —
nemoclaw/src/bl...eprint/state.ts — 98% —
nemoclaw/src/onboard/config.ts — 98% —
nemoclaw/src/bl...int/snapshot.ts — 97% —
nemoclaw/src/bl...print/runner.ts — 95% —
nemoclaw/src/co...ration-state.ts — 94% —
nemoclaw/src/bl...ate-networks.ts — 94% —
nemoclaw/src/index.ts — 94% —

TypeScript / code-coverage/cli

The overall coverage in the chore/messaging-mani... branch is 68%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main chore/messaging-mani... cc4b00d +/-
src/lib/actions...all/run-plan.ts — 80% —
src/lib/state/o...oard-session.ts — 79% —
src/lib/actions...dbox/rebuild.ts — 74% —
src/lib/state/sandbox.ts — 72% —
src/lib/shields/index.ts — 70% —
src/lib/onboard/preflight.ts — 69% —
src/lib/actions...licy-channel.ts — 60% —
src/lib/onboard...er-gpu-patch.ts — 59% —
src/lib/policy/index.ts — 52% —
src/lib/onboard.ts — 20% —

Updated June 30, 2026 12:54 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

Copy link
Copy Markdown
Contributor

@sandl99
sandl99 marked this pull request as ready for review June 29, 2026 13:20
@github-actions

github-actions Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: channels-add-remove, channels-stop-start, messaging-compatible-endpoint
Optional E2E: messaging-providers, openclaw-slack-pairing, openclaw-discord-pairing

Dispatch hint: channels-add-remove,channels-stop-start,messaging-compatible-endpoint

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • channels-add-remove (high): Required because the PR changes messaging state persistence and rebuild hydration. This job drives real channels add telegram, rebuild, channels remove telegram, and another rebuild, then verifies registry plan, provider, policy, and in-sandbox OpenClaw config state.
  • channels-stop-start (high): Required because the state-update refactor affects persisted channel plans and disabled-channel transitions. This job validates stop/start lifecycle behavior for the built-in messaging channels across both OpenClaw and Hermes, including registry state, providers, policy entries, and rendered agent config.
  • messaging-compatible-endpoint (medium): Required because manifest/config/env changes can affect non-interactive onboarding of a messaging-enabled OpenClaw sandbox. This job validates Telegram-enabled onboarding through the real CLI/OpenShell boundary, policy/config rendering, provider registration, and inference.local routing.

Optional E2E

  • messaging-providers (high): Useful adjacent confidence for Telegram and Discord provider creation, credential isolation, network reachability, config patching, and L7 proxy behavior after manifest and metadata changes.
  • openclaw-slack-pairing (high): Optional targeted live confidence for Slack because the Slack manifest lost explicit state declarations and now relies on statePath-derived persistence.
  • openclaw-discord-pairing (high): Optional targeted live confidence for Discord legacy alias/config behavior and Discord channel rendering after manifest envAliases moved to metadata.

New E2E recommendations

  • messaging rebuild hydration (high): Existing live coverage exercises Telegram rebuild hydration and stop/start for several channels, but the refactor applies to all built-in config inputs. A dedicated all-channel hydration test would catch missing statePath/envKey mappings for Slack allowed channels, Discord guild settings, WeChat account/base URL, WhatsApp allowlists, and Teams host-forward config.
    • Suggested test: messaging-rebuild-hydration-all-channels
  • Teams messaging lifecycle (high): Teams has host-forward and compatibility alias behavior that is not covered by the current channels-stop-start channel list. The changed state derivation and metadata aliases can affect Teams webhookPort/appId/tenantId persistence and conflict checks.
    • Suggested test: teams-channel-lifecycle-e2e

Dispatch hint

  • Workflow: .github/workflows/e2e.yaml
  • jobs input: channels-add-remove,channels-stop-start,messaging-compatible-endpoint

@github-actions

github-actions Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Recommendation

Required Vitest E2E scenarios: onboard-resume-vitest, onboard-repair-vitest, messaging-providers-vitest, hermes-slack-vitest, hermes-discord-vitest
Optional Vitest E2E scenarios: messaging-compatible-endpoint-vitest

Dispatch required Vitest E2E scenarios:

  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=onboard-resume-vitest
  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=onboard-repair-vitest
  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=messaging-providers-vitest
  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=hermes-slack-vitest
  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=hermes-discord-vitest

Workflow run

Full Vitest E2E advisor summary

Vitest E2E Scenario Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required Vitest E2E scenarios

  • onboard-resume-vitest: Changes touch src/lib/onboard/machine/handlers/sandbox-messaging.ts and shared messaging config hydration/compatibility, which can affect onboarding state-machine resume behavior. The onboarding resume compatibility rule requires this live Vitest job.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=onboard-resume-vitest
  • onboard-repair-vitest: The same onboarding sandbox-messaging and persisted messaging config changes can affect repair/backstop execution from persisted sessions, so repair is required alongside resume for these state-machine paths.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=onboard-repair-vitest
  • messaging-providers-vitest: Broad messaging provider, manifest, compiler, plan-validation, persistence, and provider-placeholder changes need the focused live messaging provider coverage for Telegram/Discord/Slack credential binding, placeholder, and compatibility-env behavior.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=messaging-providers-vitest
  • hermes-slack-vitest: Hermes Dockerfile/runtime-config-guard and Slack manifest/provider-placeholder changes affect xoxb/xapp scoped placeholder normalization and Hermes secret-boundary/runtime startup behavior; this job directly exercises that surface.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=hermes-slack-vitest
  • hermes-discord-vitest: Discord manifest and shared compatibility-env mapping changes, plus Hermes runtime credential binding handling, are exercised by the Hermes Discord live job, including provider placeholder isolation and rebuild/runtime contracts.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=hermes-discord-vitest

Optional Vitest E2E scenarios

  • messaging-compatible-endpoint-vitest: Adjacent OpenClaw messaging coverage for Telegram config with a compatible endpoint and fake provider tokens; useful because the PR changes OpenClaw entrypoint provider-placeholder refresh and channel config compatibility, but it is not the primary provider/repair surface.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=messaging-compatible-endpoint-vitest

Relevant changed files

  • agents/hermes/Dockerfile
  • agents/hermes/runtime-config-guard.py
  • scripts/nemoclaw-start.sh
  • src/lib/messaging-channel-config.ts
  • src/lib/messaging/applier/build/messaging-build-applier.mts
  • src/lib/messaging/applier/host-state-applier.ts
  • src/lib/messaging/applier/setup-applier.ts
  • src/lib/messaging/channels/discord/manifest.ts
  • src/lib/messaging/channels/metadata.ts
  • src/lib/messaging/channels/slack/manifest.ts
  • src/lib/messaging/channels/teams/manifest.ts
  • src/lib/messaging/channels/telegram/hooks/allowlist-aliases.ts
  • src/lib/messaging/channels/telegram/manifest.ts
  • src/lib/messaging/channels/wechat/manifest.ts
  • src/lib/messaging/channels/whatsapp/manifest.ts
  • src/lib/messaging/compiler/engines/runtime-setup-engine.ts
  • src/lib/messaging/compiler/engines/state-update-engine.ts
  • src/lib/messaging/compiler/workflow-planner.ts
  • src/lib/messaging/manifest/types.ts
  • src/lib/messaging/persistence.ts
  • src/lib/messaging/plan-validation.ts
  • src/lib/messaging/provider-placeholders.ts
  • src/lib/onboard/machine/handlers/sandbox-messaging.ts

@github-actions

github-actions Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor (Nemotron Ultra) — Changes requested

Merge posture: Do not merge yet
Primary next action: Resolve or justify PRA-1: Source-of-truth review needed: CONFIG_ENV_ALIASES_BY_ENV_KEY in metadata.ts:13-22.
Open items: 0 required · 7 warnings · 2 suggestions · 8 test follow-ups
Since last review: 0 prior items resolved · 7 still apply · 0 new items found

Action checklist

  • PRA-1 Resolve or justify: Source-of-truth review needed: CONFIG_ENV_ALIASES_BY_ENV_KEY in metadata.ts:13-22
  • PRA-2 Resolve or justify: Source-of-truth review needed: TEAMS_CLIENT_SECRET documentation in docs/manage-sandboxes/messaging-channels.mdx:114
  • PRA-3 Resolve or justify: CONFIG_ENV_ALIASES_BY_ENV_KEY lacks origin documentation and historical completeness test in src/lib/messaging/channels/metadata.ts:13
  • PRA-4 Resolve or justify: TEAMS_CLIENT_SECRET documented as functional alias but is render-only in docs/manage-sandboxes/messaging-channels.mdx:114
  • PRA-5 Resolve or justify: planStateUpdates() tests missing for Telegram, Discord, WhatsApp manifests in src/lib/messaging/channels/manifests.test.ts:520
  • PRA-6 Resolve or justify: No negative/edge-case tests for planStateUpdates() pure function in src/lib/messaging/compiler/engines/state-update-engine.ts:1
  • PRA-7 Resolve or justify: manifests.test.ts monolith growth (+58 lines, now 873) in src/lib/messaging/channels/manifests.test.ts:1
  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Runtime validation
  • PRA-T3 Add or justify test follow-up: Runtime validation
  • PRA-T4 Add or justify test follow-up: Runtime validation
  • PRA-T5 Add or justify test follow-up: Runtime validation
  • PRA-T6 Add or justify test follow-up: No negative/edge-case tests for planStateUpdates() pure function
  • PRA-T7 Add or justify test follow-up: Acceptance clause
  • PRA-T8 Add or justify test follow-up: CONFIG_ENV_ALIASES_BY_ENV_KEY in metadata.ts:13-22
  • PRA-8 In-scope improvement: State-update engine reduces trusted code surface — security improvement in src/lib/messaging/compiler/engines/state-update-engine.ts:1
  • PRA-9 In-scope improvement: Centralized CONFIG_ENV_ALIASES_BY_ENV_KEY prevents alias drift — security improvement in src/lib/messaging/channels/metadata.ts:13

Findings index

ID Severity Category Location Required action
PRA-1 Resolve/justify architecture — Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
PRA-2 Resolve/justify architecture — Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
PRA-3 Resolve/justify architecture src/lib/messaging/channels/metadata.ts:13 Add a comment above CONFIG_ENV_ALIASES_BY_ENV_KEY documenting each alias's origin (PR/issue). Add a test in metadata.test.ts that enumerates all historical config env var names from git log of manifest files and asserts each is either a current envKey or listed as an alias in the map.
PRA-4 Resolve/justify docs docs/manage-sandboxes/messaging-channels.mdx:114 Update documentation to clarify: functional config aliases are DISCORD_SERVER_IDS, DISCORD_ALLOWED_IDS, TEAMS_CLIENT_ID, TEAMS_TENANT_ID, MSTEAMS_ALLOWED_USERS, TEAMS_PORT. TEAMS_CLIENT_SECRET is only used in Hermes .env render output and does not affect config resolution.
PRA-5 Resolve/justify correctness src/lib/messaging/channels/manifests.test.ts:520 Add planStateUpdates() assertions for telegramManifest, discordManifest, and whatsappManifest matching the pattern at lines 520, 571, 825. Use the old manifest.state structures (from git history) as expected values.
PRA-6 Resolve/justify tests src/lib/messaging/compiler/engines/state-update-engine.ts:1 Add focused unit tests for state-update-engine.ts covering the four edge cases above. Create a new state-update-engine.test.ts file.
PRA-7 Resolve/justify architecture src/lib/messaging/channels/manifests.test.ts:1 Extract per-channel manifest test suites into separate files (e.g., discord.manifest.test.ts, teams.manifest.test.ts, telegram.manifest.test.ts, etc.) with shared helpers in a common test utility. Can be a follow-up PR but should be tracked.
PRA-8 Improvement security src/lib/messaging/compiler/engines/state-update-engine.ts:1 No action needed. The simplification improves security posture by making invalid states impossible at the source.
PRA-9 Improvement security src/lib/messaging/channels/metadata.ts:13 No action needed. The centralization is a positive security change.
Review findings by urgency: 0 required fixes, 7 items to resolve/justify, 2 in-scope improvements

⚠️ Resolve or justify before merge

Investigate these in the current review; either fix them, explain why they are not applicable, or document the accepted risk.

PRA-1 Resolve/justify — Source-of-truth review needed: CONFIG_ENV_ALIASES_BY_ENV_KEY in metadata.ts:13-22

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: metadata.test.ts asserts getMessagingConfigEnvAliases() output. Missing: test that historical aliases from git log are all covered.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: CONFIG_ENV_ALIASES_BY_ENV_KEY at metadata.ts:13-22 covers 6 aliases. No origin comments. metadata.test.ts:91-97 tests current output but not historical completeness.

PRA-2 Resolve/justify — Source-of-truth review needed: TEAMS_CLIENT_SECRET documentation in docs/manage-sandboxes/messaging-channels.mdx:114

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: No automated test; doc review needed.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: docs/manage-sandboxes/messaging-channels.mdx:114 lists TEAMS_CLIENT_SECRET as alias. Not in CONFIG_ENV_ALIASES_BY_ENV_KEY. Only in teams/manifest.ts Hermes render lines.

PRA-3 Resolve/justify — CONFIG_ENV_ALIASES_BY_ENV_KEY lacks origin documentation and historical completeness test

  • Location: src/lib/messaging/channels/metadata.ts:13
  • Category: architecture
  • Problem: The centralized alias map covers 6 aliases (DISCORD_SERVER_ID, DISCORD_USER_ID, MSTEAMS_APP_ID, MSTEAMS_TENANT_ID, TEAMS_ALLOWED_USERS, MSTEAMS_PORT) but has no comments documenting which PR/issue introduced each alias. No test verifies historical completeness against git history of manifest files.
  • Impact: Future maintainers cannot trace why each alias exists; risk of accidentally removing a still-needed compatibility alias or missing a historical alias that should be supported.
  • Recommended action: Add a comment above CONFIG_ENV_ALIASES_BY_ENV_KEY documenting each alias's origin (PR/issue). Add a test in metadata.test.ts that enumerates all historical config env var names from git log of manifest files and asserts each is either a current envKey or listed as an alias in the map.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Check metadata.ts:13-22 for origin comments. Check metadata.test.ts for a test that validates historical completeness against git log of manifest files.
  • Missing regression test: Test in metadata.test.ts enumerating all historical config env var names from git history of manifest files, asserting each is either a current envKey or an alias in CONFIG_ENV_ALIASES_BY_ENV_KEY.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Check metadata.ts:13-22 for origin comments. Check metadata.test.ts for a test that validates historical completeness against git log of manifest files.
  • Evidence: CONFIG_ENV_ALIASES_BY_ENV_KEY at metadata.ts:13-22 covers 6 aliases. No origin comments. metadata.test.ts:91-97 tests current output but not historical completeness.

PRA-4 Resolve/justify — TEAMS_CLIENT_SECRET documented as functional alias but is render-only

  • Location: docs/manage-sandboxes/messaging-channels.mdx:114
  • Category: docs
  • Problem: Documentation lists TEAMS_CLIENT_SECRET as a usable alias alongside TEAMS_CLIENT_ID and TEAMS_TENANT_ID. However, TEAMS_CLIENT_SECRET is only used in the Hermes render output (teams-hermes-env) and is not in CONFIG_ENV_ALIASES_BY_ENV_KEY, so it does not participate in config resolution or validation.
  • Impact: Operators may believe TEAMS_CLIENT_SECRET works as a config environment variable for onboarding/rebuild, but it only affects Hermes .env render output. This causes confusion and failed configurations.
  • Recommended action: Update documentation to clarify: functional config aliases are DISCORD_SERVER_IDS, DISCORD_ALLOWED_IDS, TEAMS_CLIENT_ID, TEAMS_TENANT_ID, MSTEAMS_ALLOWED_USERS, TEAMS_PORT. TEAMS_CLIENT_SECRET is only used in Hermes .env render output and does not affect config resolution.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Check docs/manage-sandboxes/messaging-channels.mdx:114 and compare with CONFIG_ENV_ALIASES_BY_ENV_KEY in metadata.ts:13-22.
  • Missing regression test: Documentation accuracy review; no automated test needed.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Check docs/manage-sandboxes/messaging-channels.mdx:114 and compare with CONFIG_ENV_ALIASES_BY_ENV_KEY in metadata.ts:13-22.
  • Evidence: docs/manage-sandboxes/messaging-channels.mdx:114 lists TEAMS_CLIENT_SECRET as alias. Not in CONFIG_ENV_ALIASES_BY_ENV_KEY. Only in teams/manifest.ts Hermes render lines.

PRA-5 Resolve/justify — planStateUpdates() tests missing for Telegram, Discord, WhatsApp manifests

  • Location: src/lib/messaging/channels/manifests.test.ts:520
  • Category: correctness
  • Problem: Tests assert planStateUpdates() output matches expected persist/hydration structure for Slack (line 520), WeChat (line 571), and Teams (line 825) only. Telegram, Discord, and WhatsApp lack these assertions, leaving 3 of 6 channels without regression coverage for the new derived state logic.
  • Impact: If planStateUpdates() derivation logic regresses or manifest inputs drift, the affected channels could lose persisted state or rebuild hydration silently.
  • Recommended action: Add planStateUpdates() assertions for telegramManifest, discordManifest, and whatsappManifest matching the pattern at lines 520, 571, 825. Use the old manifest.state structures (from git history) as expected values.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Check manifests.test.ts for expect(planStateUpdates(telegramManifest)).toEqual([...]), expect(planStateUpdates(discordManifest)).toEqual([...]), expect(planStateUpdates(whatsappManifest)).toEqual([...]) with correct persist-inputs and rebuild-hydration entries.
  • Missing regression test: Three test assertions: one each for telegramManifest, discordManifest, whatsappManifest validating planStateUpdates() output against historically expected state structure.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Check manifests.test.ts for expect(planStateUpdates(telegramManifest)).toEqual([...]), expect(planStateUpdates(discordManifest)).toEqual([...]), expect(planStateUpdates(whatsappManifest)).toEqual([...]) with correct persist-inputs and rebuild-hydration entries.
  • Evidence: manifests.test.ts shows planStateUpdates() tested only for slack (line 520), wechat (571), teams (825). No assertions for telegram, discord, whatsapp.

PRA-6 Resolve/justify — No negative/edge-case tests for planStateUpdates() pure function

  • Location: src/lib/messaging/compiler/engines/state-update-engine.ts:1
  • Category: tests
  • Problem: planStateUpdates() is a new pure derivation function with no tests for: (a) config input with statePath but no envKey → no rebuild-hydration entry, (b) statePath without dot (e.g., 'foo') → stateKey='foo', (c) multiple inputs mapping to same stateKey prefix → grouped persist-inputs, (d) empty inputs array → empty result.
  • Impact: Edge-case behavior is correct by code inspection but untested; future refactors could introduce regressions in grouping or hydration logic.
  • Recommended action: Add focused unit tests for state-update-engine.ts covering the four edge cases above. Create a new state-update-engine.test.ts file.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Run vitest on a new state-update-engine.test.ts file with the edge cases listed.
  • Missing regression test: Four unit tests in a new state-update-engine.test.ts file covering: (a) config input with statePath but no envKey → no rebuild-hydration entry, (b) statePath='foo' → stateKey='foo', (c) two inputs with same stateKey prefix → grouped persist-inputs, (d) empty inputs array → empty result.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Run vitest on a new state-update-engine.test.ts file with the edge cases listed.
  • Evidence: state-update-engine.ts has no corresponding test file. Function handles 4 distinct code paths with no test coverage.

PRA-7 Resolve/justify — manifests.test.ts monolith growth (+58 lines, now 873)

  • Location: src/lib/messaging/channels/manifests.test.ts:1
  • Category: architecture
  • Problem: The test file grew by 58 lines in this PR (from 815 to 873), exceeding the 20-line monolith growth threshold. It contains all 6 channel manifest test suites in one file with significant duplication.
  • Impact: Test file is becoming unwieldy; changes to one channel's tests risk affecting others; harder to navigate and maintain.
  • Recommended action: Extract per-channel manifest test suites into separate files (e.g., discord.manifest.test.ts, teams.manifest.test.ts, telegram.manifest.test.ts, etc.) with shared helpers in a common test utility. Can be a follow-up PR but should be tracked.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Check file line count and structure. Verify per-channel test files exist with shared helpers extracted.
  • Missing regression test: N/A — architecture/refactoring item.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Check file line count and structure. Verify per-channel test files exist with shared helpers extracted.
  • Evidence: manifests.test.ts is 873 lines after this change, up from 815. Contains all 6 channel test suites with duplicated patterns.

💡 In-scope improvements

These are lower-risk, not throwaway. Prefer fixing them in this PR when they are local to changed code; defer only with rationale or a linked follow-up.

PRA-8 Improvement — State-update engine reduces trusted code surface — security improvement

  • Location: src/lib/messaging/compiler/engines/state-update-engine.ts:1
  • Category: security
  • Problem: The new planStateUpdates() function derives state updates from manifest inputs rather than trusting a manifest-declared state block. This eliminates a potential drift vector where manifest.state could diverge from actual inputs. Positive security change.
  • Impact: Eliminates a class of bugs where declared persist/rebuildHydration could drift from actual input statePath declarations.
  • Suggested action: No action needed. The simplification improves security posture by making invalid states impossible at the source.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Compare old manifest.state structures with new planStateUpdates() output — they should be equivalent for all 6 channels.
  • Missing regression test: Already covered by planStateUpdates() assertions in manifests.test.ts for Slack, WeChat, Teams. Need coverage for Telegram, Discord, WhatsApp (see finding PRA-3).
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Old manifests had declarative state.persist/state.rebuildHydration blocks that could diverge from inputs[].statePath. New derivation computes directly from inputs.

PRA-9 Improvement — Centralized CONFIG_ENV_ALIASES_BY_ENV_KEY prevents alias drift — security improvement

  • Location: src/lib/messaging/channels/metadata.ts:13
  • Category: security
  • Problem: Moving aliases from per-input envAliases to a central map in metadata.ts ensures the alias list stays in sync with actual config env keys (filtered by envKeys.has). Eliminates drift where manifests could declare aliases for non-existent env keys. Positive security change.
  • Impact: Prevents configuration drift where manifests declare aliases for keys that don't exist as envKey on any input.
  • Suggested action: No action needed. The centralization is a positive security change.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Verify getMessagingConfigEnvAliases() filters CONFIG_ENV_ALIASES_BY_ENV_KEY by current envKeys from manifests.
  • Missing regression test: Already covered by metadata.test.ts alias assertions.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: getMessagingConfigEnvAliases() at metadata.ts:170-175 filters central map by envKeys.has(input.envKey).
Simplification opportunities: 2 possible cuts, net -80 lines possible

These are safe simplification checks only. Do not remove validation, security controls, data-loss prevention, or required tests.

  • PRA-8 delete (src/lib/messaging/compiler/engines/state-update-engine.ts:1): ChannelStateSpec, ChannelRebuildHydrationSpec types and manifest.state field
    • Replacement: planStateUpdates() pure derivation from inputs[].statePath
    • Net: -50 lines
    • Safety boundary: ManifestCompiler still validates plan against SandboxMessagingPlan schema; plan-validation.ts unchanged
  • PRA-9 native (src/lib/messaging/channels/metadata.ts:13): envAliases field from ChannelInputSpec and per-manifest alias declarations
    • Replacement: Single CONFIG_ENV_ALIASES_BY_ENV_KEY map filtered by actual manifest envKeys
    • Net: -30 lines
    • Safety boundary: messaging-channel-config.ts alias resolution unchanged; only internal metadata source changed
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — state-update-engine.test.ts: config input with statePath but no envKey → no rebuild-hydration entry. Changed paths include messaging-channel-config.ts, all 6 channel manifests, metadata.ts — these affect onboarding, rebuild hydration, config resolution. New pure function planStateUpdates() lacks unit tests. Targeted integration test for rebuild hydration round-trip recommended.
  • PRA-T2 Runtime validation — state-update-engine.test.ts: statePath='foo' (no dot) → stateKey='foo'. Changed paths include messaging-channel-config.ts, all 6 channel manifests, metadata.ts — these affect onboarding, rebuild hydration, config resolution. New pure function planStateUpdates() lacks unit tests. Targeted integration test for rebuild hydration round-trip recommended.
  • PRA-T3 Runtime validation — state-update-engine.test.ts: two inputs with same stateKey prefix → grouped persist-inputs. Changed paths include messaging-channel-config.ts, all 6 channel manifests, metadata.ts — these affect onboarding, rebuild hydration, config resolution. New pure function planStateUpdates() lacks unit tests. Targeted integration test for rebuild hydration round-trip recommended.
  • PRA-T4 Runtime validation — state-update-engine.test.ts: empty inputs array → empty result. Changed paths include messaging-channel-config.ts, all 6 channel manifests, metadata.ts — these affect onboarding, rebuild hydration, config resolution. New pure function planStateUpdates() lacks unit tests. Targeted integration test for rebuild hydration round-trip recommended.
  • PRA-T5 Runtime validation — manifests.test.ts: planStateUpdates(telegramManifest) assertion using historical manifest.state. Changed paths include messaging-channel-config.ts, all 6 channel manifests, metadata.ts — these affect onboarding, rebuild hydration, config resolution. New pure function planStateUpdates() lacks unit tests. Targeted integration test for rebuild hydration round-trip recommended.
  • PRA-T6 No negative/edge-case tests for planStateUpdates() pure function — Add focused unit tests for state-update-engine.ts covering the four edge cases above. Create a new state-update-engine.test.ts file.
  • PRA-T7 Acceptance clause — Document TEAMS_CLIENT_SECRET as render-only (not functional config alias) — add test evidence or identify existing coverage. Docs still list TEAMS_CLIENT_SECRET as functional alias at mdx:114; not updated to clarify render-only nature
  • PRA-T8 CONFIG_ENV_ALIASES_BY_ENV_KEY in metadata.ts:13-22 — metadata.test.ts asserts getMessagingConfigEnvAliases() output. Missing: test that historical aliases from git log are all covered.. CONFIG_ENV_ALIASES_BY_ENV_KEY at metadata.ts:13-22 covers 6 aliases. No origin comments. metadata.test.ts:91-97 tests current output but not historical completeness.
Since last review details

Current findings, using the urgency labels above:

PRA-1 Resolve/justify — Source-of-truth review needed: CONFIG_ENV_ALIASES_BY_ENV_KEY in metadata.ts:13-22

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: metadata.test.ts asserts getMessagingConfigEnvAliases() output. Missing: test that historical aliases from git log are all covered.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: CONFIG_ENV_ALIASES_BY_ENV_KEY at metadata.ts:13-22 covers 6 aliases. No origin comments. metadata.test.ts:91-97 tests current output but not historical completeness.

PRA-2 Resolve/justify — Source-of-truth review needed: TEAMS_CLIENT_SECRET documentation in docs/manage-sandboxes/messaging-channels.mdx:114

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: No automated test; doc review needed.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: docs/manage-sandboxes/messaging-channels.mdx:114 lists TEAMS_CLIENT_SECRET as alias. Not in CONFIG_ENV_ALIASES_BY_ENV_KEY. Only in teams/manifest.ts Hermes render lines.

PRA-3 Resolve/justify — CONFIG_ENV_ALIASES_BY_ENV_KEY lacks origin documentation and historical completeness test

  • Location: src/lib/messaging/channels/metadata.ts:13
  • Category: architecture
  • Problem: The centralized alias map covers 6 aliases (DISCORD_SERVER_ID, DISCORD_USER_ID, MSTEAMS_APP_ID, MSTEAMS_TENANT_ID, TEAMS_ALLOWED_USERS, MSTEAMS_PORT) but has no comments documenting which PR/issue introduced each alias. No test verifies historical completeness against git history of manifest files.
  • Impact: Future maintainers cannot trace why each alias exists; risk of accidentally removing a still-needed compatibility alias or missing a historical alias that should be supported.
  • Recommended action: Add a comment above CONFIG_ENV_ALIASES_BY_ENV_KEY documenting each alias's origin (PR/issue). Add a test in metadata.test.ts that enumerates all historical config env var names from git log of manifest files and asserts each is either a current envKey or listed as an alias in the map.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Check metadata.ts:13-22 for origin comments. Check metadata.test.ts for a test that validates historical completeness against git log of manifest files.
  • Missing regression test: Test in metadata.test.ts enumerating all historical config env var names from git history of manifest files, asserting each is either a current envKey or an alias in CONFIG_ENV_ALIASES_BY_ENV_KEY.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Check metadata.ts:13-22 for origin comments. Check metadata.test.ts for a test that validates historical completeness against git log of manifest files.
  • Evidence: CONFIG_ENV_ALIASES_BY_ENV_KEY at metadata.ts:13-22 covers 6 aliases. No origin comments. metadata.test.ts:91-97 tests current output but not historical completeness.

PRA-4 Resolve/justify — TEAMS_CLIENT_SECRET documented as functional alias but is render-only

  • Location: docs/manage-sandboxes/messaging-channels.mdx:114
  • Category: docs
  • Problem: Documentation lists TEAMS_CLIENT_SECRET as a usable alias alongside TEAMS_CLIENT_ID and TEAMS_TENANT_ID. However, TEAMS_CLIENT_SECRET is only used in the Hermes render output (teams-hermes-env) and is not in CONFIG_ENV_ALIASES_BY_ENV_KEY, so it does not participate in config resolution or validation.
  • Impact: Operators may believe TEAMS_CLIENT_SECRET works as a config environment variable for onboarding/rebuild, but it only affects Hermes .env render output. This causes confusion and failed configurations.
  • Recommended action: Update documentation to clarify: functional config aliases are DISCORD_SERVER_IDS, DISCORD_ALLOWED_IDS, TEAMS_CLIENT_ID, TEAMS_TENANT_ID, MSTEAMS_ALLOWED_USERS, TEAMS_PORT. TEAMS_CLIENT_SECRET is only used in Hermes .env render output and does not affect config resolution.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Check docs/manage-sandboxes/messaging-channels.mdx:114 and compare with CONFIG_ENV_ALIASES_BY_ENV_KEY in metadata.ts:13-22.
  • Missing regression test: Documentation accuracy review; no automated test needed.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Check docs/manage-sandboxes/messaging-channels.mdx:114 and compare with CONFIG_ENV_ALIASES_BY_ENV_KEY in metadata.ts:13-22.
  • Evidence: docs/manage-sandboxes/messaging-channels.mdx:114 lists TEAMS_CLIENT_SECRET as alias. Not in CONFIG_ENV_ALIASES_BY_ENV_KEY. Only in teams/manifest.ts Hermes render lines.

PRA-5 Resolve/justify — planStateUpdates() tests missing for Telegram, Discord, WhatsApp manifests

  • Location: src/lib/messaging/channels/manifests.test.ts:520
  • Category: correctness
  • Problem: Tests assert planStateUpdates() output matches expected persist/hydration structure for Slack (line 520), WeChat (line 571), and Teams (line 825) only. Telegram, Discord, and WhatsApp lack these assertions, leaving 3 of 6 channels without regression coverage for the new derived state logic.
  • Impact: If planStateUpdates() derivation logic regresses or manifest inputs drift, the affected channels could lose persisted state or rebuild hydration silently.
  • Recommended action: Add planStateUpdates() assertions for telegramManifest, discordManifest, and whatsappManifest matching the pattern at lines 520, 571, 825. Use the old manifest.state structures (from git history) as expected values.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Check manifests.test.ts for expect(planStateUpdates(telegramManifest)).toEqual([...]), expect(planStateUpdates(discordManifest)).toEqual([...]), expect(planStateUpdates(whatsappManifest)).toEqual([...]) with correct persist-inputs and rebuild-hydration entries.
  • Missing regression test: Three test assertions: one each for telegramManifest, discordManifest, whatsappManifest validating planStateUpdates() output against historically expected state structure.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Check manifests.test.ts for expect(planStateUpdates(telegramManifest)).toEqual([...]), expect(planStateUpdates(discordManifest)).toEqual([...]), expect(planStateUpdates(whatsappManifest)).toEqual([...]) with correct persist-inputs and rebuild-hydration entries.
  • Evidence: manifests.test.ts shows planStateUpdates() tested only for slack (line 520), wechat (571), teams (825). No assertions for telegram, discord, whatsapp.

PRA-6 Resolve/justify — No negative/edge-case tests for planStateUpdates() pure function

  • Location: src/lib/messaging/compiler/engines/state-update-engine.ts:1
  • Category: tests
  • Problem: planStateUpdates() is a new pure derivation function with no tests for: (a) config input with statePath but no envKey → no rebuild-hydration entry, (b) statePath without dot (e.g., 'foo') → stateKey='foo', (c) multiple inputs mapping to same stateKey prefix → grouped persist-inputs, (d) empty inputs array → empty result.
  • Impact: Edge-case behavior is correct by code inspection but untested; future refactors could introduce regressions in grouping or hydration logic.
  • Recommended action: Add focused unit tests for state-update-engine.ts covering the four edge cases above. Create a new state-update-engine.test.ts file.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Run vitest on a new state-update-engine.test.ts file with the edge cases listed.
  • Missing regression test: Four unit tests in a new state-update-engine.test.ts file covering: (a) config input with statePath but no envKey → no rebuild-hydration entry, (b) statePath='foo' → stateKey='foo', (c) two inputs with same stateKey prefix → grouped persist-inputs, (d) empty inputs array → empty result.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Run vitest on a new state-update-engine.test.ts file with the edge cases listed.
  • Evidence: state-update-engine.ts has no corresponding test file. Function handles 4 distinct code paths with no test coverage.

PRA-7 Resolve/justify — manifests.test.ts monolith growth (+58 lines, now 873)

  • Location: src/lib/messaging/channels/manifests.test.ts:1
  • Category: architecture
  • Problem: The test file grew by 58 lines in this PR (from 815 to 873), exceeding the 20-line monolith growth threshold. It contains all 6 channel manifest test suites in one file with significant duplication.
  • Impact: Test file is becoming unwieldy; changes to one channel's tests risk affecting others; harder to navigate and maintain.
  • Recommended action: Extract per-channel manifest test suites into separate files (e.g., discord.manifest.test.ts, teams.manifest.test.ts, telegram.manifest.test.ts, etc.) with shared helpers in a common test utility. Can be a follow-up PR but should be tracked.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Check file line count and structure. Verify per-channel test files exist with shared helpers extracted.
  • Missing regression test: N/A — architecture/refactoring item.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Check file line count and structure. Verify per-channel test files exist with shared helpers extracted.
  • Evidence: manifests.test.ts is 873 lines after this change, up from 815. Contains all 6 channel test suites with duplicated patterns.

PRA-8 Improvement — State-update engine reduces trusted code surface — security improvement

  • Location: src/lib/messaging/compiler/engines/state-update-engine.ts:1
  • Category: security
  • Problem: The new planStateUpdates() function derives state updates from manifest inputs rather than trusting a manifest-declared state block. This eliminates a potential drift vector where manifest.state could diverge from actual inputs. Positive security change.
  • Impact: Eliminates a class of bugs where declared persist/rebuildHydration could drift from actual input statePath declarations.
  • Suggested action: No action needed. The simplification improves security posture by making invalid states impossible at the source.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Compare old manifest.state structures with new planStateUpdates() output — they should be equivalent for all 6 channels.
  • Missing regression test: Already covered by planStateUpdates() assertions in manifests.test.ts for Slack, WeChat, Teams. Need coverage for Telegram, Discord, WhatsApp (see finding PRA-3).
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Old manifests had declarative state.persist/state.rebuildHydration blocks that could diverge from inputs[].statePath. New derivation computes directly from inputs.

PRA-9 Improvement — Centralized CONFIG_ENV_ALIASES_BY_ENV_KEY prevents alias drift — security improvement

  • Location: src/lib/messaging/channels/metadata.ts:13
  • Category: security
  • Problem: Moving aliases from per-input envAliases to a central map in metadata.ts ensures the alias list stays in sync with actual config env keys (filtered by envKeys.has). Eliminates drift where manifests could declare aliases for non-existent env keys. Positive security change.
  • Impact: Prevents configuration drift where manifests declare aliases for keys that don't exist as envKey on any input.
  • Suggested action: No action needed. The centralization is a positive security change.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Verify getMessagingConfigEnvAliases() filters CONFIG_ENV_ALIASES_BY_ENV_KEY by current envKeys from manifests.
  • Missing regression test: Already covered by metadata.test.ts alias assertions.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: getMessagingConfigEnvAliases() at metadata.ts:170-175 filters central map by envKeys.has(input.envKey).

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/lib/messaging/channels/manifests.test.ts (1)

196-221: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the derived-manifest assertions order-insensitive.

These helpers pin exact array ordering for derived metadata/state-update collections, so a harmless reordering in the planner or metadata helpers will fail the tests without changing the manifest contract. Sort or canonicalize before asserting to keep the coverage focused on behavior. As per path instructions, **/*.test.{ts,js,mts,mjs,cts,cjs}: Review tests for behavioral confidence rather than implementation lock-in.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/messaging/channels/manifests.test.ts` around lines 196 - 221, The
derived-manifest test helpers currently assert exact array order, which makes
`expectOpenClawRuntimeVisibility` and `expectStateUpdates` brittle to harmless
reordering. Update these assertions to compare normalized collections by sorting
or otherwise canonicalizing the results before calling `expect`, so the tests
continue to verify `listOpenClawManagedChannelNames`,
`listOpenClawRuntimeChannelMetadata`, and `planStateUpdates` behavior without
locking in implementation order.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@agents/hermes/Dockerfile`:
- Around line 187-193: The Hermes Dockerfile runtime artifact validation only
checks runtimeSetup, so the baked plan can still contain malformed
credentialBindings. Update the build-time guard in the RUN block that invokes
messaging-build-applier.mts to also validate credentialBindings as an array of
objects, requiring each item to have string channelId and providerEnvKey fields
plus an optional string placeholder, and fail closed if any entry is invalid so
the image build catches bad artifacts before runtime.

In `@agents/hermes/runtime-config-guard.py`:
- Around line 536-537: The placeholder handling in runtime-config-guard.py is
currently fail-open when multiple active runtime plan entries map to the same
providerEnvKey, because the first placeholder is kept silently. Update the logic
around the placeholder/replacements handling to detect a duplicate
providerEnvKey with a different placeholder and reject it immediately instead of
preserving the first value. Use the existing runtime placeholder processing path
and the replacements map to raise or otherwise fail closed when a conflict is
found so the shell entrypoint and plan order cannot diverge.

In `@scripts/nemoclaw-start.sh`:
- Around line 1731-1734: The deduplication in the credential binding collection
allows multiple placeholders for the same providerEnvKey, causing conflicting
exports between the shell path and the Hermes guard. Update the logic around
seen_credential_bindings and credential_bindings so uniqueness is enforced by
providerEnvKey alone, and if a duplicate providerEnvKey appears with a different
placeholder, reject it as a conflict instead of keeping both. Keep the behavior
fail-closed in the start script and preserve the existing binding processing
flow.

---

Nitpick comments:
In `@src/lib/messaging/channels/manifests.test.ts`:
- Around line 196-221: The derived-manifest test helpers currently assert exact
array order, which makes `expectOpenClawRuntimeVisibility` and
`expectStateUpdates` brittle to harmless reordering. Update these assertions to
compare normalized collections by sorting or otherwise canonicalizing the
results before calling `expect`, so the tests continue to verify
`listOpenClawManagedChannelNames`, `listOpenClawRuntimeChannelMetadata`, and
`planStateUpdates` behavior without locking in implementation order.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b3496362-111f-4df5-9fad-75d8cff1d3be

📥 Commits

Reviewing files that changed from the base of the PR and between c6113be and d3be21c.

📒 Files selected for processing (37)
  • agents/hermes/Dockerfile
  • agents/hermes/runtime-config-guard.py
  • ci/test-file-size-budget.json
  • docs/manage-sandboxes/messaging-channels.mdx
  • scripts/nemoclaw-start.sh
  • src/lib/messaging-channel-config.ts
  • src/lib/messaging/README.md
  • src/lib/messaging/applier/build/messaging-build-applier.mts
  • src/lib/messaging/applier/host-state-applier.ts
  • src/lib/messaging/applier/setup-applier.ts
  • src/lib/messaging/channels/discord/manifest.ts
  • src/lib/messaging/channels/manifests.test.ts
  • src/lib/messaging/channels/metadata.test.ts
  • src/lib/messaging/channels/metadata.ts
  • src/lib/messaging/channels/slack/manifest.ts
  • src/lib/messaging/channels/teams/manifest.ts
  • src/lib/messaging/channels/telegram/manifest.ts
  • src/lib/messaging/channels/wechat/manifest.ts
  • src/lib/messaging/channels/whatsapp/manifest.ts
  • src/lib/messaging/compiler/engines/runtime-setup-engine.ts
  • src/lib/messaging/compiler/engines/state-update-engine.ts
  • src/lib/messaging/compiler/manifest-compiler.test.ts
  • src/lib/messaging/compiler/workflow-planner.ts
  • src/lib/messaging/manifest/types.ts
  • src/lib/messaging/persistence.ts
  • src/lib/messaging/plan-validation.test.ts
  • src/lib/messaging/plan-validation.ts
  • src/lib/messaging/provider-placeholders.ts
  • src/lib/onboard/machine/handlers/sandbox-messaging.test.ts
  • src/lib/onboard/machine/handlers/sandbox-messaging.ts
  • test/canonical-credential-resolution.test.ts
  • test/hermes-runtime-api-key.test.ts
  • test/messaging-build-applier.test.ts
  • test/nemoclaw-start-runtime-env-alias.test.ts
  • test/nemoclaw-start-slack-runtime.test.ts
  • test/nemoclaw-start-telegram-runtime.test.ts
  • test/nemoclaw-start.test.ts
💤 Files with no reviewable changes (9)
  • test/nemoclaw-start-runtime-env-alias.test.ts
  • src/lib/messaging/applier/host-state-applier.ts
  • src/lib/messaging/plan-validation.ts
  • src/lib/onboard/machine/handlers/sandbox-messaging.ts
  • src/lib/onboard/machine/handlers/sandbox-messaging.test.ts
  • test/nemoclaw-start-telegram-runtime.test.ts
  • src/lib/messaging/compiler/workflow-planner.ts
  • src/lib/messaging/plan-validation.test.ts
  • src/lib/messaging/manifest/types.ts

Comment thread agents/hermes/Dockerfile Resolved
Comment thread agents/hermes/runtime-config-guard.py Resolved
Comment thread scripts/nemoclaw-start.sh Resolved
@github-actions

github-actions Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor — Changes requested

Merge posture: Do not merge yet
Primary next action: Resolve or justify PRA-1: Source-of-truth review needed: CONFIG_ENV_ALIASES_BY_ENV_KEY compatibility aliases.
Open items: 0 required · 5 warnings · 0 suggestions · 8 test follow-ups
Since last review: 0 prior items resolved · 3 still apply · 0 new items found

Action checklist

  • PRA-1 Resolve or justify: Source-of-truth review needed: CONFIG_ENV_ALIASES_BY_ENV_KEY compatibility aliases
  • PRA-2 Resolve or justify: Source-of-truth review needed: Derived state updates from config input statePath/envKey
  • PRA-3 Resolve or justify: Prove legacy Teams env alias behavior after removing input envAliases in src/lib/messaging/channels/metadata.ts:13
  • PRA-4 Resolve or justify: Cover and document the derived state-update contract for custom manifests in src/lib/messaging/compiler/engines/state-update-engine.ts:13
  • PRA-5 Resolve or justify: Define the source of truth and removal condition for compatibility aliases in src/lib/messaging/channels/metadata.ts:13
  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Runtime validation
  • PRA-T3 Add or justify test follow-up: Runtime validation
  • PRA-T4 Add or justify test follow-up: Runtime validation
  • PRA-T5 Add or justify test follow-up: Runtime validation
  • PRA-T6 Add or justify test follow-up: Acceptance clause
  • PRA-T7 Add or justify test follow-up: Acceptance clause
  • PRA-T8 Add or justify test follow-up: Acceptance clause

Findings index

ID Severity Category Location Required action
PRA-1 Resolve/justify architecture — Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
PRA-2 Resolve/justify architecture — Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
PRA-3 Resolve/justify security src/lib/messaging/channels/metadata.ts:13 Add behavior-level coverage for the actual config and compiler consumption paths, and either document/test that TEAMS_CLIENT_SECRET is intentionally unsupported or implement a safe credential-alias path if compatibility is required.
PRA-4 Resolve/justify correctness src/lib/messaging/compiler/engines/state-update-engine.ts:13 Add a focused state-update-engine test covering custom manifests and update the README/type-adjacent documentation to state that config statePath plus envKey is now the only source of truth, including first-segment persistence grouping. Prefer moving the new large built-in expected arrays out of manifests.test.ts into this focused test while keeping a small built-in smoke assertion.
PRA-5 Resolve/justify architecture src/lib/messaging/channels/metadata.ts:13 Document near CONFIG_ENV_ALIASES_BY_ENV_KEY or in the messaging README that these are legacy operator env names accepted only at config ingestion/compiler boundaries, list which aliases are intentionally excluded, and state when entries may be removed.
Review findings by urgency: 0 required fixes, 5 items to resolve/justify, 0 in-scope improvements

⚠️ Resolve or justify before merge

Investigate these in the current review; either fix them, explain why they are not applicable, or document the accepted risk.

PRA-1 Resolve/justify — Source-of-truth review needed: CONFIG_ENV_ALIASES_BY_ENV_KEY compatibility aliases

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: Partial: metadata.test.ts checks map shape, messaging-channel-config.test.ts covers Discord aliases and TEAMS_PORT. Missing behavior coverage for TEAMS_CLIENT_ID, TEAMS_TENANT_ID, MSTEAMS_ALLOWED_USERS, and the TEAMS_CLIENT_SECRET decision.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: metadata.ts introduces CONFIG_ENV_ALIASES_BY_ENV_KEY; messaging-channel-config.ts consumes it; teams/manifest.ts removes config aliases and the former TEAMS_CLIENT_SECRET secret alias.

PRA-2 Resolve/justify — Source-of-truth review needed: Derived state updates from config input statePath/envKey

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: Partial: built-in manifest tests assert some derived outputs. Missing focused custom-manifest tests for first-segment grouping, inputs without statePath, secret inputs, and envKey-based hydration.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: ChannelManifest.state is removed; planStateUpdates derives persist-inputs and rebuild-hydration from config inputs with statePath; README only summarizes stateUpdates as config inputs with statePath.

PRA-3 Resolve/justify — Prove legacy Teams env alias behavior after removing input envAliases

  • Location: src/lib/messaging/channels/metadata.ts:13
  • Category: security
  • Problem: The PR removes input-level envAliases from the manifest contract and Teams manifest, then preserves only config aliases through CONFIG_ENV_ALIASES_BY_ENV_KEY. Current tests assert the metadata shape and cover Discord aliases plus TEAMS_PORT, but they do not exercise the production resolver, hydration, or compiler paths for TEAMS_CLIENT_ID, TEAMS_TENANT_ID, or MSTEAMS_ALLOWED_USERS. The former secret alias TEAMS_CLIENT_SECRET is also removed and is not represented in the new compatibility path; manifest-compiler.ts resolves config inputs through resolveMessagingChannelConfigEnvValue but secret inputs still read only process.env[input.envKey].
  • Impact: Operators relying on legacy Teams environment names can silently lose app ID, tenant ID, allowlist, or client-secret compatibility. For Teams messaging setup this can cause failed enrollment/rebuilds or incomplete secure channel configuration; for the allowlist specifically, an unintended empty allowlist can weaken the expected channel access posture.
  • Recommended action: Add behavior-level coverage for the actual config and compiler consumption paths, and either document/test that TEAMS_CLIENT_SECRET is intentionally unsupported or implement a safe credential-alias path if compatibility is required.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Shortest read-only check: inspect src/lib/messaging-channel-config.test.ts for Teams alias cases and src/lib/messaging/compiler/manifest-compiler.ts readInputEnvValue; confirm config inputs use resolveMessagingChannelConfigEnvValue while secret inputs only check the canonical env key.
  • Missing regression test: Add tests named for the behaviors: readMessagingChannelConfigFromEnv canonicalizes TEAMS_CLIENT_ID TEAMS_TENANT_ID and MSTEAMS_ALLOWED_USERS; hydrateMessagingChannelConfig writes MSTEAMS_APP_ID MSTEAMS_TENANT_ID and TEAMS_ALLOWED_USERS from legacy Teams aliases; ManifestCompiler compiles Teams appId tenantId and allowedUsers from legacy Teams config aliases; and either TEAMS_CLIENT_SECRET alone does not satisfy Teams credential availability or TEAMS_CLIENT_SECRET resolves to MSTEAMS_APP_PASSWORD for Teams credential availability, matching the intended contract.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Shortest read-only check: inspect src/lib/messaging-channel-config.test.ts for Teams alias cases and src/lib/messaging/compiler/manifest-compiler.ts readInputEnvValue; confirm config inputs use resolveMessagingChannelConfigEnvValue while secret inputs only check the canonical env key.
  • Evidence: metadata.ts adds CONFIG_ENV_ALIASES_BY_ENV_KEY with Teams config aliases; teams/manifest.ts removes envAliases including TEAMS_CLIENT_SECRET; manifest-compiler.ts readInputEnvValue uses resolveMessagingChannelConfigEnvValue only for config inputs; messaging-channel-config.test.ts currently behavior-tests Discord aliases and Teams port only.

PRA-4 Resolve/justify — Cover and document the derived state-update contract for custom manifests

  • Location: src/lib/messaging/compiler/engines/state-update-engine.ts:13
  • Category: correctness
  • Problem: ChannelManifest.state was removed and planStateUpdates now derives persistence and rebuild hydration from every config input with statePath, grouping persist-inputs by the first segment of statePath and using input.envKey for rebuild hydration. Built-in manifest assertions were updated, and the README says stateUpdates come from config inputs with statePath, but there is no focused generic test for the new contract and the README does not explicitly spell out the first-segment grouping or the removal of independent state.persist/rebuildHydration control.
  • Impact: Manifest authors can miss that persistence/hydration is no longer independently configurable. A future or custom manifest that needs a hydration env different from its config envKey, or persistence grouping independent of the first statePath segment, would silently get different state behavior.
  • Recommended action: Add a focused state-update-engine test covering custom manifests and update the README/type-adjacent documentation to state that config statePath plus envKey is now the only source of truth, including first-segment persistence grouping. Prefer moving the new large built-in expected arrays out of manifests.test.ts into this focused test while keeping a small built-in smoke assertion.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Compare src/lib/messaging/manifest/types.ts removal of ChannelManifest.state with src/lib/messaging/compiler/engines/state-update-engine.ts planStateUpdates and src/lib/messaging/README.md around the stateUpdates and manifest authoring sections.
  • Missing regression test: Add planStateUpdates derives persist groups and rebuild hydration from config input statePath and envKey for custom manifests, including multiple inputs sharing one root, a config input without statePath being ignored, a secret input being ignored, and the emitted rebuild-hydration env matching input.envKey.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Compare src/lib/messaging/manifest/types.ts removal of ChannelManifest.state with src/lib/messaging/compiler/engines/state-update-engine.ts planStateUpdates and src/lib/messaging/README.md around the stateUpdates and manifest authoring sections.
  • Evidence: types.ts removes ChannelStateSpec and ChannelManifest.state; all built-in state blocks are deleted; state-update-engine.ts groups by statePath.split('.', 1)[0] and emits rebuild-hydration from input.envKey; manifests.test.ts adds built-in planStateUpdates expectations but no focused generic engine test exists.

PRA-5 Resolve/justify — Define the source of truth and removal condition for compatibility aliases

  • Location: src/lib/messaging/channels/metadata.ts:13
  • Category: architecture
  • Problem: CONFIG_ENV_ALIASES_BY_ENV_KEY is a centralized compatibility map introduced after removing manifest input aliases. The code preserves some legacy config names, but the invalid state being tolerated, the source boundary, why this cannot be fixed at the manifest/source of env creation, and the removal condition are not captured in code or docs.
  • Impact: A localized compatibility map can drift from operator-facing setup guidance and future manifests. That can hide breakage for some aliases while leaving others, such as the removed Teams secret alias, ambiguous.
  • Recommended action: Document near CONFIG_ENV_ALIASES_BY_ENV_KEY or in the messaging README that these are legacy operator env names accepted only at config ingestion/compiler boundaries, list which aliases are intentionally excluded, and state when entries may be removed.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read metadata.ts around CONFIG_ENV_ALIASES_BY_ENV_KEY and README alias/state sections; check whether each legacy alias has an owner, intended boundary, and removal rule.
  • Missing regression test: Existing metadata.test.ts proves the alias map shape. Pair that with the behavior tests from the Teams alias finding so the documented source-of-truth boundary is enforced through readMessagingChannelConfigFromEnv, hydrateMessagingChannelConfig, and ManifestCompiler.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read metadata.ts around CONFIG_ENV_ALIASES_BY_ENV_KEY and README alias/state sections; check whether each legacy alias has an owner, intended boundary, and removal rule.
  • Evidence: metadata.ts contains the new hardcoded compatibility map; messaging-channel-config.ts consumes it for config key canonicalization; built-in manifests no longer carry input aliases.

💡 In-scope improvements

These are lower-risk, not throwaway. Prefer fixing them in this PR when they are local to changed code; defer only with rationale or a linked follow-up.

  • None.
Simplification opportunities: 1 possible cut, net -30 lines possible

These are safe simplification checks only. Do not remove validation, security controls, data-loss prevention, or required tests.

  • PRA-4 shrink (src/lib/messaging/compiler/engines/state-update-engine.ts:13): Large channel-specific state-update expected arrays added to src/lib/messaging/channels/manifests.test.ts.
    • Replacement: A focused src/lib/messaging/compiler/engines/state-update-engine.test.ts with custom manifest fixtures plus a small built-in smoke check.
    • Net: -30 lines
    • Safety boundary: Do not remove coverage that proves built-in state paths remain durable; keep or replace it with equivalent assertions for Slack/WeChat/Teams state roots and hydration envs.
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — readMessagingChannelConfigFromEnv canonicalizes TEAMS_CLIENT_ID TEAMS_TENANT_ID and MSTEAMS_ALLOWED_USERS. The changed code feeds messaging onboarding, rebuild hydration, runtime channel setup, and credential/config availability. Existing tests cover many static manifest shapes and some negative render validation, but this PR moves compatibility and state source-of-truth behavior, so behavior-level validation through production resolver/compiler paths is warranted.
  • PRA-T2 Runtime validation — hydrateMessagingChannelConfig writes MSTEAMS_APP_ID MSTEAMS_TENANT_ID and TEAMS_ALLOWED_USERS from legacy Teams aliases. The changed code feeds messaging onboarding, rebuild hydration, runtime channel setup, and credential/config availability. Existing tests cover many static manifest shapes and some negative render validation, but this PR moves compatibility and state source-of-truth behavior, so behavior-level validation through production resolver/compiler paths is warranted.
  • PRA-T3 Runtime validation — ManifestCompiler compiles Teams appId tenantId and allowedUsers from legacy Teams config aliases. The changed code feeds messaging onboarding, rebuild hydration, runtime channel setup, and credential/config availability. Existing tests cover many static manifest shapes and some negative render validation, but this PR moves compatibility and state source-of-truth behavior, so behavior-level validation through production resolver/compiler paths is warranted.
  • PRA-T4 Runtime validation — TEAMS_CLIENT_SECRET alone does not satisfy Teams credential availability, or TEAMS_CLIENT_SECRET resolves to MSTEAMS_APP_PASSWORD for Teams credential availability, matching the intended contract. The changed code feeds messaging onboarding, rebuild hydration, runtime channel setup, and credential/config availability. Existing tests cover many static manifest shapes and some negative render validation, but this PR moves compatibility and state source-of-truth behavior, so behavior-level validation through production resolver/compiler paths is warranted.
  • PRA-T5 Runtime validation — planStateUpdates derives persist groups and rebuild hydration from config input statePath and envKey for custom manifests. The changed code feeds messaging onboarding, rebuild hydration, runtime channel setup, and credential/config availability. Existing tests cover many static manifest shapes and some negative render validation, but this PR moves compatibility and state source-of-truth behavior, so behavior-level validation through production resolver/compiler paths is warranted.
  • PRA-T6 Acceptance clause — Remove redundant messaging manifest fields while preserving existing channel behavior. — add test evidence or identify existing coverage. The diff removes manifest envAliases/state fields and mechanically updates built-ins, but legacy Teams config aliases are not behavior-tested through resolver/hydration/compiler paths and TEAMS_CLIENT_SECRET compatibility is changed or ambiguous.
  • PRA-T7 Acceptance clause — input-level `envAliases` are removed from manifests and kept as internal compatibility metadata. — add test evidence or identify existing coverage. ChannelInputBaseSpec.envAliases is removed and built-in inputs no longer carry aliases; CONFIG_ENV_ALIASES_BY_ENV_KEY preserves config aliases. Behavior coverage is incomplete for TEAMS_CLIENT_ID, TEAMS_TENANT_ID, MSTEAMS_ALLOWED_USERS, and the removed secret alias decision.
  • PRA-T8 Acceptance clause — manifest-owned `state.persist` and `state.rebuildHydration` are removed because config inputs with `statePath` are durable by default. — add test evidence or identify existing coverage. ChannelManifest.state and built-in state blocks are removed, and planStateUpdates derives state updates from config input statePath/envKey. Built-in tests were updated, but there is no focused generic contract test for first-segment grouping, ignored inputs without statePath, or custom manifests.
Since last review details

Current findings, using the urgency labels above:

PRA-1 Resolve/justify — Source-of-truth review needed: CONFIG_ENV_ALIASES_BY_ENV_KEY compatibility aliases

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: Partial: metadata.test.ts checks map shape, messaging-channel-config.test.ts covers Discord aliases and TEAMS_PORT. Missing behavior coverage for TEAMS_CLIENT_ID, TEAMS_TENANT_ID, MSTEAMS_ALLOWED_USERS, and the TEAMS_CLIENT_SECRET decision.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: metadata.ts introduces CONFIG_ENV_ALIASES_BY_ENV_KEY; messaging-channel-config.ts consumes it; teams/manifest.ts removes config aliases and the former TEAMS_CLIENT_SECRET secret alias.

PRA-2 Resolve/justify — Source-of-truth review needed: Derived state updates from config input statePath/envKey

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: Partial: built-in manifest tests assert some derived outputs. Missing focused custom-manifest tests for first-segment grouping, inputs without statePath, secret inputs, and envKey-based hydration.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: ChannelManifest.state is removed; planStateUpdates derives persist-inputs and rebuild-hydration from config inputs with statePath; README only summarizes stateUpdates as config inputs with statePath.

PRA-3 Resolve/justify — Prove legacy Teams env alias behavior after removing input envAliases

  • Location: src/lib/messaging/channels/metadata.ts:13
  • Category: security
  • Problem: The PR removes input-level envAliases from the manifest contract and Teams manifest, then preserves only config aliases through CONFIG_ENV_ALIASES_BY_ENV_KEY. Current tests assert the metadata shape and cover Discord aliases plus TEAMS_PORT, but they do not exercise the production resolver, hydration, or compiler paths for TEAMS_CLIENT_ID, TEAMS_TENANT_ID, or MSTEAMS_ALLOWED_USERS. The former secret alias TEAMS_CLIENT_SECRET is also removed and is not represented in the new compatibility path; manifest-compiler.ts resolves config inputs through resolveMessagingChannelConfigEnvValue but secret inputs still read only process.env[input.envKey].
  • Impact: Operators relying on legacy Teams environment names can silently lose app ID, tenant ID, allowlist, or client-secret compatibility. For Teams messaging setup this can cause failed enrollment/rebuilds or incomplete secure channel configuration; for the allowlist specifically, an unintended empty allowlist can weaken the expected channel access posture.
  • Recommended action: Add behavior-level coverage for the actual config and compiler consumption paths, and either document/test that TEAMS_CLIENT_SECRET is intentionally unsupported or implement a safe credential-alias path if compatibility is required.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Shortest read-only check: inspect src/lib/messaging-channel-config.test.ts for Teams alias cases and src/lib/messaging/compiler/manifest-compiler.ts readInputEnvValue; confirm config inputs use resolveMessagingChannelConfigEnvValue while secret inputs only check the canonical env key.
  • Missing regression test: Add tests named for the behaviors: readMessagingChannelConfigFromEnv canonicalizes TEAMS_CLIENT_ID TEAMS_TENANT_ID and MSTEAMS_ALLOWED_USERS; hydrateMessagingChannelConfig writes MSTEAMS_APP_ID MSTEAMS_TENANT_ID and TEAMS_ALLOWED_USERS from legacy Teams aliases; ManifestCompiler compiles Teams appId tenantId and allowedUsers from legacy Teams config aliases; and either TEAMS_CLIENT_SECRET alone does not satisfy Teams credential availability or TEAMS_CLIENT_SECRET resolves to MSTEAMS_APP_PASSWORD for Teams credential availability, matching the intended contract.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Shortest read-only check: inspect src/lib/messaging-channel-config.test.ts for Teams alias cases and src/lib/messaging/compiler/manifest-compiler.ts readInputEnvValue; confirm config inputs use resolveMessagingChannelConfigEnvValue while secret inputs only check the canonical env key.
  • Evidence: metadata.ts adds CONFIG_ENV_ALIASES_BY_ENV_KEY with Teams config aliases; teams/manifest.ts removes envAliases including TEAMS_CLIENT_SECRET; manifest-compiler.ts readInputEnvValue uses resolveMessagingChannelConfigEnvValue only for config inputs; messaging-channel-config.test.ts currently behavior-tests Discord aliases and Teams port only.

PRA-4 Resolve/justify — Cover and document the derived state-update contract for custom manifests

  • Location: src/lib/messaging/compiler/engines/state-update-engine.ts:13
  • Category: correctness
  • Problem: ChannelManifest.state was removed and planStateUpdates now derives persistence and rebuild hydration from every config input with statePath, grouping persist-inputs by the first segment of statePath and using input.envKey for rebuild hydration. Built-in manifest assertions were updated, and the README says stateUpdates come from config inputs with statePath, but there is no focused generic test for the new contract and the README does not explicitly spell out the first-segment grouping or the removal of independent state.persist/rebuildHydration control.
  • Impact: Manifest authors can miss that persistence/hydration is no longer independently configurable. A future or custom manifest that needs a hydration env different from its config envKey, or persistence grouping independent of the first statePath segment, would silently get different state behavior.
  • Recommended action: Add a focused state-update-engine test covering custom manifests and update the README/type-adjacent documentation to state that config statePath plus envKey is now the only source of truth, including first-segment persistence grouping. Prefer moving the new large built-in expected arrays out of manifests.test.ts into this focused test while keeping a small built-in smoke assertion.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Compare src/lib/messaging/manifest/types.ts removal of ChannelManifest.state with src/lib/messaging/compiler/engines/state-update-engine.ts planStateUpdates and src/lib/messaging/README.md around the stateUpdates and manifest authoring sections.
  • Missing regression test: Add planStateUpdates derives persist groups and rebuild hydration from config input statePath and envKey for custom manifests, including multiple inputs sharing one root, a config input without statePath being ignored, a secret input being ignored, and the emitted rebuild-hydration env matching input.envKey.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Compare src/lib/messaging/manifest/types.ts removal of ChannelManifest.state with src/lib/messaging/compiler/engines/state-update-engine.ts planStateUpdates and src/lib/messaging/README.md around the stateUpdates and manifest authoring sections.
  • Evidence: types.ts removes ChannelStateSpec and ChannelManifest.state; all built-in state blocks are deleted; state-update-engine.ts groups by statePath.split('.', 1)[0] and emits rebuild-hydration from input.envKey; manifests.test.ts adds built-in planStateUpdates expectations but no focused generic engine test exists.

PRA-5 Resolve/justify — Define the source of truth and removal condition for compatibility aliases

  • Location: src/lib/messaging/channels/metadata.ts:13
  • Category: architecture
  • Problem: CONFIG_ENV_ALIASES_BY_ENV_KEY is a centralized compatibility map introduced after removing manifest input aliases. The code preserves some legacy config names, but the invalid state being tolerated, the source boundary, why this cannot be fixed at the manifest/source of env creation, and the removal condition are not captured in code or docs.
  • Impact: A localized compatibility map can drift from operator-facing setup guidance and future manifests. That can hide breakage for some aliases while leaving others, such as the removed Teams secret alias, ambiguous.
  • Recommended action: Document near CONFIG_ENV_ALIASES_BY_ENV_KEY or in the messaging README that these are legacy operator env names accepted only at config ingestion/compiler boundaries, list which aliases are intentionally excluded, and state when entries may be removed.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read metadata.ts around CONFIG_ENV_ALIASES_BY_ENV_KEY and README alias/state sections; check whether each legacy alias has an owner, intended boundary, and removal rule.
  • Missing regression test: Existing metadata.test.ts proves the alias map shape. Pair that with the behavior tests from the Teams alias finding so the documented source-of-truth boundary is enforced through readMessagingChannelConfigFromEnv, hydrateMessagingChannelConfig, and ManifestCompiler.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read metadata.ts around CONFIG_ENV_ALIASES_BY_ENV_KEY and README alias/state sections; check whether each legacy alias has an owner, intended boundary, and removal rule.
  • Evidence: metadata.ts contains the new hardcoded compatibility map; messaging-channel-config.ts consumes it for config key canonicalization; built-in manifests no longer carry input aliases.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@wscurran wscurran added area: messaging Messaging channels, bridges, manifests, or channel lifecycle chore Build, CI, dependency, or tooling maintenance integration: hermes Hermes integration behavior integration: openclaw OpenClaw integration behavior v0.0.71 labels Jun 29, 2026
@sandl99 sandl99 removed the v0.0.71 label Jun 29, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/messaging/applier/build/messaging-build-applier.mts (1)

1001-1007: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve only the exact placeholder requested by the binding.

Lines 1002-1006 keep any existing placeholder that matches the same providerEnvKey. With the new scoped Slack placeholders, that also preserves a different placeholder shape (xoxb-... vs xapp-...) as long as the suffix matches, so a stale value can survive even after credentialBindings.placeholder changes.

Suggested fix
-      typeof existing === "string" &&
-      isProviderPlaceholderForEnvKey(existing, rule.envKey)
+      typeof existing === "string" &&
+      normalizeProviderPlaceholderForEnvKey(existing, rule.envKey) === rule.placeholder
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/messaging/applier/build/messaging-build-applier.mts` around lines
1001 - 1007, The placeholder-preservation check in messaging-build-applier.mts
is too broad because it keeps any existing value that matches the same provider
env key, even when credentialBindings.placeholder has changed to a different
scoped Slack placeholder shape. Tighten the logic in the branch that uses
rules.find and isProviderPlaceholderForEnvKey so it only reuses existing when it
exactly matches the requested placeholder string from desired, and otherwise
replaces it with the new binding value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@agents/hermes/Dockerfile`:
- Around line 190-193: The runtime-plan validation in the Dockerfile’s inline
Node check only validates each `credentialBindings` entry independently, so
duplicate placeholder mappings for the same `providerEnvKey` can slip through
the image build. Update the validation logic in the `node -e` script to track
seen `providerEnvKey` values (or providerEnvKey+placeholder pairs) while
iterating `credentialBindings`, and throw if a duplicate or conflicting mapping
is encountered so the build fails closed during `messaging-build-applier.mts`
runtime-setup processing.

---

Outside diff comments:
In `@src/lib/messaging/applier/build/messaging-build-applier.mts`:
- Around line 1001-1007: The placeholder-preservation check in
messaging-build-applier.mts is too broad because it keeps any existing value
that matches the same provider env key, even when credentialBindings.placeholder
has changed to a different scoped Slack placeholder shape. Tighten the logic in
the branch that uses rules.find and isProviderPlaceholderForEnvKey so it only
reuses existing when it exactly matches the requested placeholder string from
desired, and otherwise replaces it with the new binding value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: fa359b4e-25fa-4844-b8a8-642fa0f5020c

📥 Commits

Reviewing files that changed from the base of the PR and between 4719a14 and 98425b1.

📒 Files selected for processing (13)
  • agents/hermes/Dockerfile
  • agents/hermes/runtime-config-guard.py
  • docs/manage-sandboxes/messaging-channels.mdx
  • scripts/nemoclaw-start.sh
  • src/lib/messaging-channel-config.test.ts
  • src/lib/messaging/applier/build/messaging-build-applier.mts
  • src/lib/messaging/channels/manifest-runtime-metadata.test.ts
  • src/lib/messaging/channels/manifests.test.ts
  • src/lib/messaging/channels/metadata.ts
  • src/lib/messaging/provider-placeholders.test.ts
  • src/lib/messaging/provider-placeholders.ts
  • test/hermes-runtime-api-key.test.ts
  • test/nemoclaw-start-slack-runtime.test.ts
💤 Files with no reviewable changes (1)
  • src/lib/messaging/channels/manifests.test.ts
✅ Files skipped from review due to trivial changes (1)
  • docs/manage-sandboxes/messaging-channels.mdx
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/lib/messaging/provider-placeholders.ts
  • scripts/nemoclaw-start.sh
  • agents/hermes/runtime-config-guard.py
  • src/lib/messaging/channels/metadata.ts

Comment thread agents/hermes/Dockerfile Resolved

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
src/lib/messaging-channel-config.test.ts (1)

124-126: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prove the alias key is gone, not just that the canonical key is present.

Line 124 only checks a partial match, so this still passes if readMessagingChannelConfigFromEnv() returns both the canonical key and the legacy alias. Tighten this to an exact object (or explicitly assert the compat key is absent) so the test proves the superseded path cannot survive. As per path instructions, "**/*.test.{ts,js,mts,mjs,cts,cjs}: Migration tests must prove the superseded path is unreachable or removed, not merely prove that the new path also works."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/messaging-channel-config.test.ts` around lines 124 - 126, The test in
readMessagingChannelConfigFromEnv currently uses a partial object match, so it
can still pass if the legacy alias is returned alongside the canonical key.
Tighten the assertion in src/lib/messaging-channel-config.test.ts to verify the
exact shape of the result from readMessagingChannelConfigFromEnv, or add an
explicit negative assertion that the compat alias key is absent, so the
migration test proves the superseded path is removed.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/lib/messaging-channel-config.test.ts`:
- Around line 124-126: The test in readMessagingChannelConfigFromEnv currently
uses a partial object match, so it can still pass if the legacy alias is
returned alongside the canonical key. Tighten the assertion in
src/lib/messaging-channel-config.test.ts to verify the exact shape of the result
from readMessagingChannelConfigFromEnv, or add an explicit negative assertion
that the compat alias key is absent, so the migration test proves the superseded
path is removed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3f881e5a-dda1-404b-bff6-feda86bb90b7

📥 Commits

Reviewing files that changed from the base of the PR and between 98425b1 and 772d738.

📒 Files selected for processing (10)
  • agents/hermes/runtime-config-guard.py
  • src/lib/messaging-channel-config.test.ts
  • src/lib/messaging-channel-config.ts
  • src/lib/messaging/channels/manifest-runtime-metadata.test.ts
  • src/lib/messaging/channels/telegram/hooks/allowlist-aliases.test.ts
  • src/lib/messaging/channels/telegram/hooks/allowlist-aliases.ts
  • src/lib/messaging/provider-placeholders.test.ts
  • test/hermes-runtime-api-key.test.ts
  • test/messaging-build-applier.test.ts
  • test/nemoclaw-start-slack-runtime.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/lib/messaging/provider-placeholders.test.ts
  • test/nemoclaw-start-slack-runtime.test.ts
  • src/lib/messaging-channel-config.ts
  • src/lib/messaging/channels/manifest-runtime-metadata.test.ts

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
src/lib/messaging-channel-config.test.ts (1)

106-129: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the canonical-over-alias conflict case to hydrateMessagingChannelConfig.

The matrix now proves canonical precedence for readMessagingChannelConfigFromEnv, but hydration still only covers the alias-only path. That leaves the migrated hydrate entrypoint unproven when both keys are present, which is where an old alias path can still linger.

♻️ Suggested coverage
   expect(readMessagingChannelConfigFromEnv(env)).toMatchObject({
     [canonical]: `canonical-${canonical}`,
   });
+  expect(hydrateMessagingChannelConfig(null, env)).toMatchObject({
+    [canonical]: `canonical-${canonical}`,
+  });
   });

As per path instructions, "Trace every in-scope entrypoint and lifecycle path" and "Tests must prove that public entrypoints reach the new path and that the old path is deleted or cannot execute."

Also applies to: 185-193

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/messaging-channel-config.test.ts` around lines 106 - 129, Add a test
for the canonical-versus-alias conflict path in hydrateMessagingChannelConfig,
since the current matrix only proves this behavior through
readMessagingChannelConfigFromEnv. Update the hydrate-focused test coverage to
use an env containing both the canonical key and its compatibility alias, and
assert that hydrateMessagingChannelConfig resolves the canonical value and does
not fall back to the alias. Use hydrateMessagingChannelConfig and the existing
resolveMessagingChannelConfigEnvValue/readMessagingChannelConfigFromEnv helpers
as anchors when locating the test cases.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/lib/messaging-channel-config.test.ts`:
- Around line 106-129: Add a test for the canonical-versus-alias conflict path
in hydrateMessagingChannelConfig, since the current matrix only proves this
behavior through readMessagingChannelConfigFromEnv. Update the hydrate-focused
test coverage to use an env containing both the canonical key and its
compatibility alias, and assert that hydrateMessagingChannelConfig resolves the
canonical value and does not fall back to the alias. Use
hydrateMessagingChannelConfig and the existing
resolveMessagingChannelConfigEnvValue/readMessagingChannelConfigFromEnv helpers
as anchors when locating the test cases.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e63e6fb4-815b-4771-a63e-b72fbb7b51ea

📥 Commits

Reviewing files that changed from the base of the PR and between 772d738 and 0709ff5.

📒 Files selected for processing (8)
  • agents/hermes/Dockerfile
  • agents/hermes/runtime-config-guard.py
  • docs/manage-sandboxes/messaging-channels.mdx
  • src/lib/messaging-channel-config.test.ts
  • src/lib/messaging/channels/metadata.test.ts
  • src/lib/messaging/channels/metadata.ts
  • src/lib/messaging/channels/telegram/hooks/allowlist-aliases.test.ts
  • test/hermes-runtime-api-key.test.ts
✅ Files skipped from review due to trivial changes (1)
  • docs/manage-sandboxes/messaging-channels.mdx
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/lib/messaging/channels/metadata.test.ts
  • src/lib/messaging/channels/telegram/hooks/allowlist-aliases.test.ts
  • agents/hermes/Dockerfile
  • test/hermes-runtime-api-key.test.ts
  • src/lib/messaging/channels/metadata.ts
  • agents/hermes/runtime-config-guard.py

@github-actions

github-actions Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

E2E Target Recommendation

Required E2E targets: hermes-discord, hermes-slack, rebuild-hermes
Optional E2E targets: None

Dispatch required E2E targets:

  • gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=hermes-discord
  • gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=hermes-slack
  • gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=rebuild-hermes

Workflow run

Full E2E target advisor summary

E2E Target Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E targets

  • hermes-discord: Discord messaging manifest and config alias handling changed; this free-standing E2E job exercises Hermes Discord enrollment/config aliases, provider placeholders, and rebuild-related contracts.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=hermes-discord
  • hermes-slack: Slack messaging manifest state derivation changed; this free-standing E2E job covers Hermes Slack provider/placeholder, policy, secret-boundary, and Slack egress contracts.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=hermes-slack
  • rebuild-hermes: The generic messaging state-update engine now derives persistence and rebuild hydration from config input statePath metadata, so Hermes rebuild should verify persisted messaging placeholders and hydration behavior.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=rebuild-hermes

Optional E2E targets

  • None.

Relevant changed files

  • src/lib/messaging-channel-config.ts
  • src/lib/messaging/channels/discord/manifest.ts
  • src/lib/messaging/channels/metadata.ts
  • src/lib/messaging/channels/slack/manifest.ts
  • src/lib/messaging/channels/teams/manifest.ts
  • src/lib/messaging/channels/telegram/manifest.ts
  • src/lib/messaging/channels/wechat/manifest.ts
  • src/lib/messaging/channels/whatsapp/manifest.ts
  • src/lib/messaging/compiler/engines/state-update-engine.ts
  • src/lib/messaging/manifest/types.ts

@sandl99

sandl99 commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator Author

Conflict-resolution follow-up for current head 832a591f2bd54514d6bca0e823f781e9bd3e0eb4: this push is a merge-only update from origin/main plus the resolved src/lib/messaging/channels/manifests.test.ts hunk, and it does not introduce new implementation changes for the Nemotron items. The new GPT advisor comment is merge_as_is; all 43 check-runs completed with no failed conclusions, and required checks are green. The Nemotron items repeat the previous advisor cycle and remain covered or justified in #5994 (comment).

@github-actions

Copy link
Copy Markdown
Contributor

Vitest E2E Target Results — ✅ All selected jobs passed

Run: 28436225355
Workflow ref: chore/messaging-manifest-normalize
Requested targets: onboard-resume,onboard-repair,cloud-onboard,messaging-providers,channels-add-remove,hermes-slack,hermes-sandbox-secret-boundary,hermes-root-entrypoint-smoke,hermes-e2e,hermes-discord,channels-stop-start,openclaw-slack-pairing
Requested jobs: (default — all default-enabled free-standing jobs; explicit-only jobs such as jetson-nvmap-gpu and sandbox-rlimits-connect are skipped unless selected)
Summary: 12 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
channels-add-remove ✅ success
channels-stop-start ✅ success
cloud-onboard ✅ success
hermes-discord ✅ success
hermes-e2e ✅ success
hermes-root-entrypoint-smoke ✅ success
hermes-sandbox-secret-boundary ✅ success
hermes-slack ✅ success
messaging-providers ✅ success
onboard-repair ✅ success
onboard-resume ✅ success
openclaw-slack-pairing ✅ success

@NVIDIA NVIDIA deleted a comment from github-actions Bot Jun 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Vitest E2E Target Results — ✅ All default jobs passed

Run: 28438453094
Workflow ref: chore/messaging-manifest-normalize
Requested targets: (default — all supported)
Requested jobs: (default — all default-enabled free-standing jobs; explicit-only jobs such as jetson-nvmap-gpu and sandbox-rlimits-connect are skipped unless selected)
Summary: 71 passed, 0 failed, 0 cancelled, 2 skipped

Job Result
agent-turn-latency ✅ success
bedrock-runtime-compatible-anthropic ✅ success
brave-search ✅ success
channels-add-remove ✅ success
channels-stop-start ✅ success
cloud-inference ✅ success
cloud-onboard ✅ success
common-egress-agent ✅ success
concurrent-gateway-ports ✅ success
credential-migration ✅ success
credential-sanitization ✅ success
cron-preflight-inference-local ✅ success
device-auth-health ✅ success
diagnostics ✅ success
docs-validation ✅ success
double-onboard ✅ success
full-e2e ✅ success
gateway-drift-preflight ✅ success
gateway-guard-recovery ✅ success
gateway-health-honest ✅ success
generate-matrix ✅ success
gpu-double-onboard ✅ success
gpu-e2e ✅ success
hermes-dashboard ✅ success
hermes-discord ✅ success
hermes-e2e ✅ success
hermes-inference-switch ✅ success
hermes-root-entrypoint-smoke ✅ success
hermes-sandbox-secret-boundary ✅ success
hermes-slack ✅ success
inference-routing ✅ success
issue-2478-crash-loop-recovery ✅ success
issue-4434-tui-unreachable-inference ✅ success
issue-4462-scope-upgrade-approval ✅ success
jetson-nvmap-gpu ⏭️ skipped
kimi-inference-compat ✅ success
launchable-smoke ✅ success
live ✅ success
messaging-compatible-endpoint ✅ success
messaging-providers ✅ success
model-router-provider-routed-inference ✅ success
network-policy ✅ success
ollama-auth-proxy ✅ success
onboard-negative-paths ✅ success
onboard-repair ✅ success
onboard-resume ✅ success
openclaw-discord-pairing ✅ success
openclaw-inference-switch ✅ success
openclaw-skill-cli ✅ success
openclaw-slack-pairing ✅ success
openclaw-tui-chat-correlation ✅ success
openshell-gateway-upgrade ✅ success
openshell-version-pin ✅ success
overlayfs-autofix ✅ success
rebuild-hermes ✅ success
rebuild-hermes-stale-base ✅ success
rebuild-openclaw ✅ success
runtime-overrides ✅ success
sandbox-operations ✅ success
sandbox-rebuild ✅ success
sandbox-rlimits-connect ⏭️ skipped
sandbox-survival ✅ success
security-posture ✅ success
sessions-agents-cli ✅ success
shields-config ✅ success
skill-agent ✅ success
snapshot-commands ✅ success
spark-install ✅ success
state-backup-restore ✅ success
telegram-injection ✅ success
token-rotation ✅ success
tunnel-lifecycle ✅ success
upgrade-stale-sandbox ✅ success

Explicit-only jobs skipped: sandbox-rlimits-connect (default dispatch excludes the destructive rlimit fork/connect probe unless selected; validate with jobs=sandbox-rlimits-connect or targets=sandbox-rlimits-connect), jetson-nvmap-gpu (default dispatch excludes Jetson until a stable Jetson runner is available; validate with jobs=jetson-nvmap-gpu or targets=jetson-nvmap-gpu).

@sandl99 sandl99 changed the title chore(messaging): normalize manifest runtime metadata chore(messaging): remove manifest input env aliases Jun 30, 2026
@sandl99 sandl99 changed the title chore(messaging): remove manifest input env aliases chore(messaging): remove redundant manifest fields Jun 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Vitest E2E Target Results — ✅ All requested jobs passed

Run: 28449002186
Workflow ref: chore/messaging-manifest-normalize
Requested targets: (default — all supported)
Requested jobs: channels-add-remove,channels-stop-start,messaging-compatible-endpoint,messaging-providers
Summary: 4 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
channels-add-remove ✅ success
channels-stop-start ✅ success
messaging-compatible-endpoint ✅ success
messaging-providers ✅ success

@sandl99
sandl99 requested a review from cv June 30, 2026 14:16

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clean schema cleanup — and removed, state updates derived from as single source of truth, aliases preserved in static lookup. Regression tests lock both invariants. LGTM.

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clean schema cleanup. State updates now derived from inputs with statePath as single source of truth, aliases moved to static lookup in metadata.ts. Regression tests lock both invariants. LGTM.

@jyaunches
jyaunches merged commit 0a1ca4c into main Jun 30, 2026
119 checks passed
@jyaunches
jyaunches deleted the chore/messaging-manifest-normalize branch June 30, 2026 17:32
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
<!-- markdownlint-disable MD041 -->
## Summary
Remove redundant messaging manifest fields while preserving existing
channel behavior.

This PR now covers the first schema cleanup slice for issue NVIDIA#5984:
- input-level `envAliases` are removed from manifests and kept as
internal compatibility metadata.
- manifest-owned `state.persist` and `state.rebuildHydration` are
removed because config inputs with `statePath` are durable by default.

Runtime `envAliases`, runtime visibility metadata, startup placeholder
handling, and provider/runtime artifact validation are intentionally
left unchanged.

## Changes
- Removed `envAliases` from the shared manifest input type and from
Discord/Teams built-in inputs.
- Kept legacy config env compatibility through the metadata helper used
by channel config resolution.
- Removed `ChannelManifest.state`, `ChannelStateSpec`, and all built-in
`state.persist` / `state.rebuildHydration` blocks.
- Changed `planStateUpdates()` to derive `persist-inputs` and
`rebuild-hydration` entries from config inputs that declare `statePath`.
- Added manifest regression tests proving built-in inputs no longer
carry input aliases and all built-in config inputs are durable by
default.
- Updated the internal messaging README authoring model.

## Type of Change

- [x] Code change (feature, bug fix, or refactor)
- [x] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Quality Gates
<!-- Check all that apply. For any "covered by existing tests", "not
applicable", or waiver entry, add a brief justification on the same line
or in the Changes section. -->
- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [x] Docs updated for user-facing behavior changes — internal messaging
README authoring text only.
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — this narrowed PR changes messaging manifest metadata and
preserves runtime/startup behavior.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification
<!-- Check each item you ran and confirmed. Leave unchecked items you
skipped. Doc-only changes do not require npm test unless you ran it. -->
- [x] PR description includes the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [ ] Git hooks passed during commit and push, or `npx prek run
--from-ref main --to-ref HEAD` passes
- [x] Targeted tests pass for changed behavior: `npx vitest run
src/lib/messaging/channels src/lib/messaging/manifest
src/lib/messaging/compiler src/lib/messaging-channel-config.test.ts`
- [ ] Full `npm test` passes (broad runtime changes only)
- [x] Type-check passed: `npm run typecheck:cli`
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only)
- [x] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
<!-- DCO sign-off is required in this PR description, and every commit
must appear as Verified in GitHub. Run: git config user.name && git
config user.email -->
Signed-off-by: San Dang <[email protected]>

---------

Signed-off-by: San Dang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: messaging Messaging channels, bridges, manifests, or channel lifecycle chore Build, CI, dependency, or tooling maintenance integration: hermes Hermes integration behavior integration: openclaw OpenClaw integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants